From 9ec0225e4bd5555d619d258b9421fc2e4fca5f18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20F=C3=B6rtsch?= Date: Thu, 12 Mar 2026 19:45:32 +0100 Subject: [PATCH] add jury, bingo, leaderboard schemas to shared game types Co-Authored-By: Claude Opus 4.6 --- packages/shared/src/game-types.ts | 63 +++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/packages/shared/src/game-types.ts b/packages/shared/src/game-types.ts index 2c41b61..aabf9a4 100644 --- a/packages/shared/src/game-types.ts +++ b/packages/shared/src/game-types.ts @@ -37,6 +37,57 @@ export const predictionSchema = z.object({ export type Prediction = z.infer +// ─── Jury Voting ──────────────────────────────────────────────────── + +export const juryRoundSchema = z.object({ + id: z.string(), + countryCode: z.string(), + countryName: z.string(), + countryFlag: z.string(), + status: z.enum(["open", "closed"]), +}) + +export type JuryRound = z.infer + +export const juryResultSchema = z.object({ + countryCode: z.string(), + countryName: z.string(), + countryFlag: z.string(), + averageRating: z.number(), + totalVotes: z.number(), +}) + +export type JuryResult = z.infer + +// ─── Bingo ────────────────────────────────────────────────────────── + +export const bingoSquareSchema = z.object({ + tropeId: z.string(), + label: z.string(), + tapped: z.boolean(), +}) + +export type BingoSquare = z.infer + +export const bingoCardSchema = z.object({ + squares: z.array(bingoSquareSchema).length(16), + hasBingo: z.boolean(), +}) + +export type BingoCard = z.infer + +// ─── Scoring ──────────────────────────────────────────────────────── + +export const leaderboardEntrySchema = z.object({ + playerId: z.string(), + displayName: z.string(), + juryPoints: z.number(), + bingoPoints: z.number(), + totalPoints: z.number(), +}) + +export type LeaderboardEntry = z.infer + // ─── Game State (sent to clients) ─────────────────────────────────── export const gameStateSchema = z.object({ @@ -44,6 +95,18 @@ export const gameStateSchema = z.object({ myPrediction: predictionSchema.nullable(), predictionsLocked: z.boolean(), predictionSubmitted: z.record(z.string(), z.boolean()), + // Jury + currentJuryRound: juryRoundSchema.nullable(), + juryResults: z.array(juryResultSchema), + myJuryVote: z.number().nullable(), + // Bingo + myBingoCard: bingoCardSchema.nullable(), + bingoAnnouncements: z.array(z.object({ + playerId: z.string(), + displayName: z.string(), + })), + // Leaderboard + leaderboard: z.array(leaderboardEntrySchema), }) export type GameState = z.infer