Split pins-panel.tsx into per-concern pin modules - #964
Merged
Conversation
pins-panel.tsx had grown to 973 lines — the largest component in
apps/web — holding everything from URL/PR display helpers to the
collapsible group machinery to the panel shell itself.
Move each concern into its own file, whole and unchanged, so no hook
changes owner and the rendered output is identical:
- pin-value-utils.ts pure display helpers (formatPrDisplay,
trimFilenameForDisplay, normalizeExternalHref,
resolveDisplayValue, markdown plain-text check)
- pin-value-row.tsx CopyButton, MarkdownPinBody, PinCaption,
PinValueRow — the leaf value primitives
- pin-shortcut-item.tsx ShortcutPinItem and DISABLED_PIN_REASON
- pin-item.tsx PinItem, the per-pin dispatcher
- pin-group.tsx layoutPins plus the group/collapse family
- pins-panel.tsx PinList, ConfirmShortcutDialog, PinsPanel
pins-panel.tsx drops to 233 lines; no new file exceeds 204. Imports
form a DAG, so no module cycles. PinItem is no longer re-exported from
pins-panel.tsx — nothing outside the cluster imported it.
Co-Authored-By: Claude Opus 5 (1M context) <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.
What
apps/web/src/components/app/pins-panel.tsxwas 973 lines — the largest component inapps/webby a wide margin (next wasagents-view.tsxat 787). It held every layer of the pins feature at once: URL/PR/filename display helpers, the leaf value renderers, the shortcut button, the per-pin dispatcher, the collapsible-group family, the confirm dialog, and the panel shell.This splits it along the seams the file already had. Every declaration moves whole and unchanged — no hook changes owner, no JSX is reshaped — so the rendered output and behavior are identical.
New file structure
pin-value-utils.tsformatPrDisplay,trimFilenameForDisplay,shouldRenderMarkdownAsPlainText,normalizeExternalHref,resolveDisplayValue,ResolvedValue— pure, no JSXpin-value-row.tsxCopyButton,MarkdownPinBody,PinCaption,PinValueRow— the leaf value primitivespin-shortcut-item.tsxShortcutPinItem+DISABLED_PIN_REASONpin-item.tsxPinItem— dispatches shortcut vs. value pinspin-group.tsxlayoutPins/PinRow,AUTO_COLLAPSE_THRESHOLD,PinGroupView,PersistedPinGroup,EphemeralPinGroup,PinGrouppins-panel.tsxPinList,ConfirmShortcutDialog,PinsPanelImports form a DAG (
utils → value-row → shortcut-item → item → group → panel), so there are no module cycles.PinItemis no longer re-exported frompins-panel.tsx— nothing outside this cluster imported it. The public surface consumers use (PinListforagent-history-detail-tabs.tsx,PinsPanelformedia-sidebar.tsx) is unchanged.Why this was a candidate
Hit four of the five signals: 973 lines, six logically independent UI regions, mixed concerns (pure URL parsing next to Radix dialogs next to persisted Jotai state), and deep conditional nesting in
PinValueRow's href/badge/filename ternary chain.Validation
pnpm run finalize:web— type check + production build passpnpm run test:e2e— 180 passed, 12 skipped (pre-existingterminal-liveskips). Includes the three pins specs: shortcut-button wiring, collapsed-group localStorage round-trip, filename splittingpins-panel.test.tsx(22 tests) +agent-history-detail-tabs.test.tsx(9 tests) green before and afterNext run
Queued:
release-admin.tsx(ReleaseAdmin, 647 lines) — now the largest component inapps/web.🤖 Generated with Claude Code