Canged pres heads
This commit is contained in:
@@ -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>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
|
? []
|
||||||
|
: stats.head_collection.prestigious.map(v => {
|
||||||
|
if (v.username === null) return null
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: v.username,
|
username: v.username,
|
||||||
timestamp: v.timestamp,
|
timestamp: v.timestamp,
|
||||||
sacrifice: v.sacrifice
|
sacrifice: v.sacrifice
|
||||||
}
|
}
|
||||||
})}
|
}).filter(v => v !== null)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user