Commit graph

22 commits

Author SHA1 Message Date
d1f82440a1
Add disable timer setting and fix per-question time limits
Add a 'Question Timer' toggle to game settings that lets the host disable
the countdown timer. When disabled, questions show ∞ instead of a countdown,
the host gets an 'End Question' button to manually advance, and all correct
answers receive maximum points.

Also fix a bug where per-question time limits were ignored — the timer and
scoring always used the hardcoded 20-second default instead of each question's
individual timeLimit.
2026-02-23 13:44:12 -07:00
acfed861ab
Flesh out payment stuff 2026-01-22 12:21:12 -07:00
3c54a0f4d9
Add client leaving host notification 2026-01-19 15:46:17 -07:00
79820f5298
Add kick player and leave game functionality
- Host can kick players from lobby (removes from game, clears presenter if needed)
- Client can voluntarily leave game
- Fix browser-compatible base64 decoding for document upload (atob vs Buffer)
2026-01-19 14:52:57 -07:00
9ef8f7343d
Add presenter role for game flow control 2026-01-19 14:02:28 -07:00
8a11275849
Add sharing 2026-01-16 08:49:21 -07:00
667c490537
Add import/export 2026-01-15 22:27:17 -07:00
a7ad1e9bba
System AI 2026-01-15 19:39:38 -07:00
4688a73559
Add api key and sorting on scoreboard 2026-01-15 14:49:10 -07:00
36b686bbd4
Add openrouter 2026-01-15 12:28:51 -07:00
3d6081823c
Fix UI jank a bit 2026-01-14 21:47:40 -07:00
73c7d3efed
Add gemini key ability 2026-01-14 21:04:58 -07:00
32696ad33d
Fix stuff 2026-01-14 09:07:20 -07:00
fc270d437f
Redesign scoreboard 2026-01-14 01:55:49 -07:00
af21f2bcdc
feat: add comprehensive game configuration system
Add a centralized game configuration system that allows customizable
scoring mechanics and game rules. Users can now set default game
configurations that persist across sessions, and individual quizzes
can have their own configuration overrides.

## New Features

### Game Configuration Options
- Shuffle Questions: Randomize question order when starting a game
- Shuffle Answers: Randomize answer positions for each question
- Host Participates: Toggle whether the host plays as a competitor
  or spectates (host now shows as 'Spectator' when not participating)
- Streak Bonus: Multiplied points for consecutive correct answers,
  with configurable threshold and multiplier values
- Comeback Bonus: Extra points for players ranked below top 3
- Wrong Answer Penalty: Deduct percentage of max points for incorrect
  answers (configurable percentage)
- First Correct Bonus: Extra points for the first player to answer
  correctly on each question

### Default Settings Management
- New Settings icon in landing page header (authenticated users only)
- DefaultConfigModal for editing user-wide default game settings
- Default configs are loaded when creating new quizzes
- Defaults persist to database via new user API endpoints

### Reusable UI Components
- GameConfigPanel: Comprehensive toggle-based settings panel with
  expandable sub-options, tooltips, and suggested values based on
  question count
- DefaultConfigModal: Modal wrapper for editing default configurations

## Technical Changes

### Frontend
- New useUserConfig hook for fetching/saving user default configurations
- QuizEditor now uses GameConfigPanel instead of inline toggle checkboxes
- GameScreen handles spectator mode with disabled answer buttons
- Updated useGame hook with new scoring calculations and config state
- Improved useAuthenticatedFetch with deduped silent refresh and
  redirect-once pattern to prevent multiple auth redirects

### Backend
- Added game_config column to quizzes table (JSON storage)
- Added default_game_config column to users table
- New PATCH endpoint for quiz config updates: /api/quizzes/:id/config
- New PUT endpoint for user defaults: /api/users/me/default-config
- Auto-migration in connection.ts for existing databases

### Scoring System
- New calculatePoints() function in constants.ts handles all scoring
  logic including streaks, comebacks, penalties, and first-correct bonus
- New calculateBasePoints() for time-based point calculation
- New getPlayerRank() helper for comeback bonus eligibility

### Tests
- Added tests for DefaultConfigModal component
- Added tests for GameConfigPanel component
- Added tests for QuizEditor config integration
- Added tests for useUserConfig hook
- Updated API tests for new endpoints

## Type Changes
- Added GameConfig interface with all configuration options
- Added DEFAULT_GAME_CONFIG constant with sensible defaults
- Quiz type now includes optional config property
2026-01-14 01:43:23 -07:00
bfbba7b5ab
Add ability to edit AI generated content 2026-01-13 23:37:08 -07:00
846ba2a69c
Add time sync 2026-01-13 22:56:56 -07:00
028bab23fd
Add document AI gen support 2026-01-13 22:48:43 -07:00
66f15b49b2
Phase 4 complete 2026-01-13 15:39:02 -07:00
8a8ec9bc0e
Rebrand to kaboot 2026-01-13 10:59:50 -07:00
845e3ab3d6
Reason working 2026-01-13 07:55:17 -07:00
c87ebf0a74
Initial commit 2026-01-13 07:23:30 -07:00