This commit is contained in:
NextJS
2026-05-05 20:02:40 +00:00
commit 0f6e979aac
51 changed files with 10161 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import type { MatchmakerLogSource } from "@/lib/matchmaker-log-source";
export type AdminDashboardTab =
| "dashboard"
| "players"
| "matches"
| "matchmaker";
export type DashboardUrlQuery = {
tab: AdminDashboardTab;
highlightId: string | null;
participantRaw: string | null;
editId?: number | null;
saveError?: boolean;
/** When tab is matchmaker: `raw` selects matchmaker.log; omit or processed → history.log */
matchmakerSource?: MatchmakerLogSource | null;
};
/** Build `/?…` for dashboard tabs, filters, and optional edit / error flags. */
export function buildDashboardHref(q: DashboardUrlQuery): string {
const p = new URLSearchParams();
if (q.tab === "matches") p.set("tab", "matches");
else if (q.tab === "players") p.set("tab", "players");
else if (q.tab === "matchmaker") p.set("tab", "matchmaker");
if (q.highlightId) p.set("highlight", q.highlightId);
if (q.participantRaw) p.set("participant", q.participantRaw);
if (q.tab === "matchmaker" && q.matchmakerSource === "raw") {
p.set("mklog", "raw");
}
if (q.editId != null && Number.isFinite(q.editId)) {
p.set("edit", String(q.editId));
}
if (q.saveError) p.set("saveError", "1");
const s = p.toString();
return s ? `/?${s}` : "/";
}