diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx index 58eea6c..3ec3b5e 100644 --- a/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx +++ b/src/app/(stats)/player/[ign]/_stats/skywars/client.tsx @@ -7,7 +7,7 @@ import Link from "next/link" import { useEffect, useState } from "react" import { Tooltip } from "react-tooltip" -export function PresigeousHeads({ heads }: { heads: { name: string | null, timestamp: number, sacrifice: string }[] }) { +export function PresigeousHeads({ heads }: { heads: { username: string, timestamp: number, sacrifice: string }[] }) { const [pos, setPos] = useState({ x: 0, y: 0 }) useEffect(() => { @@ -27,23 +27,19 @@ export function PresigeousHeads({ heads }: { heads: { name: string | null, times return (
- {heads.map(({ name, sacrifice }, index) => { - if (!name) { - return null - } - + {heads.map(({ username, sacrifice }, index) => { const text = sacrifice.at(0) + sacrifice.split("").slice(1, sacrifice.length).join("").toLowerCase() return ( - + {name} ) diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx index e8d785b..ea03e2a 100644 --- a/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx +++ b/src/app/(stats)/player/[ign]/_stats/skywars/components.tsx @@ -19,7 +19,7 @@ type SkywarsHeadsProps = { divine: number heavenly: number } - prestigeous: { name: string | null, timestamp: number, sacrifice: string }[] + prestigeous: { username: string, timestamp: number, sacrifice: string }[] } export function SkywarsHeads({ @@ -50,9 +50,9 @@ export function SkywarsHeads({ {"Total Heads Gathered: "} {formatNumber(heads)}

- {total_special > 0 && } + {total_special > 0 ? :

This person has no heads collected.

}

Prestigious Head Collection

- + {prestigeous.length > 0 ? :

No prestigeous heads. Now what a skill issue.

}
) } diff --git a/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx b/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx index b377103..0ef642f 100644 --- a/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx +++ b/src/app/(stats)/player/[ign]/_stats/skywars/skywars.tsx @@ -93,13 +93,17 @@ export default function SkyWarsStats( tasty: stats.heads_tasty, yucky: stats.heads_yucky }} - prestigeous={stats.head_collection === undefined ? [] : stats.head_collection.prestigious.map(v => { - return { - name: v.username, - timestamp: v.timestamp, - sacrifice: v.sacrifice - } - })} + prestigeous={stats.head_collection === undefined + ? [] + : stats.head_collection.prestigious.map(v => { + if (v.username === null) return null + + return { + username: v.username, + timestamp: v.timestamp, + sacrifice: v.sacrifice + } + }).filter(v => v !== null)} /> diff --git a/src/lib/schema/stats.ts b/src/lib/schema/stats.ts index ca9a961..e24c6e5 100644 --- a/src/lib/schema/stats.ts +++ b/src/lib/schema/stats.ts @@ -261,7 +261,7 @@ export const skywarsStatsSchema = z.looseObject({ heads_heavenly: z.number().default(0), head_collection: z.looseObject({ prestigious: z.array(z.object({ - username: z.string().nullable(), + username: z.string().nullable().default(null), timestamp: z.number(), mode: z.string(), sacrifice: z.string()