Skip to content

ResourceListItem: render Annotations from resource.annotations #1238

@cliffhall

Description

@cliffhall

Background

Documented as a Phase 5 audit partial in specification/v2_ux_interfaces.md (PR #1236). ResourceListItem's prop interface matches the spec target ({ resource: Resource | ResourceTemplate, selected, onClick }), but the spec entry's Internal refactors bullet — "Actually render the annotations currently received but unused; use title ?? name" — is half-done: the title fallback is in, but the component still ignores resource.annotations entirely.

AnnotationBadge already exists as the canonical renderer for one annotation facet (audience, priority, plus the four ToolAnnotations hint fields), and ResourcePreviewPanel already uses it for resource annotations. ResourceListItem should follow the same pattern in its compact row layout.

Acceptance criteria

  • When resource.annotations.audience is non-empty, render an AnnotationBadge facet="audience" value={...} inside the row.
  • When resource.annotations.priority is defined (any number), render an AnnotationBadge facet="priority" value={...}.
  • When annotations is absent or both fields are empty/undefined, the row renders identically to today (no extra elements, no extra spacing leaked).
  • Layout stays single-line when the row is wide enough; badges wrap below the title when the container is narrow (existing Mantine Group wrap behavior is fine).
  • No new exported types or props; the change is internal to ResourceListItem.tsx.
  • Stories cover: (a) no annotations, (b) audience only, (c) priority only, (d) both, (e) ResourceTemplate with annotations.

Test plan

  • npm run format && npm run lint && npm run build clean.
  • Existing ResourceListItem.stories.tsx continues to render visually unchanged in the no-annotations story.
  • New stories above render correctly in Storybook (manual check).
  • Spot-check the Resources screen story (ResourcesScreen.stories.tsx) — fixtures with annotated resources should now show badges in the sidebar list.

Out of scope

  • Adding click behavior or tooltips to badges in the row (they remain decorative).
  • Rendering the four ToolAnnotations hints — those belong on ToolListItem, not here.
  • Changing AnnotationBadge itself.

Related

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions