Phase 4 complete

This commit is contained in:
Joey Yakimowich-Payne 2026-01-13 15:39:02 -07:00
commit 66f15b49b2
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
9 changed files with 710 additions and 37 deletions

View file

@ -194,39 +194,42 @@ Add user accounts via Authentik (OIDC) and persist quizzes to SQLite database. U
## Phase 4: Quiz Library Feature
### 4.1 Quiz Library Hook
- [ ] Create `src/hooks/useQuizLibrary.ts`:
- [ ] State: `quizzes`, `loading`, `error`
- [ ] `fetchQuizzes()` - GET /api/quizzes
- [ ] `loadQuiz(id)` - GET /api/quizzes/:id, return Quiz
- [ ] `saveQuiz(quiz, source, aiTopic?)` - POST /api/quizzes
- [ ] `deleteQuiz(id)` - DELETE /api/quizzes/:id
- [ ] Handle loading and error states
- [x] Create `hooks/useQuizLibrary.ts`:
- [x] State: `quizzes`, `loading`, `error`
- [x] `fetchQuizzes()` - GET /api/quizzes
- [x] `loadQuiz(id)` - GET /api/quizzes/:id, return Quiz
- [x] `saveQuiz(quiz, source, aiTopic?)` - POST /api/quizzes
- [x] `deleteQuiz(id)` - DELETE /api/quizzes/:id
- [x] Handle loading and error states
### 4.2 Quiz Library UI
- [ ] Create `src/components/QuizLibrary.tsx`:
- [ ] Modal overlay design (consistent with app style)
- [ ] Header: "My Quizzes" with close button
- [ ] Search/filter input (optional, future enhancement)
- [ ] Quiz list:
- [ ] Show title, question count, source badge (AI/Manual), date
- [ ] Click to select
- [ ] Delete button with confirmation
- [ ] Footer: "Load Selected" and "Cancel" buttons
- [ ] Empty state: "No saved quizzes yet"
- [ ] Loading state: Skeleton/spinner
- [x] Create `components/QuizLibrary.tsx`:
- [x] Modal overlay design (consistent with app style)
- [x] Header: "My Library" with close button
- [x] Quiz list:
- [x] Show title, question count, source badge (AI/Manual), date
- [x] Click to load quiz
- [x] Delete button with confirmation
- [x] Empty state: "No saved quizzes yet"
- [x] Loading state: Spinner
### 4.3 Landing Page Integration
- [ ] Modify `src/components/Landing.tsx`:
- [ ] Add "My Quizzes" button (only visible when authenticated)
- [ ] Add state for quiz library modal visibility
- [ ] Render `<QuizLibrary />` modal when open
- [ ] Handle quiz load: call `onLoadQuiz` prop with loaded quiz
- [x] Modify `components/Landing.tsx`:
- [x] Add "My Quizzes" button (only visible when authenticated)
- [x] Add state for quiz library modal visibility
- [x] Render `<QuizLibrary />` modal when open
- [x] Handle quiz load: call `onLoadQuiz` prop with loaded quiz
### 4.4 Types Update
- [ ] Modify `src/types.ts`:
- [ ] Add `SavedQuiz` interface (extends `Quiz` with id, source, dates)
- [ ] Add `QuizListItem` interface (for list view)
- [ ] Add `QuizSource` type: `'manual' | 'ai_generated'`
- [x] Modify `types.ts`:
- [x] Add `SavedQuiz` interface (extends `Quiz` with id, source, dates)
- [x] Add `QuizListItem` interface (for list view)
- [x] Add `QuizSource` type: `'manual' | 'ai_generated'`
### 4.5 Game Hook Integration
- [x] Modify `hooks/useGame.ts`:
- [x] Add `loadSavedQuiz(quiz)` function
- [x] Export for App.tsx to consume
---
@ -403,7 +406,7 @@ kaboot/
| Phase 1 | **COMPLETE** | Docker Compose, .env, setup script, Authentik docs |
| Phase 2 | **COMPLETE** | Backend API with Express, SQLite, JWT auth, Quiz CRUD |
| Phase 3 | **COMPLETE** | OIDC config, AuthProvider, AuthButton, useAuthenticatedFetch |
| Phase 4 | Not Started | |
| Phase 4 | **COMPLETE** | useQuizLibrary hook, QuizLibrary modal, Landing integration |
| Phase 5 | Not Started | |
| Phase 6 | Not Started | |
| Phase 7 | Not Started | |