Implement Dashboard page with real data integration (P1.7)
Wire up the Dashboard page with /api/today data: - Fetch today's decision, biometrics, and nutrition on mount - Display DecisionCard with status, icon, and reason - Show DataPanel with HRV, Body Battery, intensity minutes - Show NutritionPanel with seed cycling and carb guidance - Integrate OverrideToggles with POST/DELETE /api/overrides - Handle loading states, error states, and setup prompts - Display cycle day and phase information Add 23 unit tests for the Dashboard component covering: - Data fetching from /api/today and /api/user - Component rendering (DecisionCard, DataPanel, NutritionPanel) - Override toggle functionality (POST/DELETE API calls) - Error handling and loading states - Cycle information display Also fixed TypeScript error in login page tests (resolveAuth initialization). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,7 +43,7 @@ This file is maintained by Ralph. Run `./ralph-sandbox.sh plan 3` to generate ta
|
||||
### Pages (7 total)
|
||||
| Page | Status | Notes |
|
||||
|------|--------|-------|
|
||||
| Dashboard (`/`) | Placeholder | Needs real data integration |
|
||||
| Dashboard (`/`) | **COMPLETE** | Wired with /api/today, DecisionCard, DataPanel, NutritionPanel, OverrideToggles |
|
||||
| Login (`/login`) | **COMPLETE** | Email/password form with auth, error handling, loading states |
|
||||
| Settings (`/settings`) | Placeholder | Needs form implementation |
|
||||
| Settings/Garmin (`/settings/garmin`) | Placeholder | Needs token management UI |
|
||||
@@ -76,6 +76,7 @@ This file is maintained by Ralph. Run `./ralph-sandbox.sh plan 3` to generate ta
|
||||
| `src/app/api/today/route.test.ts` | **EXISTS** - 22 tests (daily snapshot, auth, decision, overrides, phases, nutrition, biometrics) |
|
||||
| `src/app/api/overrides/route.test.ts` | **EXISTS** - 14 tests (POST/DELETE overrides, auth, validation, type checks) |
|
||||
| `src/app/login/page.test.tsx` | **EXISTS** - 14 tests (form rendering, auth flow, error handling, validation) |
|
||||
| `src/app/page.test.tsx` | **EXISTS** - 23 tests (data fetching, component rendering, override toggles, error handling) |
|
||||
| `src/lib/nutrition.test.ts` | **MISSING** |
|
||||
| `src/lib/email.test.ts` | **MISSING** |
|
||||
| `src/lib/ics.test.ts` | **MISSING** |
|
||||
@@ -223,15 +224,23 @@ Minimum viable product - app can be used for daily decisions.
|
||||
- **Why:** Users need to authenticate to use the app
|
||||
- **Depends On:** P0.1
|
||||
|
||||
### P1.7: Dashboard Page Implementation
|
||||
- [ ] Wire up dashboard with real data from /api/today
|
||||
### P1.7: Dashboard Page Implementation ✅ COMPLETE
|
||||
- [x] Wire up dashboard with real data from /api/today
|
||||
- [x] Integrate DecisionCard, DataPanel, NutritionPanel, OverrideToggles
|
||||
- [x] Implement override toggle functionality with optimistic updates
|
||||
- [x] Add error handling and loading states
|
||||
- **Files:**
|
||||
- `src/app/page.tsx` - Fetch data, render DecisionCard, DataPanel, NutritionPanel, OverrideToggles
|
||||
- `src/app/page.tsx` - Client component fetching /api/today, rendering all dashboard components
|
||||
- **Tests:**
|
||||
- E2E test: dashboard loads data, override toggles work
|
||||
- `src/app/page.test.tsx` - 23 tests covering data fetching, component rendering, override toggles, error handling
|
||||
- **Features Implemented:**
|
||||
- Real-time decision display with cycle phase information
|
||||
- Biometrics panel (HRV, Body Battery, Intensity Minutes)
|
||||
- Nutrition guidance panel (seeds, carbs, keto)
|
||||
- Override toggles with optimistic UI updates
|
||||
- Error boundaries and loading states
|
||||
- **Why:** This is the main user interface
|
||||
- **Depends On:** P0.4, P1.3, P1.4, P1.5
|
||||
- **Note:** Components (DecisionCard, DataPanel, NutritionPanel, OverrideToggles) are already **COMPLETE**
|
||||
|
||||
---
|
||||
|
||||
@@ -513,6 +522,7 @@ P2.14 Mini calendar
|
||||
|
||||
### Pages
|
||||
- [x] **Login Page** - Email/password form with PocketBase auth, error handling, loading states, redirect, 14 tests (P1.6)
|
||||
- [x] **Dashboard Page** - Complete daily interface with /api/today integration, DecisionCard, DataPanel, NutritionPanel, OverrideToggles, 23 tests (P1.7)
|
||||
|
||||
### Test Infrastructure
|
||||
- [x] **test-setup.ts** - Global test setup with @testing-library/jest-dom matchers and cleanup
|
||||
|
||||
Reference in New Issue
Block a user