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
+7 -2
View File
@@ -43,7 +43,12 @@ test: generate ## Run unit tests
smoke: generate ## End-to-end check: auth, static assets, bundle import
./scripts/smoke.sh
check: lint test smoke ## Everything that must pass before a commit
# Sub-makes rather than prerequisites: these must run in order even under
# `make -j`, and a parallel run vets generated code that is being rewritten.
check: ## Everything that must pass before a commit
@$(MAKE) --no-print-directory lint
@$(MAKE) --no-print-directory test
@$(MAKE) --no-print-directory smoke
@echo "check: all passed"
vendor: ## Re-download the Datastar client (DATASTAR_VERSION=v1.0.3)
@@ -51,7 +56,7 @@ vendor: ## Re-download the Datastar client (DATASTAR_VERSION=v1.0.3)
"https://cdn.jsdelivr.net/gh/starfederation/datastar@$(DATASTAR_VERSION)/bundles/datastar.js"
@head -1 cmd/foodster/static/datastar.js
lint: ## go vet, gofmt check, golangci-lint when installed
lint: generate ## go vet, gofmt check, golangci-lint when installed
go vet ./...
@bad=$$(gofmt -l $(GOFILES) 2>/dev/null); \
if [ -n "$$bad" ]; then echo "gofmt needed:"; echo "$$bad"; exit 1; fi