Skip to content

refactor: unify agent sidebar into generic tabbed panel with Git sub-views - #22837

Merged
kylecarbs merged 1 commit into
mainfrom
stevendanna/refactor-agent-sidebar-git-panel
Mar 9, 2026
Merged

kylecarbs merged 1 commit into
mainfrom
stevendanna/refactor-agent-sidebar-git-panel

Conversation

@kylecarbs

Copy link
Copy Markdown
Member

Summary

Refactors the right-side panel in the Agents page into a generic tabbed container with a unified Git panel.

Changes

Architecture

  • SidebarTabView is now a generic tabbed container with no git-specific logic, ready for additional tabs
  • All Git content lives in a new GitPanel component with an internal Remote/Local segmented control

Git Panel

  • Remote view: branch/PR diff via FilesChangedPanel
  • Local view: working tree changes with per-repo headers, commit & refresh actions
  • Split/unified diff toggle restored in the toolbar
  • DiffStatBadge rendered inside the Remote/Local segmented buttons (full-height, no rounding, inactive opacity 50%)

Visual polish

  • Active/inactive/hover states match the sidebar agent selection styles (bg-surface-quaternary/25, hover:bg-surface-tertiary/50)
  • Inactive tab text uses text-content-secondary (not primary)
  • Tab button sizing fixed: min-w-0 + px-2 to prevent inflated width
  • Chat title centered via absolute positioning when panel is fullscreen
  • Polished empty states with boxed icons (GitCompareArrowsIcon for Remote, FileDiffIcon for Local)
  • Unified header styles between Remote and Local sections (both use bg-surface-secondary with consistent icon/text sizing)
  • Panel toggle always visible in top bar (not gated on having diff data)

Cleanup

  • Removed dead code: DiffStatsInline, computeDiffStats export, workingDiffStats memo, ChatDiffStatusResponse import
  • Simplified RepoChangesPanel to a pure DiffViewer wrapper
  • Simplified TopBar to use a generic panel prop instead of diff-specific props

@DanielleMaywood DanielleMaywood 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.

Looks fine, will wait for chromatic to be visible before hitting green button

Comment on lines +945 to +962
// Compute local diff stats by counting +/- lines across all
// repository unified diffs.
const localDiffStats = useMemo(() => {
let additions = 0;
let deletions = 0;
for (const repo of gitWatcher.repositories.values()) {
const diff = repo.unified_diff;
if (!diff) continue;
for (const line of diff.split("\n")) {
if (line.startsWith("+") && !line.startsWith("+++")) {
additions++;
} else if (line.startsWith("-") && !line.startsWith("---")) {
deletions++;
}
}
}
return { additions, deletions };
}, [gitWatcher.repositories]);

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.

How reliable is this method?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Seems fine for now. All of this is ssomewhat janky, but I'll be fixing shortly.

@kylecarbs
kylecarbs force-pushed the stevendanna/refactor-agent-sidebar-git-panel branch from 25a4786 to 373c64b Compare March 9, 2026 14:00
? `ssh ${workspaceAgent.name}.${workspace.name}.${workspace.owner_name}.${sshConfigQuery.data.hostname_suffix}`
: undefined;
const shouldShowSidebar = (hasDiffStatus || hasGitRepos) && showSidebarPanel;
const shouldShowSidebar = showSidebarPanel;

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.

nit: unneeded

@kylecarbs
kylecarbs merged commit 3f93937 into main Mar 9, 2026
25 checks passed
@kylecarbs
kylecarbs deleted the stevendanna/refactor-agent-sidebar-git-panel branch March 9, 2026 14:44
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 9, 2026
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