Finished guild sidebar
This commit is contained in:
@@ -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 (
|
||||
<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">
|
||||
@@ -98,6 +128,10 @@ export default function Sidebar({ guild }: SidebarProps) {
|
||||
<Separator className="my-4" />
|
||||
<PreferedGames />
|
||||
<Separator className="my-4" />
|
||||
<Achievements />
|
||||
<Separator className="my-4" />
|
||||
<GameExperience />
|
||||
<Separator className="my-4" />
|
||||
</CardContent>
|
||||
</Card>
|
||||
)
|
||||
|
||||
@@ -26,7 +26,13 @@ export const guildSchema = z.object({
|
||||
description: z.string().optional(),
|
||||
joinable: 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()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user