Phase 7: judges — links, phone page, open link, judged control room

- Setup: nominate judges, copy personal links, QR codes (generated on
  demand in the browser), revoke/restore, and an open-link toggle.
- GET /api/judge/[token] returns only that judge's own scores; PUT
  .../scores runs every check from ARCHITECTURE.md in checkJudgeWrite
  (pure, unit-tested) after one parallel lookup, plus a rate limit.
- /j/[token]: mobile cards per team, spotlight pinned first, autosave
  with per-card status, read-only when locked/done, link-off when revoked.
- /jo/[token]: name form -> personal link, remembered in localStorage so
  a re-scan doesn't create a second judge.
- Control room: averages with on-request overrides, judge progress
  matrix, per-judge breakdown, spotlight select and lock toggle.
- usePendingEdits shares the optimistic autosave logic between the admin
  grid and the judge page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 15:29:33 +02:00
co-authored by Claude Opus 5.5
parent 1410c0fa13
commit 2702491096
25 changed files with 1737 additions and 85 deletions
+17
View File
@@ -0,0 +1,17 @@
import { NextResponse } from "next/server";
import { getJudgePayload } from "@/lib/judge.server";
const headers = { "Cache-Control": "no-store" };
export async function GET(_request: Request, context: RouteContext<"/api/judge/[token]">) {
const { token } = await context.params;
try {
const result = await getJudgePayload(token);
if (!result.ok) return NextResponse.json({ error: result.error }, { status: result.status, headers });
return NextResponse.json(result.payload, { headers });
} catch (error) {
console.error("judge API failed", error);
return NextResponse.json({ error: "Could not load the game. Try again." }, { status: 500, headers });
}
}