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:
2026-01-10 19:25:50 +00:00
parent 933e39aed4
commit 9f3c2ecac9
4 changed files with 771 additions and 16 deletions

View File

@@ -105,7 +105,7 @@ describe("LoginPage", () => {
it("shows loading state while authenticating", async () => {
// Create a promise that we can control
let resolveAuth: (value: unknown) => void;
let resolveAuth: (value: unknown) => void = () => {};
const authPromise = new Promise((resolve) => {
resolveAuth = resolve;
});
@@ -129,11 +129,11 @@ describe("LoginPage", () => {
});
// Resolve the auth
resolveAuth?.({ token: "test-token" });
resolveAuth({ token: "test-token" });
});
it("disables form inputs while loading", async () => {
let resolveAuth: (value: unknown) => void;
let resolveAuth: (value: unknown) => void = () => {};
const authPromise = new Promise((resolve) => {
resolveAuth = resolve;
});
@@ -155,7 +155,7 @@ describe("LoginPage", () => {
expect(screen.getByRole("button")).toBeDisabled();
});
resolveAuth?.({ token: "test-token" });
resolveAuth({ token: "test-token" });
});
});