This commit is contained in:
NextJS
2026-05-11 04:30:39 +00:00
parent 0f6e979aac
commit b2be61190f
13 changed files with 1361 additions and 6 deletions
+25 -1
View File
@@ -2,6 +2,7 @@
import Link from "next/link";
import { useEffect, useMemo, useState } from "react";
import { AdminLedger } from "@/components/admin-ledger";
import { MatchHistoryBattleCard } from "@/components/match-history-battle-card";
import type { DashboardStatsBundle } from "@/lib/dashboard-stats";
import { MatchmakerLogTerminal } from "@/components/matchmaker-log-terminal";
@@ -10,7 +11,7 @@ import {
type AdminDashboardTab,
} from "@/lib/dashboard-search-url";
import type { MatchmakerLogSource } from "@/lib/matchmaker-log-source";
import type { DbMatch, DbUser } from "@/types/database";
import type { DbMatch, DbTransaction, DbUser } from "@/types/database";
/** Bigint columns often arrive as strings from PostgREST / JSON. */
function matchHasRecordedWinner(winnerId: DbMatch["winner_id"]): boolean {
@@ -58,6 +59,8 @@ type Props = {
matches: DbMatch[];
usersError: string | null;
matchesError: string | null;
transactions: DbTransaction[];
transactionsError: string | null;
statsBundle: DashboardStatsBundle | null;
/** From server `searchParams` so SSR and client markup match (do not use `useSearchParams` here). */
tab: AdminDashboardTab;
@@ -96,6 +99,8 @@ export function AdminDashboard({
matches,
usersError,
matchesError,
transactions,
transactionsError,
statsBundle,
tab,
highlightId,
@@ -228,6 +233,17 @@ export function AdminDashboard({
>
Matchmaker
</Link>
<Link
href={buildDashboardHref({
tab: "ledger",
highlightId,
participantRaw,
})}
className={tabClass(tab === "ledger")}
scroll={false}
>
Ledger
</Link>
<Link
href="/settings"
className={tabClass(false)}
@@ -485,6 +501,14 @@ export function AdminDashboard({
errorMessage={matchmakerError}
/>
</section>
) : tab === "ledger" ? (
<AdminLedger
transactions={transactions}
users={users}
error={transactionsError}
highlightId={highlightId}
participantRaw={participantRaw}
/>
) : (
<section className="space-y-3">
{participantId != null ? (