+ No achievements yet. The first period close will crown its champions.
+
+ );
+ }
+
+ return (
+
+
+
+
+
Minigame Leaderboards
+
+
+ Placement points run across the five Core games each period. Periods reset, history stays.
+
+
+
+
+
+ {data?.period && (
+
+ {data.period.startDate.slice(0, 10)} to {data.period.endDate.slice(0, 10)} (UTC)
+
+ )}
+
+
+
+ {failed ? (
+
Could not load the leaderboards.
+ ) : loading && !data ? (
+
+ ) : boards.length === 0 ? (
+
No games to show yet.
+ ) : (
+
+
+ {boards.map((board) => {
+ const Icon = minigameIcon(board.icon);
+ return (
+
+
+ {board.label}
+
+ );
+ })}
+
+ {boards.map((board) => (
+
+
+
+ {isAllTime ? "All-Time best per operator" : "Best run this period, with placement points"}
+
+ {board.scoreLabel} · top 10
+
+
+
+ ))}
+
+ )}
+
+
+
+
+
+
Achievements
+ Latest first
+
+
+
+
+ );
+}
diff --git a/src/components/frontend/minigames/PeriodStandingsCard.tsx b/src/components/frontend/minigames/PeriodStandingsCard.tsx
new file mode 100644
index 00000000..d3a94d08
--- /dev/null
+++ b/src/components/frontend/minigames/PeriodStandingsCard.tsx
@@ -0,0 +1,115 @@
+"use client";
+
+import { useState } from "react";
+import Link from "next/link";
+import { Trophy } from "lucide-react";
+
+import { minigameIcon } from "@/components/frontend/minigames/minigameIcon";
+import { StandingsTable } from "@/components/frontend/minigames/StandingsTable";
+import { useLeaderboards } from "@/components/frontend/minigames/useLeaderboards";
+import { cn } from "@/lib/utils";
+import type { PresenceParticipant } from "@/hooks/useRealtimePresence";
+
+export interface PeriodStandingsCardProps {
+ gameKey: string;
+ /** Registry icon name; falls back to the board payload's icon. */
+ icon?: string;
+ refreshKey?: number;
+ currentUserId?: number | string;
+ /** Optional presence line shown on the current-period view. */
+ presence?: { participants: PresenceParticipant[]; noun?: string };
+ className?: string;
+}
+
+/**
+ * Period-scoped standings for a single game, embedded on the game page. Defaults
+ * to the current period and offers an All-Time toggle; the full multi-board view
+ * lives at /minigames/leaderboards.
+ */
+export function PeriodStandingsCard({
+ gameKey,
+ icon,
+ refreshKey = 0,
+ currentUserId,
+ presence,
+ className,
+}: PeriodStandingsCardProps) {
+ const [view, setView] = useState<"period" | "all-time">("period");
+ const { data, failed, loading } = useLeaderboards(view === "all-time" ? "all-time" : "current", refreshKey);
+
+ const board = data?.boards.find((entry) => entry.key === gameKey) ?? null;
+ const Icon = minigameIcon(icon ?? board?.icon);
+ const isAllTime = view === "all-time";
+
+ return (
+
+
+
+
+
{board?.label ?? "Standings"}
+
+ {isAllTime ? "All-Time" : (data?.period?.label ?? "No active period")}
+
+
+
+
+
+
+
+ All boards
+
+
+
+ {presence && !isAllTime && (
+
+ {presence.participants.length}{" "}
+ {presence.participants.length === 1 ? `${presence.noun ?? "operator"} is` : `${presence.noun ?? "operators"} are`} active now
+ {presence.participants.length > 0 && (
+
+ ({presence.participants.map((participant) => participant.name).join(", ")})
+
+ )}
+
+ )}
+
+ {failed ? (
+
Could not load the standings.
+ ) : loading && !data ? (
+
+ ) : (
+
+ )}
+
+ );
+}
diff --git a/src/components/frontend/minigames/StandingsTable.tsx b/src/components/frontend/minigames/StandingsTable.tsx
new file mode 100644
index 00000000..f5d63c02
--- /dev/null
+++ b/src/components/frontend/minigames/StandingsTable.tsx
@@ -0,0 +1,78 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import type { StandingsRow } from "@/lib/minigames/leaderboardTypes";
+
+function rankClass(index: number) {
+ if (index === 0) return "font-bold text-amber-400";
+ if (index === 1) return "font-semibold text-slate-300";
+ if (index === 2) return "font-semibold text-amber-700";
+ return "text-muted-foreground";
+}
+
+export interface StandingsTableProps {
+ rows: StandingsRow[];
+ /** Column header for the score column (e.g. "Passes", "Score"). */
+ scoreLabel: string;
+ currentUserId?: number | string;
+ /** Show the placement-points column (period boards only). */
+ showPoints?: boolean;
+ emptyLabel?: string;
+ className?: string;
+}
+
+/**
+ * Shared standings table for both the period boards and the all-time view.
+ * Rows are already ranked; this only renders them.
+ */
+export function StandingsTable({
+ rows,
+ scoreLabel,
+ currentUserId,
+ showPoints = false,
+ emptyLabel = "No runs on the board yet.",
+ className,
+}: StandingsTableProps) {
+ if (rows.length === 0) {
+ return (
+