import Link from "next/link"; import { ArrowRight } from "lucide-react"; import { PixelTrophy, PlayerAvatar } from "./PixelArt"; import { formatScore, type LeaderboardData, type LeaderboardEntry, } from "@/shared/leaderboard"; export function LeaderboardEmpty({ unavailable = false, search = false, }: { unavailable?: boolean; search?: boolean; }) { return (

{unavailable ? "The scoreboard is taking a break." : search ? "No explorers found." : "The first place is still open."}

{unavailable ? "We couldn’t load the scores. Try again in a moment." : search ? "Try another player name or clear your search." : "Log in and finish five rounds to put your name on the board."}

{!search && ( {unavailable ? "Reload scores" : "Play an expedition"}{" "} )}
); } export function LeaderboardTable({ entries, compact = false, playerId, }: { entries: LeaderboardEntry[]; compact?: boolean; playerId?: string; }) { return (
{!compact && ( )} {!compact && ( )} {entries.map((entry) => ( {!compact && ( )} {!compact && ( )} ))}
Players ranked by best five-round score. Ties are broken by average score, then games played.
Rank Explorer Games Average Best score
{String(entry.rank).padStart(2, "0")}
{entry.display_name} {entry.player_id === playerId && ( You )}
{formatScore(entry.games_played)} {formatScore(entry.average_score)} {formatScore(entry.best_score)} pts
); } export function WinnersPodium({ leaders }: { leaders: LeaderboardEntry[] }) { return (
{leaders.map((entry, index) => (
{index === 0 ? "TOP EXPLORER" : `PLACE 0${index + 1}`}

{entry.display_name}

{formatScore(entry.best_score)} / 25,000

))}
); } export function LeaderboardPreview({ data }: { data: LeaderboardData | null }) { return (
THE EXPLORERS’ BOARD

Good eye.
Great guess.

Five rounds to find your way.
One score to make your mark.

See the full leaderboard
Top explorers All difficulties · All time
{data?.entries.length ? ( ) : ( )}
Best expedition score ·{" "} {data ? `${formatScore(data.total_players)} ranked ${data.total_players === 1 ? "explorer" : "explorers"}` : "Scores temporarily unavailable"}
); }