chore(ui): consolidate avatar renderer, auth form-errors, confirm-dialog guideline (LC-169) #214

Merged
nrupard merged 1 commit from chore/lc-169-ui-consolidation into main 2026-05-26 16:57:20 +02:00
Owner

Closes LC-169. C3 consolidation follow-ups from the LC-148 audit (docs/audit/2026-05-22-lc148-audit-report.md), folding three copy-pasted UI patterns back onto a single source each.

Avatar / presence badge (one renderer)

The mention popover (partials/mention_popover.html) re-implemented the avatar circle inline and, unlike every other avatar surface, rendered no presence status dot. Folded it onto the single avatar renderer (partials/avatar.html) using the same {% let avatar_* = ... %} + {% include %} pattern that user search and invite search already use. MentionSuggestion gains status + custom_status; the autocomplete handler resolves presence with routes::effective_status, so mention rows now show the same offline-aware status dot as the sidebar and user search. Broadcast (@here/@channel) and group (#group) rows keep their glyph badges and never reach the avatar partial.

Form-error rendering (one fragment shape)

auth/form_errors.html existed but was included nowhere; all five auth pages (login, register, forgot, reset, verify_email_result) hand-rolled an identical inline {% if let Some(error) = error %} block. Pointed every page at the shared partial and added role="alert" to it, so server-rendered auth errors announce to assistive tech the same way the in-place modal/composer slots (.composer-error, .thread-error, #lc-upload-error) already do. Single visual + a11y contract across both rendering paths.

Confirm-dialog guideline (documented, not mechanically converted)

Documented the three coexisting confirmation tiers in a new docs/ui-conventions.md rather than rewriting sites: hx-confirm for htmx-driven reversible mutations, native confirm() for plain-<form> POSTs (where hx-confirm would not fire), and server-side re-auth / typed verification for irreversible high-blast-radius actions (delete account, delete enclave, stage restore). Converting a plain form to htmx is behavior-changing and must be audited per site, so the deliverable here is the documented default plus a survey of which tier each existing site sits in. The doc also captures the avatar and form-error contracts above so new surfaces inherit all three by construction.

Verification

just test and just test-saas both green; cargo clippy and cargo fmt clean. New routes_mentions behavior (presence dot) covered by the existing 15 mention tests, which still pass.

Closes LC-169. C3 consolidation follow-ups from the LC-148 audit (`docs/audit/2026-05-22-lc148-audit-report.md`), folding three copy-pasted UI patterns back onto a single source each. ## Avatar / presence badge (one renderer) The mention popover (`partials/mention_popover.html`) re-implemented the avatar circle inline and, unlike every other avatar surface, rendered no presence status dot. Folded it onto the single avatar renderer (`partials/avatar.html`) using the same `{% let avatar_* = ... %}` + `{% include %}` pattern that user search and invite search already use. `MentionSuggestion` gains `status` + `custom_status`; the autocomplete handler resolves presence with `routes::effective_status`, so mention rows now show the same offline-aware status dot as the sidebar and user search. Broadcast (`@here`/`@channel`) and group (`#group`) rows keep their glyph badges and never reach the avatar partial. ## Form-error rendering (one fragment shape) `auth/form_errors.html` existed but was included nowhere; all five auth pages (`login`, `register`, `forgot`, `reset`, `verify_email_result`) hand-rolled an identical inline `{% if let Some(error) = error %}` block. Pointed every page at the shared partial and added `role="alert"` to it, so server-rendered auth errors announce to assistive tech the same way the in-place modal/composer slots (`.composer-error`, `.thread-error`, `#lc-upload-error`) already do. Single visual + a11y contract across both rendering paths. ## Confirm-dialog guideline (documented, not mechanically converted) Documented the three coexisting confirmation tiers in a new `docs/ui-conventions.md` rather than rewriting sites: `hx-confirm` for htmx-driven reversible mutations, native `confirm()` for plain-`<form>` POSTs (where `hx-confirm` would not fire), and server-side re-auth / typed verification for irreversible high-blast-radius actions (delete account, delete enclave, stage restore). Converting a plain form to htmx is behavior-changing and must be audited per site, so the deliverable here is the documented default plus a survey of which tier each existing site sits in. The doc also captures the avatar and form-error contracts above so new surfaces inherit all three by construction. ## Verification `just test` and `just test-saas` both green; `cargo clippy` and `cargo fmt` clean. New `routes_mentions` behavior (presence dot) covered by the existing 15 mention tests, which still pass.
chore(ui): consolidate avatar renderer, auth form-errors, confirm-dialog guideline (LC-169)
All checks were successful
check-secrets / Kingfisher (push) Successful in 4s
check-secrets / TruffleHog (push) Successful in 4s
check-secrets / Nosey parker (push) Successful in 4s
check-secrets / Nosey parker (pull_request) Successful in 4s
check-secrets / TruffleHog (pull_request) Successful in 9s
check-secrets / Kingfisher (pull_request) Successful in 13s
Check / clippy + fmt + tests (pull_request) Successful in 3m11s
Create release / Create release from merged PR (pull_request) Has been skipped
0893fd0e00
C3 follow-ups from the LC-148 audit, folding three copy-pasted UI patterns back onto a single source each.

Avatar: the mention popover (partials/mention_popover.html) re-implemented the avatar circle inline with no presence badge. Fold it onto the one avatar renderer (partials/avatar.html) via the same {% let avatar_* = ... %} + include pattern user/invite search already use. MentionSuggestion gains status + custom_status; the autocomplete handler resolves presence with effective_status so mention rows now show the same offline-aware status dot as every other surface. Broadcast/group rows keep their glyph badges and never reach the avatar partial.

Form errors: auth/form_errors.html existed but was included nowhere; all five auth pages hand-rolled an identical inline error block. Point every page at the partial and add role="alert" to it so server-rendered errors announce to assistive tech the same way the in-place modal/composer slots already do.

Confirm dialogs: documented the three coexisting confirmation tiers (hx-confirm for htmx-driven, native confirm() for plain-form, server-side re-auth/typed for irreversible) in a new docs/ui-conventions.md rather than mechanically converting sites, since converting a plain form to htmx is behavior-changing and must be audited per site. The doc also captures the avatar and form-error contracts above so new surfaces inherit them.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
nrupard deleted branch chore/lc-169-ui-consolidation 2026-05-26 16:57:20 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/lets-chat!214
No description provided.