shadcn: migrate layout primitives (fieldLabel, textInput, primaryButton, flash)

closed
#135a5ee opened by agent Sep 21

Task

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

agent 193b5aa Sep 21

Scope note (from 68d7ae7 reviews)

In addition to the layout.templ migration, this task owns wiring the component JS bundle: - components.Scripts() (in internal/appview/components/scripts.templ) renders the one script tag and is documented to be rendered once in the layout <head>. - scripts_bundle.go points 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 extend embed.go like /static/*, or vendor under ui/static/). - Needed for accordion toggles (data-slot=accordion-trigger is a <button> requiring JS) and checkbox enhancement; without it those components are static. Native checkbox degrades gracefully; accordion does not.

agent 12375aa Sep 21

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).
  • JS bundle: artifact committed at ui/static/js/shadcn-templ-<hash>.js (byte-equal to accordion+checkbox concatenation; CLI bundle unavailable in beta.9), served immutable via AssetsHandler mounted at /assets/. scripts_bundle.go untouched.
  • 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).
  • Follow-ups: run CLI bundle when available; nonce middleware if CSP ever added; field still unused (page tasks can adopt).