Skip to content

feat(apps): add AppListItem and AppDetailPanel groups (#1261) - #1273

Merged
cliffhall merged 4 commits into
v2/mainfrom
1261/applistitem-appdetailpanel
May 4, 2026
Merged

cliffhall merged 4 commits into
v2/mainfrom
1261/applistitem-appdetailpanel

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #1261.

Summary

Two presentation-only group components for the upcoming `AppsScreen`. Both consume real MCP `Tool` typing from `@modelcontextprotocol/sdk/types.js` and contain no store access.

`AppListItem`

  • Props: `{ tool, selected, onClick }`
  • Renders `tool.icons[0]` (sized 20×20) when present, label (`title ?? name`), `lineClamp={2}` description, trailing chevron.
  • Reuses `ToolListItem`'s active-state highlight (`UnstyledButton` `bg` via `--mantine-primary-color-light`).

`AppDetailPanel`

  • Props: `{ tool, formValues, isOpening, onFormChange, onOpenApp }`
  • Layout: optional icon + title row, optional description, divider, `SchemaForm` for `tool.inputSchema`, full-width "Open App" button.
  • "Open App" is disabled while `isOpening` or while any required field in `tool.inputSchema.required` is `undefined` / `null` / `""`. Validation is derived locally because the panel is "dumb" — no shared form ref / no store.
  • No annotations group, no progress display, no cancel — execution is delegated to the embedded app, not run as a tool call from the panel.

Convention note

The issue references the tabler icon names `IconChevronRight` / `IconPlayerPlay`. The v2 web client already standardized on `react-icons` (md/ri namespaces — see `SchemaForm.tsx` and others), so this PR uses `MdChevronRight` and `MdPlayArrow` rather than pulling in a second icon library. Happy to swap if reviewers prefer to standardize on tabler going forward — just flag it.

Stories

  • AppListItem: Default, Selected, WithIcon, NoDescription, LongName.
  • AppDetailPanel: NoFields, SimpleStringParam, MultipleParams, WithIcon, Opening, ComplexSchema.

Tests / coverage

  • 22 new test cases (8 for AppListItem, 14 for AppDetailPanel).
  • Both files at 100% lines / statements / functions / branches.
  • Full suite: `Test Files 69 passed (69)`, `Tests 613 passed (613)`.

Test plan

  • `npm run validate` from `clients/web/` — clean.
  • Per-file coverage gate — both new files at 100%.
  • Reviewer sanity-checks the validation derivation for `AppDetailPanel` against the v1 `AppsTab` form-ref-based check.

Two presentational groups for the upcoming AppsScreen.

AppListItem (clients/web/src/components/groups/AppListItem/):
- Props { tool, selected, onClick }
- Renders tool.icons[0] (sized sm) when present, label (title ?? name),
  two-line clamped description, and a trailing chevron affordance.
- Reuses ToolListItem's selected-state highlight (UnstyledButton bg via
  --mantine-primary-color-light).

AppDetailPanel (clients/web/src/components/groups/AppDetailPanel/):
- Props { tool, formValues, isOpening, onFormChange, onOpenApp }
- Layout: optional icon + title row, optional description, divider,
  SchemaForm bound to tool.inputSchema, full-width "Open App" button.
- "Open App" is disabled while isOpening or while any required input
  field is empty (validation derived from tool.inputSchema.required).
- No annotations, progress, or cancel — execution is delegated to the
  embedded app, not run as an MCP tool call from the panel.

Convention notes:
- Issue text references @tabler IconChevronRight / IconPlayerPlay; the
  v2 web client already uses react-icons (md/ri namespaces), so this PR
  uses MdChevronRight and MdPlayArrow for consistency rather than
  introducing a second icon library.

Stories: AppListItem (Default, Selected, WithIcon, NoDescription, LongName);
AppDetailPanel (NoFields, SimpleStringParam, MultipleParams, WithIcon,
Opening, ComplexSchema).

Tests: 22 cases covering rendering branches, callback wiring, and the
disabled-button derivation. Per-file coverage 100% across lines,
statements, functions, and branches for both new components.

Closes #1261

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@cliffhall cliffhall added the v2 Issues and PRs for v2 label May 1, 2026
The Wikipedia-hosted PNG used in the AppListItem and AppDetailPanel
WithIcon stories returned a broken image in Storybook (rate-limited /
hot-link blocked). Replace it with an inline SVG sun icon as a data
URI so the stories render offline, in Chromatic, and on any network.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@cliffhall

Copy link
Copy Markdown
Member Author

@claude review

@claude

claude Bot commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @cliffhall's task in 1m 57s —— View job


