Skip to content

feat(site/src/pages/AgentsPage/components): add the chat overview card view - #31409

Merged
ThomasK33 merged 14 commits into
mainfrom
tk/overview-card-view
Nov 10, 2026
Merged

ThomasK33 merged 14 commits into
mainfrom
tk/overview-card-view

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Adds ChatOverviewCardView, a small card that lists a chat's cost, its repositories with their uncommitted line counts, the pull requests, and the attachments. Nothing mounts the view yet, so this PR changes no page. #31412 mounts it in the chat's top-right corner while the right panel is closed.

A row calls onOpenTarget({ tabId }) with the right panel tab that holds its details: Summary for cost and attachments, Git for repositories and pull requests. A repository row shows the repository's folder name, with its branch below it, or "No branch" when HEAD is on no branch. A repository without uncommitted changes shows +0 −0 as plain text, with no hover state and no click, because the Git panel has nothing to show for it. A button row's label truncates in the 16rem card. When the label or subtitle is cut off, a tooltip shows it in full on hover and on keyboard focus. A row that fits gets no tooltip, so a screen reader does not hear its text twice. The plain-text row wraps instead, and it takes no tab stop. Long lists show three rows and a toggle that names the section, such as "Show all 5 repositories" and "Show fewer repositories". While the card is empty and loading, it shows skeleton rows in a status region that reads "Loading overview", and the card is marked aria-busy. The card has no animation.

The code comes from the prototype in #31260 (do not merge), adapted to the MessageAttachment type from #31140. #31260 stays the hands-on reference for the whole card.

The card with a long list, where the third repository has no branch:

Card with three of five repositories, one showing No branch

The expanded list, and a clean repository without cost:

Card with all five repositories shown

Card with one clean repository showing +0 -0

A repository row whose branch is cut off, on hover:

Tooltip showing the repository name and full branch

The loading state:

Skeleton rows while the card loads

How to test

  1. Open Storybook at pages/AgentsPage/ChatOverviewCardView and step through the stories. TruncatedRowTooltip hovers a repository row whose branch is cut off.
  2. Run pnpm exec vitest run --project=unit src/pages/AgentsPage/components/ChatOverviewCardView.test.tsx in site/. The tests check the target each row sends, that a clean repository row is not a button, that a truncated row's tooltip opens on hover, that a row that fits gets no tooltip, and that Tab skips a clean repository row.

What to look at first

  1. OverviewRow: one row renders as a button with onClick, or as plain text without it, inside the shared Tooltip.
  2. OverviewListSection: the shared "title, first three rows, toggle" list for Repositories, Pull requests, and Attachments.
  3. hasChanges and RepoDiffStat: the clean repository rule lives in one predicate.
Review history

Review follow-up: the Changes section listed repositories but labeled each row with its branch, so two repositories on the same branch looked the same, and the toggle counted repositories as changes. The section is now Repositories: each row shows the repository name, with the branch (or "No branch") as the subtitle and a repository icon. The view model gained name, and #31590 fills it. The stack above was updated by merges.

The repository's frontend-deep-review ran three rounds on the first version, then one strict code quality review ran, then a polish pass and one final review round (a code quality review plus frontend-deep-review) ran on the whole stack.

Polish pass changes in this PR:

Final round fixes: folded OverviewList into OverviewListSection, named the clean repository check hasChanges, made getCostSubtitle return undefined instead of an empty string, and shortened the card's doc comment.

Accessibility review from Jaayden (four threads) and an audit against site/AGENTS.md "Accessibility and robustness", FE6 and the frontend-deep-review SA6 checkpoint:

  • The clean repository row is plain text again: no tabIndex, no tooltip, no oxlint exception, and its label wraps. This reverses the follow-up fix below. The keyboard test now checks that Tab skips the row and lands on the next button, found by role.
  • The loading state uses skeleton rows in role="status" with screen reader text, and the card gets aria-busy.
  • The list toggle drops aria-expanded and names the section in its visible label.
  • The tooltip opens only when the text is truncated, measured with a ResizeObserver as the Git panel does for its PR title. New test: "adds no tooltip to a row whose label fits".
  • New story TruncatedRowKeyboardFocus screenshots the focus ring and the tooltip from the keyboard.
  • Declined from the audit: aria-expanded on the toggle (the review asked for one state signal), moving focus after a subagent link opens another chat (the sidebar chat links behave the same way), and moving focus when the window shrinks below 84rem while focus is in the card (rare).
  • Declined from the advisor: useCallback for the measuring ref. The React Compiler memoizes it, and the frontend rules forbid manual memoization in compiled folders.
  • I merged origin/main into this branch and carried it up the stack by merges, without a force push.

Follow-up fixes, after the final round:

  • Added the row tooltip, with the shared Tooltip primitive. The plain-text row gets tabIndex={0} and an oxlint exception with its reason, as SecretsTable.tsx does, so the keyboard can open its tooltip. Its earlier "no focus" behavior changes for that reason only.
  • Two new tests check the tooltip through the row's accessible description, by hover and by keyboard. Each fails when the tooltip stays closed. The test file now renders with renderComponent, which adds the tooltip provider. No existing assertion changed.
  • New story TruncatedRowTooltip gives the open tooltip a screenshot.
  • The PR grew to 605 changed lines, most of them stories and tests. I kept it in one PR.

