Updated build battle with new titles

This commit is contained in:
2025-09-06 10:25:34 +02:00
parent 29d13baf5c
commit 00fe2b62e3
6 changed files with 29 additions and 20 deletions

View File

@@ -46,7 +46,7 @@ export default function GenericProgress({ percent, tooltipId, tooltipContent, cl
>
<div
data-id={tooltipId}
className={cn("h-5 rounded-l-md", percent > 100 ? "rounded-r-md" : undefined, className)}
className={cn("h-5 rounded-l-md", percent >= 100 ? "rounded-r-md" : undefined, className)}
style={{
width: `${percent > 100 ? 100 : percent}%`,
background: "repeating-linear-gradient(to right,#f55,#fa0,#ff5,#5f5,#5ff,#f5f,#a0a,#f55 16rem)"
@@ -75,7 +75,7 @@ export default function GenericProgress({ percent, tooltipId, tooltipContent, cl
>
<div
data-id={tooltipId}
className={cn("h-5 rounded-l-md", percent > 100 ? "rounded-r-md" : undefined, className)}
className={cn("h-5 rounded-l-md", percent >= 100 ? "rounded-r-md" : undefined, className)}
style={{ width: `${percent > 100 ? 100 : percent}%` }}
>
</div>

View File

@@ -4,6 +4,7 @@ import { Separator } from "@/components/ui/separator"
import { formatNumber } from "@/lib/formatters"
import { getBuildBattleRank } from "@/lib/hypixel/build-battle/general"
import { NonNullStats } from "@/lib/schema/player"
import { cn } from "@/lib/utils"
import CollapsedStats from "../../_components/CollapsedStats"
import BuildBattleTitleProgress from "./progress"
import BuildBattleGeneralStats from "./stats"
@@ -25,7 +26,7 @@ export default function BuildBattleStats({ stats }: { stats: NonNullStats["Build
stats={[
{
title: <p>Title</p>,
stat: <p className={`font-bold text-mc-${rank.color}`}>{rank.name}</p>
stat: <p className={cn(rank.bold && "font-bold", `text-mc-${rank.color}`)}>{rank.name}</p>
},
{
title: <p>Wins</p>,

View File

@@ -14,11 +14,11 @@ export default function BuildBattleTitleProgress({ score }: { score: number }) {
<GenericProgress
percent={percent}
tooltipId="build-battle-progress"
tooltipContent={`${score}/${next !== null ? next.value : 0} Score`}
tooltipContent={`${score}/${next.value} Score`}
className={`bg-mc-${current.color}`}
/>
<p className={cn("font-bold", next !== null ? `text-mc-${next.color}` : "text-mc-gold")}>
{next !== null ? next.name : "Already max rank"}
<p className={cn(next.bold && "font-bold", `text-mc-${next.color}`)}>
{next.name}
</p>
</div>
)

View File

@@ -2,6 +2,7 @@ import { formatNumber } from "@/lib/formatters"
import { getBuildBattleRank } from "@/lib/hypixel/build-battle/general"
import { devide } from "@/lib/hypixel/general"
import { NonNullStats } from "@/lib/schema/player"
import { cn } from "@/lib/utils"
import { BasicStat } from "../../_components/Stats"
export default function BuildBattleGeneralStats({ stats }: { stats: NonNullable<NonNullStats["BuildBattle"]> }) {
@@ -10,7 +11,7 @@ export default function BuildBattleGeneralStats({ stats }: { stats: NonNullable<
<div className="flex">
<div className="flex-1">
<BasicStat title="Score: " value={formatNumber(stats.score)} />
<BasicStat title="Title: " value={rank.name} className={`font-bold text-mc-${rank.color}`} />
<BasicStat title="Title: " value={rank.name} className={cn(rank.bold && "font-bold", `text-mc-${rank.color}`)} />
<BasicStat title="Tokens: " value={formatNumber(stats.coins)} className="text-mc-dark-green" />
</div>
<div className="flex-1">