shadcn: migrate layout primitives (fieldLabel, textInput, primaryButton, flash)
closedTask
Migrate shared primitives in internal/appview/ui/layout.templ to shadcn equivalents.
Files:
- Edit: internal/appview/ui/layout.templ (Layout, flash, fieldLabel, textInput, primaryButton)
- Uses: components/button, new label/input/field, alert
Steps:
1. flash -> alert variant (amber/info mapping; keep #form-error id contract used by htmx OOB swaps if shared).
2. fieldLabel -> label; textInput -> input (+ field wrapper where label/description/error compose).
3. primaryButton -> button (variant=default, appropriate size); keep type=submit behavior.
4. Layout shell: body/header slate classes -> shadcn tokens (bg-background text-foreground, border-border bg-card). Expect global @layer base shift; screenshot before/after.
Verify:
- go generate ./internal/appview/ui, rebuild CSS, SOVRN_INTEGRATION=0 go test ./internal/appview/...
- Manual: all pages render inside new shell; submit buttons work.
Done when: no hand-rolled fieldLabel/textInput/primaryButton remain; callers unchanged.
2 Comments
Scope note (from 68d7ae7 reviews)
In addition to the layout.templ migration, this task owns wiring the component JS bundle: -
components.Scripts()(ininternal/appview/components/scripts.templ) renders the one script tag and is documented to be rendered once in the layout<head>. -scripts_bundle.gopoints at/assets/js/shadcn-templ-<hash>.js, which does not exist in-repo yet — determine how the bundle artifact is produced (see https://shadcn-templ.com/llms.txt) and serve it (likely extendembed.golike/static/*, or vendor underui/static/). - Needed for accordion toggles (data-slot=accordion-triggeris a<button>requiring JS) and checkbox enhancement; without it those components are static. Native checkbox degrades gracefully; accordion does not.Complete
layout.templ:flash->alert (amber),fieldLabel->label,textInput->input (+Attributes passthrough),primaryButton->button default/submit; shell slate->tokens;Scripts()once in head. Signatures caller-compatible (textInput gained optional-use attrs; no callers existed).ui/static/js/shadcn-templ-<hash>.js(byte-equal to accordion+checkbox concatenation; CLIbundleunavailable in beta.9), served immutable viaAssetsHandlermounted at/assets/.scripts_bundle.gountouched.layout_test.go: 7 tests pin markers, bundle bytes, serve path. Spec ✅, quality ✅ after re-review (amber assertions, textInput passthrough, shadowing rename, glob/URL hardening).bundlewhen available; nonce middleware if CSP ever added;fieldstill unused (page tasks can adopt).