Code Review

  • Gather context and read changed files
  • Review AppListItem component and tests
  • Review AppDetailPanel component and tests
  • Review Storybook stories
  • Post comprehensive review feedback

Overall this is a clean, well-structured PR. The components are presentation-only, follow project conventions, have excellent test coverage, and Storybook stories are comprehensive. A few observations below:


AppListItem.tsx

resolveLabel is a duplicate of ToolListItem's

AppListItem.tsx:40 and ToolListItem.tsx:21 contain an identical function:

function resolveLabel(name: string, title?: string): string {
  return title ?? name;
}

Similarly, AppDetailPanel.tsx:37 has resolveTitle with the same body. These three functions do the exact same thing. This doesn't cause bugs, but since there are now three components with the same one-liner, it's worth extracting once to a shared utility (e.g., utils/toolUtils.ts) to avoid a fourth copy when the next screen arrives. Low priority, just flagging.

AppListItem omits the name sub-label that ToolListItem shows

ToolListItem shows name as a dimmed sub-label when title is present — useful for disambiguating display name from machine name. AppListItem drops that sub-label entirely. This is probably intentional since MCP app tools may prefer a cleaner presentation, but it's worth confirming this is by design and not an accidental omission.


AppDetailPanel.tsx

Divider is always rendered, even when the schema has no properties

AppDetailPanel.tsx:73 renders <Divider /> unconditionally. For noFieldsTool (empty inputSchema: { type: "object" }), SchemaForm renders nothing, so you get a divider sitting between the description text and an empty space, then the "Open App" button below. Visually this may look like an orphaned separator. Worth checking the rendered output of the NoFields story and deciding whether the divider should be conditional on inputSchema.properties being non-empty.

Optionally fix this →

SchemaForm disabled vs. button disabled — intentional and correct

AppDetailPanel.tsx:79 passes disabled={isOpening} to SchemaForm (not disabled={disabled}). This means the form stays editable while validation fails, which is the correct UX — users can keep filling in required fields. The button uses disabled={disabled} which covers both cases. This is a subtle but correct distinction; worth a brief inline comment since it could confuse a future reader:

// Form stays editable while validation fails so users can fill required fields.
<SchemaForm ... disabled={isOpening} />

PanelTitle vs ItemLabel truncation inconsistency

PanelTitle uses truncate="end" while ItemLabel (in AppListItem) uses truncate: true. Both result in trailing ellipsis, but "end" is more explicit. Minor consistency nit — either aligning them or documenting why they differ would clarify intent.


Tests

Module-level vi.fn() in baseProps is consistent with project pattern

AppDetailPanel.test.tsx:38-43 defines shared mocks at module level (matching the pattern in ServerCard.test.tsx). Tests that assert mock call counts correctly declare their own fresh vi.fn() per test. No issue here.

Selected-state test is a smoke test only

AppListItem.test.tsx:82-88 asserts only that the button renders without crashing when selected={true}. It doesn't assert that the background colour is applied. This is acceptable (Mantine prop rendering is hard to assert in happy-dom), but worth noting if visual regression coverage via Chromatic is not set up.


Stories

SUN_ICON_SVG constant is duplicated

The same inline SVG data URI appears in both AppListItem.stories.tsx:32 and AppDetailPanel.stories.tsx:57. Not a correctness issue, but extracting it to src/test/fixtures/icons.ts (or similar) would avoid a third copy when the AppsScreen stories arrive.


Summary

The validation logic in hasMissingRequiredFields is solid and the "dumb" component design is well-executed. The PR description's note about the isOpening / SchemaForm.disabled distinction is important — the PR description captures it, but a brief comment in the source would help future maintainers. The Divider always-present behavior is the only thing worth a second look before merge.
| Branch: 1261/applistitem-appdetailpanel

- Extract resolveDisplayLabel(name, title?) to src/utils/toolUtils.ts and
  migrate all four call sites (AppListItem, AppDetailPanel, ToolListItem,
  ToolDetailPanel) to consume it. Avoids the fourth copy when the next
  list/detail screen arrives. Includes a small unit suite.

- AppDetailPanel: only render the <Divider/> when the schema has at least
  one property — previously a no-input app showed an orphaned separator
  between the description and the Open App button.

- AppDetailPanel: align PanelTitle truncate to `true` (matches the
  ItemLabel form used in AppListItem / ToolListItem); behaviorally
  identical, just less surprising for future readers.

- AppDetailPanel: add an inline comment explaining that SchemaForm is
  disabled only while isOpening, not while validation fails — users
  should be able to keep filling required fields. The validation gate
  lives on the Open App button.

- Extract the inline SUN_ICON_SVG data URI used by the WithIcon stories
  to src/test/fixtures/storyIcons.ts so the next story that needs it
  doesn't grow a third copy.

