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
+16
View File
@@ -200,6 +200,22 @@ regenerates or swaps.
- Settings page for the cooldown window (default **14 days**, configurable).
*(Stage 2 — only relevant once the suggester exists.)*
### 7.4 Appearance (stage 1)
- A light / dark theme switch, remembered **per device**. The instance is
shared and has no accounts, so this is a device preference in
`localStorage`, never a server-side setting — the phone in the kitchen and
the laptop must be able to disagree.
- Three states: light, dark, and follow the system. System is the default.
- The control **shows the state that is currently active**, not the state
clicking it would produce. A segmented control with the active option
marked, not a single button labelled with its opposite. A lightswitch does
not read "off" while the lights are on.
- Implementation is `color-scheme` on the root element: `light dark` for the
system-following default, `only light` or `only dark` when overridden.
Because the palette is built from `light-dark()` custom properties, no
other CSS changes.
## 8. Suggestion algorithm (stage 2)
Produce seven mains, then attach sides per meal.