Phase 1: mobile-first pantry redesign with In/Low/Out state

Track presence (In/Low/Out) as the primary signal instead of exact
quantities; quantity becomes an optional integer, unit optional too
(migration 0003 backfills state from quantity: 0 -> out, else in).

- Pantry rebuilt as a phone-first card list: colored state rail,
  segmented In/Low/Out switch (server-driven HTMX), greyed out-items,
  live summary counts.
- Fast add: bottom add bar with type-ahead autocomplete, location
  picker, and quick-add chips for things you've run out of.
- Per-item menu (move / set expiry / delete); expiry is now an
  optional quiet pill, never required.
- New endpoints: pantry search + set-state; dropped the old
  edit-expiry/cancel flow and its partial.
- Recipes matcher made presence-based (have-it beats have-enough);
  state added to admin. Tests cover state, add/restock, search,
  presence matching, and page rendering.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Tom Flux
2026-06-23 19:55:16 +01:00
co-authored by Claude Opus 4.8
parent 25a09b08fc
commit ce61a0a86f
12 changed files with 681 additions and 193 deletions
+3 -2
View File
@@ -37,6 +37,7 @@ class IngredientAdmin(admin.ModelAdmin):
class PantryItemAdmin(admin.ModelAdmin):
list_display = [
"ingredient",
"state",
"quantity",
"unit",
"location",
@@ -44,9 +45,9 @@ class PantryItemAdmin(admin.ModelAdmin):
"expiry_date",
"is_staple",
]
list_filter = ["location", "is_staple"]
list_filter = ["state", "location", "is_staple"]
search_fields = ["ingredient__name"]
list_editable = ["quantity"]
list_editable = ["state", "quantity"]
# --- Meta-Recipe inlines ---