Skipped in the polish pass:

  • A cost model that carries coversWholeTree. It moves a conditional into the container and changes the tested getOverviewCost contract without deleting a branch.
  • A shared helper for the unpriced-requests sentence. The two copies are short and use different punctuation, and the helper would touch ChatSummary in an unrelated PR.
  • A CostRow component from the final round. It overlaps the cost model item above and saves about three lines.

Declined in earlier rounds:

  • Story fixture factories (mockRepo, mockAttachment) instead of named Mock* constants. They build view-model rows for one component, not shared API entities.
  • Stories for the "Pull request" and attachment name fallbacks, and for merged, closed, and draft pull request icons. getPRIconConfig and getAttachmentDisplayName are shared helpers with their own coverage.
  • A fallback label in the view for an empty branch name. The container passes repoBranchLabel(root, repo), the same label as the Git panel.
  • A loading line while some sections already show data. Sections render as their data arrives, by design.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: high

@linear-code

linear-code Bot commented Nov 2, 2026

Copy link
Copy Markdown

CODAGT-1517

@jaaydenh jaaydenh left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessibility pass on ChatOverviewCardView. Four inline comments: the focusable clean-repo row, the "Show N more" toggle, the loading state (a skeleton instead of plain text), and the tooltip repeating the row's name for screen readers.

@jaaydenh

jaaydenh commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@ThomasK33 The changes section feels odd here because its actually a list of repositories. Why not call this section Repos and list the names of the repositories, and make the branch name the tooltip?

Copy link
Copy Markdown
Member Author

So, "changes" are what I saw in Codex and Xum.
I don't think they have the per-branch display that we do in our git viewer. What do you think about me renaming it to branches instead?

CleanShot 2026-11-04 at 14.27.37@2x.png

@jaaydenh
jaaydenh temporarily deployed to main November 8, 2026 09:40 — with GitHub Actions Inactive
@jaaydenh
jaaydenh temporarily deployed to main November 8, 2026 09:43 — with GitHub Actions Inactive
ThomasK33 and others added 12 commits November 9, 2026 18:46
…d view

Add ChatOverviewCardView, the card that a later change shows in the
chat's top-right corner while the right panel is closed. It lists the
chat cost, the uncommitted changes per repository, the pull requests,
and the attachments. A row opens the matching right panel tab through
onOpenTab. A clean repository shows +0 -0, so the card has a Changes
row when AI Gateway turns cost off. Nothing mounts the view yet.
…d view

Rename the view file to ChatOverviewCardView.tsx, so the container in a
later change can take ChatOverviewCard.tsx, as AgentChatPage does. Rows
now call onOpenTarget with a target object, so the deep links later only
add a view to it. A titled OverviewListSection replaces the repeated
"if not empty, section around a list" blocks, and RepoDiffStat holds the
+0 -0 placeholder.

A repository without changes is no longer a button: the Git panel lists
only repositories with changes, so the row had nothing to open.
…t into its section and name the clean repository check
…iew card comments

Keep the JSDoc on exported symbols and the comments that explain non-obvious behavior (cost states, subagent cost scope, attachment order, the clean repository badge, toggle focus, and why rows have tooltips). Drop comments that restate names or the code below them, and the per-story doc comments.
…ins in the overview card with padding

The card now pads by px-1.5 and its headings, empty and loading states, and rows pad themselves, so rows no longer pull outward with -mx-1.5. Text, icons, and hover areas stay in place; section dividers run 6px closer to the card edge.
… in the overview card

The Changes section listed one row per repository but labeled each row
with its branch, so two repositories on the same branch looked the same,
and the toggle counted repositories as changes. Rename the section to
Repositories, label each row with the repository name, and show the
branch as the subtitle.
…ies in the overview card

Show "No branch" when HEAD is detached instead of an empty subtitle, use
a repository icon now that rows name repositories, and drop a test
assertion on rendered output that the tab order test already covers.
@jaaydenh
jaaydenh force-pushed the tk/overview-card-view branch from 4782f01 to 2574f0a Compare November 9, 2026 11:46
@jaaydenh
jaaydenh temporarily deployed to main November 9, 2026 11:46 — with GitHub Actions Inactive
@ThomasK33
ThomasK33 merged commit 6031db7 into main Nov 10, 2026
25 of 27 checks passed
@ThomasK33
ThomasK33 deleted the tk/overview-card-view branch November 10, 2026 12:38
@ThomasK33
ThomasK33 temporarily deployed to main November 10, 2026 12:38 — with GitHub Actions Inactive
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 10, 2026

This branch was previously deployed

1 inactive deployment
main — 2574f0ac Deployed Nov 10, 2026 by ThomasK33 via cla #253229
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants