Phase 5 complete

This commit is contained in:
Joey Yakimowich-Payne 2026-01-13 16:38:25 -07:00
commit 93ea01525e
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
7 changed files with 433 additions and 37 deletions

View file

@ -236,31 +236,31 @@ Add user accounts via Authentik (OIDC) and persist quizzes to SQLite database. U
## Phase 5: Save Integration
### 5.1 Save After AI Generation
- [ ] Modify `src/hooks/useGame.ts`:
- [ ] Add `pendingQuizToSave` state
- [ ] After successful AI generation, set `pendingQuizToSave`
- [ ] Add `savePendingQuiz()` and `dismissSavePrompt()` functions
- [ ] Export these for UI to consume
- [ ] Create `src/components/SaveQuizPrompt.tsx`:
- [ ] Modal asking "Save this quiz to your library?"
- [ ] Show quiz title
- [ ] "Save" and "Skip" buttons
- [ ] Only show when authenticated
- [x] Modify `hooks/useGame.ts`:
- [x] Add `pendingQuizToSave` state
- [x] After successful AI generation, set `pendingQuizToSave`
- [x] Add `dismissSavePrompt()` function
- [x] Export these for UI to consume
- [x] Create `components/SaveQuizPrompt.tsx`:
- [x] Modal asking "Save this quiz to your library?"
- [x] Show quiz title
- [x] "Save" and "Skip" buttons
- [x] Loading state while saving
- [x] Wire up in `App.tsx`:
- [x] Show SaveQuizPrompt in LOBBY state when authenticated and pendingQuizToSave exists
- [x] Handle save via useQuizLibrary hook
### 5.2 Save in Quiz Creator
- [ ] Modify `src/components/QuizCreator.tsx`:
- [ ] Add checkbox or toggle: "Save to my library"
- [ ] Pass `shouldSave` flag to `onFinalize`
- [ ] Modify `src/hooks/useGame.ts`:
- [ ] Update `finalizeManualQuiz` to accept save preference
- [ ] If save requested + authenticated, call `saveQuiz`
- [x] Modify `components/QuizCreator.tsx`:
- [x] Add "Save to my library" checkbox (only shown when authenticated)
- [x] Pass `saveToLibrary` flag to `onFinalize`
- [x] Modify `hooks/useGame.ts`:
- [x] Update `finalizeManualQuiz` to accept save preference
- [x] If save requested, set `pendingQuizToSave`
### 5.3 Load Quiz Flow
- [ ] Modify `src/hooks/useGame.ts`:
- [ ] Add `loadSavedQuiz(quiz: Quiz)` function
- [ ] Initialize game state with loaded quiz
- [ ] Transition to LOBBY state
- [ ] Wire up from Landing → QuizLibrary → useGame
### 5.3 Load Quiz Flow (Already done in Phase 4)
- [x] `loadSavedQuiz(quiz: Quiz)` function in useGame.ts
- [x] Wire up from Landing → QuizLibrary → useGame
---
@ -407,6 +407,6 @@ kaboot/
| Phase 2 | **COMPLETE** | Backend API with Express, SQLite, JWT auth, Quiz CRUD |
| Phase 3 | **COMPLETE** | OIDC config, AuthProvider, AuthButton, useAuthenticatedFetch |
| Phase 4 | **COMPLETE** | useQuizLibrary hook, QuizLibrary modal, Landing integration |
| Phase 5 | Not Started | |
| Phase 5 | **COMPLETE** | SaveQuizPrompt modal, QuizCreator save checkbox, save integration |
| Phase 6 | Not Started | |
| Phase 7 | Not Started | |