Build the Kirjaa log flow and Historia list

Stage 1's point is collecting eating history, so the logging path is the one
that has to be frictionless: pick a dish, tick sides, done.

Kirjaa:
- dishes ordered and sized by how often they have been eaten, so the likely
  answer is the biggest target on the screen
- picking a dish opens the sides step; a dish with has_sides false says so
  instead of offering an empty list
- saving redirects, so a refresh cannot double-post
- a day already logged shows the entry with edit and delete. Editing reopens
  the sides step with the existing sides ticked, which makes editing and
  creating the same screen
- day switcher and a server-side search over the catalog

Historia walks back day by day to the oldest entry, so a day nobody wrote
down appears as an explicit gap rather than quietly missing.

No JavaScript is involved: every interaction is a link or a form, and the
checked-chip styling is :has(input:checked). Datastar stays loaded but unused
until an interaction genuinely needs to avoid a page load.

Also fix a Makefile ordering bug: lint did not depend on generate, so `go vet`
could run against templ output that was being rewritten. check now runs its
phases as sub-makes so `make -j` cannot interleave them.

Records two features that are specified but not built: dish CRUD in the UI
(§7.3, only import exists today) and a per-device light/dark switch (§7.4).
The switch must show the state that is active, not the one clicking produces.
This commit is contained in:
Esa Kataja
2026-09-05 18:29:38 +03:00
parent c6f44bb427
commit e4503e8433
10 changed files with 1146 additions and 12 deletions
+15 -1
View File
@@ -15,7 +15,21 @@ See [PRD.md](PRD.md) for the full specification.
log come first, because the suggester is worthless until there are a few
weeks of real history to weight against.
Stage 2 — the seven-meal suggester — starts once that history exists.
Working:
- **Kirjaa** — log a dinner: pick a dish, tick sides, save. Dishes are sized
by how often they are eaten. Edit or delete the day's entry.
- **Historia** — every day back to the first entry, with unlogged days shown
as explicit gaps.
- **Ruoat** — import a bundle of dishes by paste or file upload.
Still to build:
- Adding, editing and deleting dishes **in the UI** (PRD §7.3). Right now the
catalog can only be filled by importing a bundle.
- Light / dark theme switch, saved per device (PRD §7.4).
- Stage 2: the seven-meal suggester, which starts once there is history to
weight against.
## Stack