Canged pres heads

This commit is contained in:
2025-09-01 11:39:05 +02:00
parent 3763e6c381
commit 1e363e8d5b
4 changed files with 20 additions and 20 deletions

View File

@@ -7,7 +7,7 @@ import Link from "next/link"
import { useEffect, useState } from "react" import { useEffect, useState } from "react"
import { Tooltip } from "react-tooltip" 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 }) const [pos, setPos] = useState({ x: 0, y: 0 })
useEffect(() => { useEffect(() => {
@@ -27,23 +27,19 @@ export function PresigeousHeads({ heads }: { heads: { name: string | null, times
return ( return (
<div className="flex flex-wrap gap-2"> <div className="flex flex-wrap gap-2">
{heads.map(({ name, sacrifice }, index) => { {heads.map(({ username, sacrifice }, index) => {
if (!name) {
return null
}
const text = sacrifice.at(0) + sacrifice.split("").slice(1, sacrifice.length).join("").toLowerCase() const text = sacrifice.at(0) + sacrifice.split("").slice(1, sacrifice.length).join("").toLowerCase()
return ( return (
<Link href={`/player/${name}`} key={index}> <Link href={`/player/${username}`} key={index}>
<Image <Image
data-id="presigeous-heads" data-id="presigeous-heads"
data-tooltip-id="presigeous-heads" data-tooltip-id="presigeous-heads"
data-tooltip-content={text} data-tooltip-content={text}
src={`https://minotar.net/helm/${name}/24.png`} src={`https://minotar.net/helm/${username}/24.png`}
width={24} width={24}
height={24} height={24}
alt={name} alt={username}
/> />
</Link> </Link>
) )

View File

@@ -19,7 +19,7 @@ type SkywarsHeadsProps = {
divine: number divine: number
heavenly: number heavenly: number
} }
prestigeous: { name: string | null, timestamp: number, sacrifice: string }[] prestigeous: { username: string, timestamp: number, sacrifice: string }[]
} }
export function SkywarsHeads({ export function SkywarsHeads({
@@ -50,9 +50,9 @@ export function SkywarsHeads({
<span className="font-bold">{"Total Heads Gathered: "}</span> <span className="font-bold">{"Total Heads Gathered: "}</span>
<span className="text-mc-gray">{formatNumber(heads)}</span> <span className="text-mc-gray">{formatNumber(heads)}</span>
</p> </p>
{total_special > 0 && <HeadsBar heads={headsArray} heads_total={heads} />} {total_special > 0 ? <HeadsBar heads={headsArray} heads_total={heads} /> : <p>This person has no heads collected.</p>}
<p className="font-bold">Prestigious Head Collection</p> <p className="font-bold">Prestigious Head Collection</p>
<PresigeousHeads heads={prestigeous} /> {prestigeous.length > 0 ? <PresigeousHeads heads={prestigeous} /> : <p>No prestigeous heads. Now what a skill issue.</p>}
</div> </div>
) )
} }

View File

@@ -93,13 +93,17 @@ export default function SkyWarsStats(
tasty: stats.heads_tasty, tasty: stats.heads_tasty,
yucky: stats.heads_yucky yucky: stats.heads_yucky
}} }}
prestigeous={stats.head_collection === undefined ? [] : stats.head_collection.prestigious.map(v => { prestigeous={stats.head_collection === undefined
return { ? []
name: v.username, : stats.head_collection.prestigious.map(v => {
timestamp: v.timestamp, if (v.username === null) return null
sacrifice: v.sacrifice
} return {
})} username: v.username,
timestamp: v.timestamp,
sacrifice: v.sacrifice
}
}).filter(v => v !== null)}
/> />
</div> </div>
</AccordionContent> </AccordionContent>

View File

@@ -261,7 +261,7 @@ export const skywarsStatsSchema = z.looseObject({
heads_heavenly: z.number().default(0), heads_heavenly: z.number().default(0),
head_collection: z.looseObject({ head_collection: z.looseObject({
prestigious: z.array(z.object({ prestigious: z.array(z.object({
username: z.string().nullable(), username: z.string().nullable().default(null),
timestamp: z.number(), timestamp: z.number(),
mode: z.string(), mode: z.string(),
sacrifice: z.string() sacrifice: z.string()