Commit Graph

3 Commits

Author SHA1 Message Date
Mike Kell bdee2de35f feat(meal_planner): complete Phase 4 recipe scraper and meal planning calendar
Domain (pure Dart):
- Add Recipe, MacroProfile, and RecipeIngredient entities (quantity/unit/
  item parsing: decimals, ASCII/unicode/mixed fractions, known-unit
  vocabulary) plus MealPlanSlot reusing the nutrition MealType enum
- Define IRecipeRepository and IMealPlanRepository contracts
- Add ScrapeRecipeFromUrl use case: package:http download with injectable
  fetcher, package:html DOM parse, JSON-LD @graph/root/array/list-@type
  navigation, HowToStep/HowToSection flattening, ISO-8601 prep/cook times,
  recipeYield, regex nutrition parsing, OpenGraph fallback, and typed
  RecipeScrapeException
- Add core/utils/uuid.dart RFC-4122 v4 generator (no new dependency)

Data:
- Bump AppDatabase to schema v3 (migration for v1/v2 installs) with
  RecipesTable (UUID PK, JSON ingredient/instruction columns, macros) and
  MealPlanSlotsTable (UUID PK, nullable recipeId FK ON DELETE SET NULL)
- Implement DriftRecipeRepository (URL-deduplicated importRecipe, createdAt
  preserved on re-import) and DriftMealPlanRepository (half-open [from, to)
  window, upsert by id)

Presentation:
- Add RecipeImportController (URL submit -> loading -> preview modal state,
  live catalog watch stream, confirm-save/dismiss/delete) and
  MealPlanCalendarController (Monday-Sunday window navigation, slot
  assign/upsert/clear, prepared toggles, per-day protein rollup against the
  100 g target, deleted-recipe slot normalization)
- Rework MealPlannerScreen: URL import bar with spinner, RecipePreviewDialog
  (macros, ingredients, steps, save with error surface), draggable
  SavedRecipesTray with protein badges, responsive WeeklyCalendarView
  (>=900 dp: 7-column grid, below: tabbed pager) with DragTarget slots and
  daily protein indicators, AssignSlotDialog quick-assign modal

Fixes:
- Eliminate desktop resize overflow (RenderFlex hatched stripes): wide-mode
  day columns scroll vertically, and a LayoutBuilder collapses the page
  into a single scrollable column with a fixed-height calendar when the
  window body is shorter than ~520 dp

Testing:
- 29 new tests: recipe scraper (JSON-LD variants, macro/ingredient/
  instruction/duration parsing, OG fallback, execute error mapping),
  meal-plan repositories (window filter, upsert, dedup), calendar
  controller (rollup, navigation, prepared/custom entries), and screen
  widget tests pumping short-compact/short-wide/tall/extremely-short
  window sizes to prove no overflow; full suite green (89/89)
- BUILD_STATE.md: mark Phase 4 complete and record all verification gates
2026-10-16 09:07:41 -04:00
Mike Kell 094cf08f25 feat(nutrition,health_sync): complete Phase 3 nutrition tracking and HealthGateway sync
- Domain: FoodLogEntry/MealType, HydrationLogEntry, BiometricEntry/BiometricSource entities plus INutritionRepository and IHealthSyncRepository contracts (pure Dart).

- Data: AppDatabase schema v2 (FoodLogs/HydrationLogs/BiometricLogs tables, v1 migration, range-filtered CRUD) with drift-backed NutritionRepository and HealthSyncRepository; startOfDay/endOfDay date utils.

- Platform: HealthGateway conditional-import factory - mobile impl wires package:health (WEIGHT kg->lb, ACTIVE_ENERGY_BURNED J->kcal, permissions, write-back) with guarded fallbacks; web/desktop impl never touches platform channels (manual entry + drift cache).

- Presentation: NutritionController and BiometricController AsyncNotifiers (100g protein / 96oz water targets, meal grouping, 7/30-day weight deltas, idempotent 90-day native sync with per-day active-energy aggregation); LogFoodDialog and LogWeightDialog.

- UI: NutritionScreen progress meters, +8/+16/+24oz quick-add, meal-grouped food diary, weight tracker card with Log Weight / Sync (native sync on Android/iOS, manual dialog on Windows/Web) and status snackbars.

- Tests: 23 new tests (in-memory drift repos, controller fakes, fake health gateway covering fallback, permission denial, and duplicate-free re-sync); 60/60 passing, flutter analyze clean, flutter build web succeeds. BUILD_STATE.md updated to Phase 4.
2026-10-16 07:02:28 -04:00
Mike Kell 7b6b646d2c feat(auth): complete Phase 1 passwordless identity and encrypted DB foundation 2026-10-16 05:01:54 -04:00