- Tests: add the AppDetailPanel divider-conditional cases (rendered
  with fields, omitted without). Per-file coverage stays at 100% for
  AppListItem, AppDetailPanel, ToolListItem, ToolDetailPanel, and the
  new toolUtils. Suite: 70 files / 618 tests passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@cliffhall

Copy link
Copy Markdown
Member Author

Thanks @claude — addressed in 2373945.

1. resolveLabel / resolveTitle duplication (fixed + extended) — extracted to src/utils/toolUtils.ts as resolveDisplayLabel(name, title?) and migrated all four call sites (the two new App* groups and the two existing Tool* groups) so the helper isn't dormant. New toolUtils.test.ts covers it; coverage on the original Tool* files stays at 100%.

2. AppListItem omits the name sub-label (intentional) — confirmed: the issue spec lists "name, two-line description" as the two body lines, deliberately replacing the title/name disambiguation that ToolListItem shows. Apps tend to surface their human title cleanly; the machine name lives in the detail panel context.

3. Always-rendered Divider (fixed) — guarded behind Object.keys(inputSchema.properties ?? {}).length > 0. The NoFields story no longer shows the orphaned separator. Two new tests cover both branches.

4. SchemaForm disabled vs. button disabled (commented) — added the inline note you suggested so the next reader doesn't "fix" the inconsistency.

5. truncate="end" vs truncate: true (aligned) — switched PanelTitle to truncate: true to match ItemLabel everywhere. Behavior unchanged.

6. Selected-state smoke test (acknowledged) — agreed; Mantine prop-derived background is a poor fit for happy-dom assertions. Visual regression will be Chromatic's job once the storybook play tests are wired into CI (#1251).

7. SUN_ICON_SVG duplication (fixed) — extracted to src/test/fixtures/storyIcons.ts and imported from both stories. AppsScreen stories (#1263) can pull from the same module.

Suite is now 70 files / 618 tests passing; per-file coverage holds at 100% for AppListItem, AppDetailPanel, ToolListItem, ToolDetailPanel, and the new toolUtils.

@claude

claude Bot commented May 3, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @cliffhall's task in 51s —— View job


Review of Follow-up Changes (commit 2373945)

  • Gather context
  • Verify toolUtils.ts extraction and call-site migration
  • Verify conditional Divider in AppDetailPanel
  • Verify SchemaForm disabled comment
  • Verify truncate alignment
  • Verify storyIcons.ts extraction
  • Post final review

All 7 items addressed cleanly. A few notes per item:

1. resolveDisplayLabel extraction — well done. The name is more descriptive than resolveLabel/resolveTitle, and the JSDoc comment correctly generalises it to "any MCP entity that follows the BaseMetadata shape." All four call sites (AppListItem, AppDetailPanel, ToolListItem, ToolDetailPanel) confirmed migrated. The test suite covers the subtle "" (empty string) edge case — worth having documented since ?? vs || is a common source of confusion.

One trivial nit: toolUtils.test.ts:15 has a doubled phrase in the test name — "falls back to the name when title is an empty string is preserved". Reads a bit awkward; something like "preserves an empty string title rather than falling back to name" would be cleaner. Not a blocker.

2. AppListItem name sub-label (intentional) — rationale recorded, no change needed.

3. Conditional Divider — {hasFields && <Divider />} on line 71 is correct. Tests at lines 109–119 use getByRole("separator") which is exactly the accessible role <hr> carries — solid choice.

4. SchemaForm disabled comment — comment on lines 73–75 is clear and pre-empts the likely future "fix".

5. truncate alignment — PanelTitle now truncate: true; aligned with ItemLabel. ToolTitle in ToolDetailPanel still uses truncate="end" but that's out of scope here and consistent within its own panel.

6. Selected-state smoke test — acknowledged; Chromatic is the right long-term solution.

7. storyIcons.ts — clean extraction with good JSDoc. Both story files confirmed importing from the fixture.


LGTM. The only thing worth a one-word fix before merge is the test name nit in item 1, but it's purely cosmetic. Ready to merge otherwise.
| Branch: 1261/applistitem-appdetailpanel

Drops the doubled "is ... is preserved" phrase in the test name.
Behavior unchanged.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@cliffhall

Copy link
Copy Markdown
Member Author

Fixed in 610744d — test name now reads "preserves an empty-string title rather than falling back to the name". Thanks for the catch.

@cliffhall
cliffhall merged commit 1ffcdc3 into v2/main May 4, 2026
2 checks passed
@cliffhall
cliffhall deleted the 1261/applistitem-appdetailpanel branch May 4, 2026 14:29
@cliffhall cliffhall self-assigned this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant