Fix stuff

This commit is contained in:
Joey Yakimowich-Payne 2026-01-14 09:07:20 -07:00
commit 32696ad33d
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
13 changed files with 2194 additions and 110 deletions

View file

@ -8,7 +8,10 @@ export type GameState =
| 'QUESTION'
| 'REVEAL'
| 'SCOREBOARD'
| 'PODIUM';
| 'PODIUM'
| 'DISCONNECTED'
| 'WAITING_TO_REJOIN'
| 'HOST_RECONNECTED';
export type GameRole = 'HOST' | 'CLIENT';
@ -112,6 +115,7 @@ export interface Player {
previousScore: number;
streak: number;
lastAnswerCorrect: boolean | null;
selectedShape: 'triangle' | 'diamond' | 'circle' | 'square' | null;
pointsBreakdown: PointsBreakdown | null;
isBot: boolean;
avatarSeed: number;
@ -120,8 +124,25 @@ export interface Player {
// Network Types
export type NetworkMessage =
| { type: 'JOIN'; payload: { name: string } }
| { type: 'WELCOME'; payload: { playerId: string; quizTitle: string; players: Player[] } }
| { type: 'JOIN'; payload: { name: string; reconnect?: boolean; previousId?: string } }
| { type: 'WELCOME'; payload: {
playerId: string;
quizTitle: string;
players: Player[];
gameState?: GameState;
score?: number;
streak?: number;
hasAnswered?: boolean;
lastAnswerCorrect?: boolean | null;
lastPointsEarned?: number;
selectedShape?: 'triangle' | 'diamond' | 'circle' | 'square' | null;
currentQuestionIndex?: number;
totalQuestions?: number;
questionText?: string;
options?: AnswerOption[];
correctShape?: string;
timeLeft?: number;
} }
| { type: 'PLAYER_JOINED'; payload: { player: Player } }
| { type: 'GAME_START'; payload: {} }
| { type: 'START_COUNTDOWN'; payload: { duration: number } }
@ -136,7 +157,7 @@ export type NetworkMessage =
options: AnswerOption[];
}
}
| { type: 'ANSWER'; payload: { playerId: string; isCorrect: boolean } }
| { type: 'ANSWER'; payload: { playerId: string; isCorrect: boolean; selectedShape: 'triangle' | 'diamond' | 'circle' | 'square' } }
| { type: 'RESULT'; payload: { isCorrect: boolean; scoreAdded: number; newScore: number; breakdown: PointsBreakdown } }
| { type: 'TIME_SYNC'; payload: { timeLeft: number } }
| { type: 'TIME_UP'; payload: {} }