Leaderboard: High Score board (unified score) in place of Most Moonrocks

This commit is contained in:
jwinterm
2026-06-28 19:58:01 -04:00
parent b96224e287
commit 22b383b391
@@ -35,6 +35,7 @@ type Score = {
completion_time: number; completion_time: number;
fuel_remaining: number; fuel_remaining: number;
crypto_collected: number; crypto_collected: number;
score?: number; // present once the unified-score backend is deployed
stars: number; stars: number;
wave: number; wave: number;
platform: string | null; platform: string | null;
@@ -86,7 +87,7 @@ export default async function LeaderboardPage({
const scores = await fetchBoard(level, board); const scores = await fetchBoard(level, board);
const levelName = level === 12 ? "Endless Mode" : LEVELS[level - 1]; const levelName = level === 12 ? "Endless Mode" : LEVELS[level - 1];
const metricLabel = board === "time" ? "Time" : board === "score" ? "Moonrocks" : "Wave"; const metricLabel = board === "time" ? "Time" : board === "score" ? "Score" : "Wave";
const base = "/products/such-moon-launch/leaderboard"; const base = "/products/such-moon-launch/leaderboard";
return ( return (
@@ -140,7 +141,7 @@ export default async function LeaderboardPage({
{/* Board selector (story levels only) */} {/* Board selector (story levels only) */}
{!isEndless && ( {!isEndless && (
<div className="flex flex-wrap gap-2 mb-6"> <div className="flex flex-wrap gap-2 mb-6">
{([["time", "⏱ Fastest"], ["score", "💰 Most Moonrocks"]] as const).map(([key, label]) => { {([["time", "⏱ Fastest"], ["score", "🏆 High Score"]] as const).map(([key, label]) => {
const active = key === board; const active = key === board;
return ( return (
<Link <Link
@@ -198,7 +199,7 @@ export default async function LeaderboardPage({
{board === "time" {board === "time"
? fmtTime(s.completion_time) ? fmtTime(s.completion_time)
: board === "score" : board === "score"
? s.crypto_collected.toLocaleString() ? (s.score ?? s.crypto_collected).toLocaleString()
: s.wave} : s.wave}
</td> </td>
{board === "wave" ? ( {board === "wave" ? (
@@ -226,7 +227,7 @@ export default async function LeaderboardPage({
{board === "time" {board === "time"
? "Ranked by fastest completion time." ? "Ranked by fastest completion time."
: board === "score" : board === "score"
? "Ranked by most Moonrocks collected." ? "Ranked by total score — speed + fuel + Moonrocks."
: "Ranked by highest wave survived."} : "Ranked by highest wave survived."}
</p> </p>