diff --git a/src/pages/users/[name].tsx b/src/pages/users/[name].tsx index 604b531..a20867e 100644 --- a/src/pages/users/[name].tsx +++ b/src/pages/users/[name].tsx @@ -1,6 +1,6 @@ import { SnCheckInRecord } from '@/services/checkIn' import { getAttachmentUrl, sni } from '@/services/network' -import { SnAccount } from '@/services/user' +import { SnAccount, SnAccountBadgeMapping } from '@/services/user' import { Avatar, Box, Card, CardContent, Container, Grid2 as Grid, Typography } from '@mui/material' import { LineChart } from '@mui/x-charts' import type { InferGetServerSidePropsType, GetServerSideProps } from 'next' @@ -44,7 +44,7 @@ export default function UserProfile({ user, checkIn }: InferGetServerSidePropsTy - + @@ -64,7 +64,7 @@ export default function UserProfile({ user, checkIn }: InferGetServerSidePropsTy ]} xAxis={[ { - scaleType: 'time', + scaleType: 'band', data: checkIn.map((c) => { const og = new Date(c.createdAt) og.setHours(0, 0, 0, 0) @@ -93,17 +93,53 @@ export default function UserProfile({ user, checkIn }: InferGetServerSidePropsTy - + + + + + Badges + + + + {user.badges.map((b) => ( + + {SnAccountBadgeMapping[b.type].icon} + + {SnAccountBadgeMapping[b.type].name} + {b.metadata.title && {b.metadata.title}} + + + ))} + + + + Information + {user.description && ( + + {user.description} + + )} + Born on {new Date(user.profile!.birthday!).toLocaleDateString()} - Joined at {new Date(user.createdAt).toLocaleDateString()} + + Joined at {new Date(user.createdAt).toLocaleDateString()} + + + + #{user.id.toString().padStart(8, '0')} + diff --git a/src/services/user.ts b/src/services/user.tsx similarity index 82% rename from src/services/user.ts rename to src/services/user.tsx index 62a7677..bb6aa40 100644 --- a/src/services/user.ts +++ b/src/services/user.tsx @@ -1,6 +1,10 @@ import { create } from 'zustand' import { sni } from './network' import { hasCookie } from 'cookies-next/client' +import { JSX } from 'react' + +import ConstructionIcon from '@mui/icons-material/Construction' +import FlagIcon from '@mui/icons-material/Flag' export interface SnAccount { id: number @@ -60,6 +64,17 @@ export interface SnAccountBadge { metadata: Record } +export const SnAccountBadgeMapping: Record = { + 'company.staff': { + icon: , + name: 'Solsynth Staff', + }, + 'site.migration': { + icon: , + name: 'Solar Network Natives', + }, +} + export interface UserStore { account: SnAccount | undefined fetchUser: () => Promise