import Link from 'next/link' import Image from 'react-bootstrap/Image' import { abbrNum, numWithUnits } from '@/lib/format' import styles from './item.module.css' import userStyles from './user-header.module.css' import React, { useEffect, useMemo, useState } from 'react' import { useQuery } from '@apollo/client' import MoreFooter from './more-footer' import { useData } from './use-data' import Hat from './hat' import { useMe } from './me' import { MEDIA_URL } from '@/lib/constants' import { NymActionDropdown } from '@/components/user-header' import classNames from 'classnames' // all of this nonsense is to show the stat we are sorting by first const Stacked = ({ user }) => (user.optional.stacked !== null && {abbrNum(user.optional.stacked)} stacked) const Spent = ({ user }) => (user.optional.spent !== null && {abbrNum(user.optional.spent)} spent) const Posts = ({ user }) => ( {numWithUnits(user.nposts, { unitSingular: 'post', unitPlural: 'posts' })} ) const Comments = ({ user }) => ( {numWithUnits(user.ncomments, { unitSingular: 'comment', unitPlural: 'comments' })} ) const Referrals = ({ user }) => (user.optional.referrals !== null && {numWithUnits(user.optional.referrals, { unitSingular: 'referral', unitPlural: 'referrals' })}) const Seperator = () => ( \ ) const STAT_POS = { stacked: 0, spent: 1, posts: 2, comments: 3, referrals: 4 } const STAT_COMPONENTS = [Stacked, Spent, Posts, Comments, Referrals] function seperate (arr, seperator) { return arr.flatMap((x, i) => i < arr.length - 1 ? [x, seperator] : [x]) } export function UserBase ({ user, className, children, nymActionDropdown }) { return (