e50e6f83dc
Sets up the foundational project structure for the BuzzMaster Live Quiz Platform. This includes: - **Project Initialization:** Creates `package.json` with necessary dependencies (React, React Router DOM, Vite, TypeScript). - **Vite Configuration:** Configures Vite for development and building, including server settings and environment variable handling. - **HTML Entry Point:** Sets up `index.html` with basic structure, Tailwind CSS, Google Fonts, and ESM import maps. - **React Entry Point:** Configures `index.tsx` to render the main `App` component. - **TypeScript Configuration:** Defines `tsconfig.json` for the project. - **Git Ignore:** Adds standard files and directories to `.gitignore`. - **README and Metadata:** Includes a basic `README.md` and `metadata.json` describing the project. - **Type Definitions:** Establishes core type definitions in `types.ts` for game state, user roles, players, teams, and questions. - **App Component:** Creates a basic `App.tsx` component with routing and initial game state management, including logic for local storage fallback and API sync. - **Component Stubs:** Adds placeholder components for `PlayerView`, `AdminDashboard`, and `SpectatorView`.
61 lines
1.0 KiB
TypeScript
61 lines
1.0 KiB
TypeScript
|
|
export enum GameState {
|
|
LOBBY = 'LOBBY',
|
|
COUNTDOWN = 'COUNTDOWN',
|
|
QUESTION = 'QUESTION',
|
|
BUZZED = 'BUZZED',
|
|
REVEAL = 'REVEAL',
|
|
SCOREBOARD = 'SCOREBOARD',
|
|
FINAL_STATS = 'FINAL_STATS'
|
|
}
|
|
|
|
export enum UserRole {
|
|
HOST = 'HOST',
|
|
PLAYER = 'PLAYER',
|
|
SPECTATOR = 'SPECTATOR'
|
|
}
|
|
|
|
export interface Player {
|
|
id: string;
|
|
name: string;
|
|
teamId: string;
|
|
status: 'PENDING' | 'APPROVED';
|
|
score: number;
|
|
correctAnswers: number;
|
|
wrongAnswers: number;
|
|
avgBuzzerMs: number;
|
|
}
|
|
|
|
export interface Team {
|
|
id: string;
|
|
name: string;
|
|
score: number;
|
|
}
|
|
|
|
export interface Question {
|
|
id: string;
|
|
text: string;
|
|
answer: string;
|
|
points: number;
|
|
audioUrl?: string;
|
|
audioStart?: number;
|
|
audioEnd?: number;
|
|
}
|
|
|
|
export interface BuzzerLog {
|
|
playerId: string;
|
|
timestamp: number; // ms precision
|
|
}
|
|
|
|
export interface GameData {
|
|
id: string;
|
|
name: string;
|
|
state: GameState;
|
|
currentQuestionIndex: number;
|
|
questions: Question[];
|
|
players: Player[];
|
|
teams: Team[];
|
|
activeBuzzerQueue: BuzzerLog[];
|
|
countdownValue: number;
|
|
}
|