feat(:sidebar_item): add avatar_url + state props (Wave 3.7 Class C extension, DRAFT, Pascal-review REQUIRED)#135
Draft
ty13r wants to merge 1 commit into
Draft
Conversation
…xtension)
Extends the canonical :sidebar_item widget with two new optional attrs per
unified_ui issue #184 (audit findings SB-4 and SB-5):
- avatar_url: String.t() | nil -- renders <img aria-hidden="true"> before the
label when set; used for DM row avatars in the sidebar.
- item_state: :default | :stalled | :blocked | :errored | nil -- applies
a BEM modifier class (live-ui-sidebar-item--state-{value}) and a
data-live-ui-item-state hook attribute for CSS/JS targeting.
Both are backward-compatible additive changes (default nil = existing behavior).
Stage 1 (unified_iur): sidebar_item/3 constructor gains avatar_url + item_state
opts; validates item_state against enum; maybe_put omits nils.
Stage 3 (live_ui renderer): :sidebar_item clause updated to dispatch to the
new LiveUi.Widgets.SidebarItem.component (same pattern as :thread_card).
Stage 4 (live_ui): new LiveUi.Widgets.SidebarItem Phoenix.Component module.
Tests: 10 new unified_iur constructor tests + 16 new Stage-4 live_ui tests.
Open questions for Pascal (verbatim from unified_ui #184):
1. Avatar composition: inline <img> vs composing :avatar widget (ash_ui #116)?
2. State enum completeness: :loading, :in_progress deferred pending confirmation.
3. state vs tone naming: item_state chosen to avoid clash with LiveUi.Component
common :state assign; Pascal may prefer another name.
4. ARIA for :blocked: aria-disabled="true" deferred; comp shows visual treatment
but clickability intent unclear.
5. Avatar fallback: initials fallback for missing avatar_url is consumer-side.
DRAFT PR -- Pascal review required before merge.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the canonical
:sidebar_itemwidget with two new optional props per unified_ui issue #184 (Wave AshUI-3.7 comp-fidelity audit findings SB-4 + SB-5).avatar_url(String.t() | nil, defaultnil): when set, renders a small<img aria-hidden="true">before the item label. Used for DM rows in the sidebar showing the target's avatar beside the name.item_state(:default | :stalled | :blocked | :errored | nil, defaultnil): applies a BEM modifier classlive-ui-sidebar-item--state-{value}and adata-live-ui-item-statehook attribute for CSS/JS targeting. Semantic workflow-state meaning for stalled/blocked/errored items.Both are backward-compatible additive changes (nil default preserves all existing behavior).
Files modified
packages/unified_iur/lib/unified_iur/widgets/components.ex— Stage 1:sidebar_item/3constructor acceptsavatar_urlanditem_stateopts; validatesitem_stateagainst[:default, :stalled, :blocked, :errored]; usesmaybe_putso nil values are omittedpackages/live_ui/lib/live_ui/renderer.ex— Stage 3: replaces the inline:sidebar_itemHEEx template with a dispatch toLiveUi.Widgets.SidebarItem.component(same pattern as:thread_card)packages/live_ui/lib/live_ui/widgets/sidebar_item.ex— Stage 4: newLiveUi.Widgets.SidebarItemPhoenix.Component with full attr declarations + render/1packages/unified_iur/test/unified_iur/widgets/components_test.exs— 10 newdescribe "sidebar_item constructor"tests covering defaults, avatar_url present/absent, all valid item_state values, invalid state raises, backward-compat, and combined usepackages/live_ui/test/live_ui/sidebar_item_widget_test.exs— 16 new Stage-4 tests: true-widget attr, label render, aria-current + BEM selected, avatar img present/absent, state hook + modifier for each state, nil/default state omission, renderer dispatchTest results
packages/unified_iur: 34 tests, 0 failures (components_test.exs only; 7 pre-existing failures in other test files are unrelated to this PR)packages/live_ui: 587 tests, 0 failures (includes 16 new sidebar_item tests)Open questions for Pascal (verbatim from unified_ui #184)
<img>inline directly (smallest delta). Should:sidebar_iteminstead compose with the canonical:avatarwidget (ash_ui PR feat(live_ui): add Avatar widget Phoenix.Component (Wave 3.9.1a Stage-4) #116, DRAFT)? Composing is cleaner separation but a larger PR. Inline<img>used here pending Pascal decision.:stalled | :blocked | :erroredare the audit-required values. Are:loadingor:in_progressneeded? Should it overlap with the:loadingstate convention from button widgets?statevstonenaming:item_statewas chosen to avoid collision withLiveUi.Component's common:stateassign (style hook). Does this widget align with the:toneconvention used elsewhere? Or isstatemore appropriate here for workflow-state semantics?:blocked: comp shows visual treatment (dimmed + lock icon) but items remain clickable. Shouldaria-disabled="true"be added for:blocked? Or just a state CSS class with no ARIA implication?avatar_urlnot provided but the item is a DM row, should there be an initials fallback? Left as consumer-side composition for now.Cross-references
docs/wave-ashui-3-7-comp-fidelity-audit.mdextension table lines 237-238 (SB-4 + SB-5)Status
DRAFT — Pascal review required before merge. Standing auto-merge does NOT apply.
🤖 Generated with Claude Code