feat(desktop): redesign the PR detail page header

Merged
AV
3mo ago
+222-150

Links

  • Reference: #6689 (source of the title/badge/metadata-row layout pattern)

Summary

  • Redesign the PR detail header: the title now renders as a large heading with a compact, muted metadata row below it (state pill, author avatar, #number, relative time, branch summary + copy button) instead of the old single dense icon+badge+actions row.
  • Move the external-GitHub-link, Merge/Close/Reopen dropdown, and "Add to workspace" actions into a small icon-row beside the title.
  • Keep the list-collapse toggle reachable via its own thin top row (matching the current Figma spec for this page), rather than inline with the title where it visually floated above the text.
  • Avatar falls back to initials when the GitHub avatar image 404s (e.g. bot/app-authored PRs like app/warp-agent-staging).

Why / Context

Follows the header pattern introduced in the reference PR #6689 ("PR review experience: split view, Code tab, comments"), applied here as a standalone, header-only change on top of the split-view foundation branch — the tab bar (Review/Summary/Code/Checks) from that reference isn't part of this PR.

How It Works

  • The header is three stacked rows inside one bordered container: (1) list-toggle strip, (2) title + icon-row actions, (3) muted metadata row.
  • State pill colors use this codebase's existing opacity-tinted Tailwind token system (bg-emerald-500/10 border-emerald-500/30 text-emerald-600 dark:text-emerald-400, etc.) rather than hardcoded Figma hex values, so it adapts correctly between light and dark instead of swapping to a different palette per theme.
  • Icon-row buttons standardized on the Button xs size token (28px); the state badge is an explicit h-6 (24px) — everything in the header now shares one consistent sizing scale.
  • The branch-name copy button reuses the existing useCopyToClipboard hook and the icon-swap/tooltip pattern from FileDiffHeader's copy-path button; it copies the head branch ref (not the full "head → base" display string), since that's the value someone would actually check out.
  • A minimal header (list-toggle only) still renders during loading/error/not-found states so the toggle stays reachable, mirroring the prior behavior.

Manual QA Checklist

  • Header renders correctly for Draft, Open (mergeable), Closed, and Merged PR states — pill color and dropdown contents (Merge/Close/Reopen, or hidden for merged) match state
  • External-GitHub-link button present and correctly linked
  • Merge/Close/Reopen dropdown opens; the confirm dialog opens and Cancel closes it without executing (never triggered an actual merge/close against a real PR)
  • "Add to workspace" button present and wired to the existing handler
  • List-collapse toggle stays reachable in a minimal header during loading/error states, and in its own row once the PR loads
  • Avatar falls back to initials when the GitHub avatar 404s
  • Branch-name copy button copies the head branch ref to the clipboard and shows a checkmark + "Copied!" tooltip
  • Verified in both light and dark theme
  • No console errors during any of the above interactions

Testing

  • bunx tsc --noEmit -p apps/desktop
  • bunx biome check apps/desktop/src/renderer/routes/_authenticated/_dashboard/pull-requests/\$prNumber/page.tsx
  • Manual: live CDP verification against the running dev app (real clicks/screenshots, not synthetic) — see Manual QA Checklist above

Design Decisions

  • Kept the existing <a>-tag external-link button instead of the reference PR's onClick={() => window.open(...)} pattern, to preserve standard middle-click/ctrl-click-to-open-in-new-tab behavior.
  • Reverted the state-badge palette from the reference PR's raw Figma hex values back to this codebase's existing opacity-tinted tokens after review feedback that the hardcoded colors looked washed out in light mode and didn't adapt well between themes.

Known Limitations

  • The tab bar (Review/Summary/Code/Checks) shown in the current Figma spec isn't implemented here — intentionally out of scope for this header-only change.

Follow-ups

  • Wire up the tab bar once Code/Checks/Review tabs land, and move the list-toggle top strip into that tab bar row per the Figma spec.

https://claude.ai/code/session_01UBriMdtL1Kpp67g1aQMTBH


Summary by cubic

Redesigns the PR detail header to a three-row layout for clarity and split-view consistency. The old single dense row becomes: a thin list toggle strip, a large title with a compact action row, and a muted metadata row. Toggle remains reachable while loading; merge/close/reopen behavior is unchanged, only repositioned.

  • Moves the GitHub link, Merge/Close/Reopen dropdown, and Add to workspace into a compact icon row beside the title; standardizes button sizing to the xs token.
  • Adds a metadata row: state pill with theme-aware tokens, author avatar with initials fallback, PR number, relative created time (handles “now” without “ago”), and a branch summary with a copy button that copies the head branch ref (owner:branch for cross-repo).
  • Fixes: copy button state no longer leaks when switching PRs (extracted CopyBranchButton keyed by PR number); tooltip and aria-label reflect copied state; guards NaN createdAt and empty PR URL.
  • Minimal header (toggle only) still renders during loading/error/not-found.
  • Out of scope: the Review/Summary/Code/Checks tab bar; this PR is header-only.