The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): Review scope tabs get their own row and a narrow dropdown
Brooklyn Nicholsonb4bf19d8148a
diff --git a/apps/desktop/src/app/right-sidebar/review/index.test.tsx b/apps/desktop/src/app/right-sidebar/review/index.test.tsxindex 5b9d4e8bc90..6ad118a0170 100644--- a/apps/desktop/src/app/right-sidebar/review/index.test.tsx+++ b/apps/desktop/src/app/right-sidebar/review/index.test.tsx@@ -1,5 +1,5 @@import { cleanup, fireEvent, render, screen } from '@testing-library/react'-import { afterEach, beforeEach, describe, expect, it } from 'vitest'+import { afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest'import type { HermesReviewFile } from '@/global'import { I18nProvider } from '@/i18n'@@ -18,6 +18,13 @@ import { ReviewPane } from './index'const file = (path: string): HermesReviewFile => ({ added: 1, path, removed: 0, staged: false, status: 'M' })+// Radix menus use pointer capture and scrollIntoView; jsdom has neither.+beforeAll(() => {+ Element.prototype.hasPointerCapture ??= () => false+ Element.prototype.releasePointerCapture ??= () => undefined+ Element.prototype.scrollIntoView ??= () => undefined+})+function renderPane() {return render(<I18nProvider configClient={null} initialLocale="en">@@ -60,15 +67,25 @@ describe('ReviewPane header gating', () => {expect((screen.getByLabelText('Revert all') as HTMLButtonElement).disabled).toBe(true)})- it('renders the three scope options and switches scope on selection', () => {+ it('renders the three scope tabs and switches scope on selection', () => {renderPane()- expect(screen.getByText('Uncommitted')).toBeTruthy()- expect(screen.getByText('Branch')).toBeTruthy()- expect(screen.getByText('Last turn')).toBeTruthy()+ expect(screen.getByRole('button', { name: 'Uncommitted', pressed: true })).toBeTruthy()+ expect(screen.getByRole('button', { name: 'Last turn', pressed: false })).toBeTruthy()- fireEvent.click(screen.getByText('Branch'))+ fireEvent.click(screen.getByRole('button', { name: 'Branch', pressed: false }))expect($reviewScope.get()).toBe('branch')})++ it('narrow-pane dropdown names the active scope and switches it', () => {+ $reviewScope.set('lastTurn')+ renderPane()++ const trigger = screen.getByRole('button', { name: 'Last turn', expanded: false })+ fireEvent.keyDown(trigger, { key: 'Enter' })+ fireEvent.click(screen.getByRole('menuitem', { name: 'Uncommitted' }))++ expect($reviewScope.get()).toBe('uncommitted')+ })})diff --git a/apps/desktop/src/app/right-sidebar/review/index.tsx b/apps/desktop/src/app/right-sidebar/review/index.tsxindex d9bf29a7971..5ddf8373cdc 100644--- a/apps/desktop/src/app/right-sidebar/review/index.tsx+++ b/apps/desktop/src/app/right-sidebar/review/index.tsx@@ -6,9 +6,7 @@ import { Button } from '@/components/ui/button'import { Codicon } from '@/components/ui/codicon'import { ConfirmDialog } from '@/components/ui/confirm-dialog'import { DiffCount } from '@/components/ui/diff-count'-import { SegmentedControl } from '@/components/ui/segmented-control'import { Tip } from '@/components/ui/tooltip'-import type { HermesReviewScope } from '@/global'import { useDelayedTrue } from '@/hooks/use-delayed-true'import { useI18n } from '@/i18n'import { displayPath } from '@/lib/display-path'@@ -40,6 +38,7 @@ import { SidebarPanelLabel } from '../../shell/sidebar-label'import { PaneEmptyState, RightSidebarSectionHeader } from '../index'import { ReviewFileTree } from './file-tree'+import { ReviewScopeRow } from './scope-row'import { ReviewShipBar } from './ship-bar'// Compact header/diff action buttons — micro hit targets packed tight, matching@@ -65,6 +64,8 @@ export function ReviewPane() {const selectedFile = files.find(file => file.path === selectedPath)const hasFiles = files.length > 0+ // A repo (or a load that may reveal one) gets the header + scope chrome.+ const showChrome = loading || isRepo// `{ path: null }` → revert all; `{ path: '…' }` → revert one file.const revertingAll = revertTarget?.path == null// Delay the skeletons so fast loads (most project switches) just blank → content@@ -82,27 +83,13 @@ export function ReviewPane() {: 'border-l shadow-[inset_0.0625rem_0_0_color-mix(in_srgb,white_18%,transparent)]')}>- {(loading || isRepo) && (+ {showChrome && (<RightSidebarSectionHeader data-suppress-pane-reveal-side=""><div className="flex min-w-0 flex-1">{/* Pure self-naming label — redundant under a zone tab that alreadysays "review", so the zone header hides it (styles.css). */}<SidebarPanelLabel data-pane-self-label="">{c.review}</SidebarPanelLabel></div>- <SegmentedControl<HermesReviewScope>- className="mr-1"- onChange={id => {- $reviewScope.set(id)- clearReviewSelection()- void refreshReview()- }}- options={[- { id: 'uncommitted', label: c.scopeUncommitted },- { id: 'branch', label: c.scopeBranch },- { id: 'lastTurn', label: c.scopeLastTurn }- ]}- value={scope}- /><Tip label={treeMode === 'tree' ? c.viewAsList : c.viewAsTree}><Buttonaria-label={treeMode === 'tree' ? c.viewAsList : c.viewAsTree}@@ -156,7 +143,9 @@ export function ReviewPane() {</RightSidebarSectionHeader>)}- {loading || isRepo ? (+ {showChrome && <ReviewScopeRow />}++ {showChrome ? (hasFiles ? (<ReviewFileTree />) : showTreeSkeleton ? (diff --git a/apps/desktop/src/app/right-sidebar/review/scope-row.tsx b/apps/desktop/src/app/right-sidebar/review/scope-row.tsxnew file mode 100644index 00000000000..6540aa1b4ee--- /dev/null+++ b/apps/desktop/src/app/right-sidebar/review/scope-row.tsx@@ -0,0 +1,51 @@+import { useStore } from '@nanostores/react'++import { SegmentedControl } from '@/components/ui/segmented-control'+import { TabDropdown } from '@/components/ui/tab-dropdown'+import type { HermesReviewScope } from '@/global'+import { useI18n } from '@/i18n'+import { $reviewScope, clearReviewSelection, refreshReview } from '@/store/review'++function selectScope(id: HermesReviewScope) {+ $reviewScope.set(id)+ clearReviewSelection()+ void refreshReview()+}++/** Scope switcher row under the Review header. Label + tabs + icons can't share+ * the 28px header in a pane that narrows to 10rem, so the tabs get their own+ * row; below their natural width it collapses to the app's narrow-width tab+ * dropdown rather than ellipsizing every option. */+export function ReviewScopeRow() {+ const { t } = useI18n()+ const c = t.statusStack.coding+ const scope = useStore($reviewScope)++ const options: { id: HermesReviewScope; label: string }[] = [+ { id: 'uncommitted', label: c.scopeUncommitted },+ { id: 'branch', label: c.scopeBranch },+ { id: 'lastTurn', label: c.scopeLastTurn }+ ]++ return (+ <div className="@container shrink-0 px-2 pb-1.5" data-suppress-pane-reveal-side="">+ <SegmentedControl<HermesReviewScope>+ className="hidden w-full auto-cols-[minmax(0,auto)] @[13.5rem]:grid [&>button]:px-2"+ onChange={selectScope}+ options={options}+ value={scope}+ />+ <div className="flex h-[1.5625rem] items-center pl-1.5 @[13.5rem]:hidden">+ <TabDropdown+ align="start"+ items={options.map(option => ({+ active: option.id === scope,+ id: option.id,+ label: option.label,+ onSelect: () => selectScope(option.id)+ }))}+ />+ </div>+ </div>+ )+}