Files
phaseflow/src/components/dashboard/nutrition-panel.tsx
Petru Paler eeeece17bf
Some checks failed
CI / quality (push) Failing after 28s
Deploy / deploy (push) Successful in 2m38s
Add spec compliance improvements: seed switch alert, calendar emojis, period indicator, IP logging
- NutritionPanel: Display seed switch alert on day 15 per dashboard spec
- MonthView: Add phase emojis to legend (🩸🌱🌸🌙🌑) per calendar spec
- DayCell: Show period indicator (🩸) for days 1-3 per calendar spec
- Auth middleware: Log client IP from x-forwarded-for/x-real-ip per observability spec
- Updated NutritionGuidance type to include seedSwitchAlert field
- /api/today now returns seedSwitchAlert in nutrition response

Test coverage: 1005 tests (15 new tests added)
- nutrition-panel.test.tsx: +4 tests
- month-view.test.tsx: +1 test
- day-cell.test.tsx: +5 tests
- auth-middleware.test.ts: +3 tests
- today/route.test.ts: +2 tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-12 23:33:14 +00:00

26 lines
833 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ABOUTME: Dashboard panel showing nutrition guidance.
// ABOUTME: Displays seed cycling and macro recommendations.
import type { NutritionGuidance } from "@/types";
interface NutritionPanelProps {
nutrition: NutritionGuidance;
}
export function NutritionPanel({ nutrition }: NutritionPanelProps) {
return (
<div className="rounded-lg border p-4">
<h3 className="font-semibold mb-4">NUTRITION TODAY</h3>
{nutrition.seedSwitchAlert && (
<div className="mb-3 p-2 rounded bg-amber-100 dark:bg-amber-900 text-sm font-medium">
{nutrition.seedSwitchAlert}
</div>
)}
<ul className="space-y-2 text-sm">
<li>🌱 {nutrition.seeds}</li>
<li>🍽 Carbs: {nutrition.carbRange}</li>
<li>🥑 Keto: {nutrition.ketoGuidance}</li>
</ul>
</div>
);
}