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

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

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

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

{entry.display_name}

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

))}
); } export function LeaderboardPreview({ data }: { data: LeaderboardData | null }) { const { t, formatNumber } = useI18n(); return (
{t("THE EXPLORERS’ BOARD")}

{t("Good eye.")}
{t("Great guess.")}

{t("Five rounds to find your way.")}
{t("One score to make your mark.")}

{t("See the full leaderboard")}
{t("Top explorers")} {t("All difficulties · All time")}
{data?.entries.length ? ( ) : ( )}
{t("Best expedition score ·")}{" "} {data ? t("Ranked explorers: {count}", { count: formatNumber(data.total_players), }) : t("Scores temporarily unavailable")}
); }