Finished guild sidebar

This commit is contained in:
2025-09-27 21:53:09 +02:00
parent 1bbad447e6
commit 4647e9df60
2 changed files with 41 additions and 1 deletions

View File

@@ -78,6 +78,36 @@ export default function Sidebar({ guild }: SidebarProps) {
) )
} }
function Achievements() {
return (
<div>
<h2 className="text-xl font-bold">Achievements</h2>
<BasicSidebarItem title="Experience Kings: " value={formatNumber(guild.achievements.EXPERIENCE_KINGS)} />
<BasicSidebarItem title="Winners: " value={formatNumber(guild.achievements.WINNERS)} />
<BasicSidebarItem title="Online Players: " value={formatNumber(guild.achievements.ONLINE_PLAYERS)} />
</div>
)
}
function GameExperience() {
return (
<div>
<h2 className="text-xl font-bold">Experience</h2>
{guild.guildExpByGameType === undefined ? <p>No EXP in any games</p> : (
<div>
{Object.entries(guild.guildExpByGameType).map(g => {
const game = getGame(g[0])
if (!game) return null
return { name: game.name, val: g[1] }
}).filter(g => g !== null).sort().map((v, i) => {
return <BasicSidebarItem key={i} title={`${v.name}: `} value={formatNumber(v.val)} />
})}
</div>
)}
</div>
)
}
return ( return (
<Card className="mx-auto w-full lg:mx-0 lg:w-1/4 max-w-120 md:max-w-3/10"> <Card className="mx-auto w-full lg:mx-0 lg:w-1/4 max-w-120 md:max-w-3/10">
<CardHeader className="flex justify-center"> <CardHeader className="flex justify-center">
@@ -98,6 +128,10 @@ export default function Sidebar({ guild }: SidebarProps) {
<Separator className="my-4" /> <Separator className="my-4" />
<PreferedGames /> <PreferedGames />
<Separator className="my-4" /> <Separator className="my-4" />
<Achievements />
<Separator className="my-4" />
<GameExperience />
<Separator className="my-4" />
</CardContent> </CardContent>
</Card> </Card>
) )

View File

@@ -26,7 +26,13 @@ export const guildSchema = z.object({
description: z.string().optional(), description: z.string().optional(),
joinable: z.boolean().default(false), joinable: z.boolean().default(false),
publiclyListed: z.boolean().default(false), publiclyListed: z.boolean().default(false),
preferredGames: z.array(z.string()).optional() preferredGames: z.array(z.string()).optional(),
achievements: z.object({
WINNERS: z.number().default(0),
EXPERIENCE_KINGS: z.number().default(0),
ONLINE_PLAYERS: z.number().default(0)
}),
guildExpByGameType: z.record(z.string(), z.number()).optional()
}) })
}) })