Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
refactor(agents-view): remove left padding from agent sidebar rows (#8025)
Jacob Beckerman728a181f4750
diff --git a/apps/web/src/features/agents-view/components/AgentSessionCodeDetails.tsx b/apps/web/src/features/agents-view/components/AgentSessionCodeDetails.tsxindex 38430aaa66..050b4f6072 100644--- a/apps/web/src/features/agents-view/components/AgentSessionCodeDetails.tsx+++ b/apps/web/src/features/agents-view/components/AgentSessionCodeDetails.tsx@@ -2,6 +2,7 @@ import GitBranchIcon from '@phosphor/git-branch.svg';import GitMergeIcon from '@phosphor/git-merge.svg';import GitPullRequestIcon from '@phosphor/git-pull-request.svg';import { cn } from '@ui';+import type { JSX } from 'solid-js';import { Show } from 'solid-js';import { match } from 'ts-pattern';import type { SessionCodeDetails } from '../core/session-code-details';@@ -9,6 +10,8 @@ import type { SessionCodeDetails } from '../core/session-code-details';export function AgentSessionCodeDetails(props: {details: SessionCodeDetails;onOpenPullRequest?: (event: MouseEvent) => void;+ /** Status indicator to render at the start of the details line. */+ statusIndicator?: JSX.Element;}) {const context = () =>[props.details.repository, props.details.branch]@@ -33,6 +36,7 @@ export function AgentSessionCodeDetails(props: {data-agent-code-detailsclass="flex min-w-0 items-center gap-1.5 text-xs leading-4 text-ink-extra-muted">+ {props.statusIndicator}<Show when={props.details.pullRequest}>{(pr) => (<adiff --git a/apps/web/src/features/agents-view/components/AgentSessionRow.tsx b/apps/web/src/features/agents-view/components/AgentSessionRow.tsxindex 0fb7a79d85..55509f6180 100644--- a/apps/web/src/features/agents-view/components/AgentSessionRow.tsx+++ b/apps/web/src/features/agents-view/components/AgentSessionRow.tsx@@ -17,6 +17,8 @@ export function AgentSessionRow(props: {timestamp: string;unread?: boolean;active?: boolean;+ /** When true, hides the leading icon slot to save horizontal space. */+ hideLeading?: boolean;children?: JSX.Element;onOpen?: (event: MouseEvent) => void;}) {@@ -28,7 +30,8 @@ export function AgentSessionRow(props: {class={cn('relative text-ink',metadata.toArray().length > 0 &&- 'h-auto min-h-12 items-start py-1.5 touch:h-auto'+ 'h-auto min-h-12 items-start py-1.5 touch:h-auto',+ props.hideLeading && 'pl-3')}data-agent-session-row={props.id}data-kind={props.kind}@@ -47,9 +50,11 @@ export function AgentSessionRow(props: {aria-current={props.active ? 'page' : undefined}{...pressHandlers((event) => props.onOpen?.(event))}/>- <ViewSidebar.Icon class="pointer-events-none relative text-ink-muted">- {props.leading}- </ViewSidebar.Icon>+ <Show when={!props.hideLeading}>+ <ViewSidebar.Icon class="pointer-events-none relative text-ink-muted">+ {props.leading}+ </ViewSidebar.Icon>+ </Show><span class="pointer-events-none relative min-w-0 flex-1"><span class="flex min-w-0 items-center gap-2"><span class="min-w-0 flex-1 truncate">{props.title}</span>diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsxindex 8c083e7f7c..82ffa30e27 100644--- a/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.test.tsx@@ -419,7 +419,11 @@ describe.each(['home', 'sidebar'] as const)('%s agent rows', (surface) => {view.container.querySelector('[data-agent-session-row] [data-view-sidebar-icon]');- expect(icon()?.querySelector('svg') !== null).toBe(surface === 'home');+ if (surface === 'home') {+ expect(icon()?.querySelector('svg') !== null).toBe(true);+ } else {+ expect(icon()).toBeNull();+ }expect(view.container.querySelector('[data-agent-status-indicator]')).toBeNull();@@ -429,7 +433,9 @@ describe.each(['home', 'sidebar'] as const)('%s agent rows', (surface) => {.getByRole('button', { name: 'Fix build' }).getAttribute('aria-description')).toBe('Working');- expect(icon()?.querySelector('svg') !== null).toBe(surface === 'home');+ if (surface === 'home') {+ expect(icon()?.querySelector('svg') !== null).toBe(true);+ }expect(view.container.querySelector('[data-agent-status-indicator]') !== null).toBe(surface === 'sidebar');@@ -445,6 +451,13 @@ describe.each(['home', 'sidebar'] as const)('%s agent rows', (surface) => {).toBeNull();});+ it('hides the leading icon slot in the sidebar for a tighter row', () => {+ if (surface !== 'sidebar') return;+ const { view } = setup();+ const row = view.container.querySelector('[data-agent-session-row]');+ expect(row?.querySelector('[data-view-sidebar-icon]')).toBeNull();+ });+it('does not claim an unsynced PR is open', () => {const { setEntity } = setup();setEntity({@@ -472,21 +485,27 @@ describe.each(['home', 'sidebar'] as const)('%s agent rows', (surface) => {expect(view.container.querySelector('[data-kind="code"]')).toBeTruthy();});- it('combines unread and activity in the Agents left dot while Home keeps its trailing unread dot', () => {+ it('combines unread and activity in the Agents dot while Home keeps its trailing unread dot', () => {unreadFilter.mockReturnValue(true);const { view, setEntity } = setup();const dot = () => screen.getByLabelText('Unread');- const isLeading = () => !!dot().closest('[data-view-sidebar-icon]');- expect(isLeading()).toBe(surface === 'sidebar');+ const isInCodeDetails = () => !!dot().closest('[data-agent-code-details]');+ const isTrailing = () =>+ !dot().closest('[data-view-sidebar-icon]') &&+ !dot().closest('[data-agent-code-details]');expect(dot().classList.contains('motion-safe:animate-pulse')).toBe(false);for (const turnState of ['running', 'blocked', 'idle']) {setEntity({ ...conversation, turnState });expect(screen.getAllByLabelText('Unread')).toHaveLength(1);- expect(isLeading()).toBe(surface === 'sidebar');expect(view.container.querySelectorAll('[data-agent-status-indicator]')).toHaveLength(surface === 'sidebar' ? 1 : 0);+ if (surface === 'sidebar') {+ expect(isInCodeDetails()).toBe(true);+ } else {+ expect(isTrailing()).toBe(true);+ }expect(dot().classList.contains('motion-safe:animate-pulse')).toBe(surface === 'sidebar' && turnState === 'running');diff --git a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx b/apps/web/src/features/agents-view/components/AgentsSidebar.tsxindex 205d0f91e2..6b1514653e 100644--- a/apps/web/src/features/agents-view/components/AgentsSidebar.tsx+++ b/apps/web/src/features/agents-view/components/AgentsSidebar.tsx@@ -21,7 +21,6 @@ import { MenuItem } from '@core/component/ContextMenu';import { useUserId } from '@core/context/user';import { isTouchDevice } from '@core/mobile/isTouchDevice';import { unreadFilterFn } from '@entity/utils/filter';-import ChatIcon from '@phosphor/chat-circle.svg';import RoutineIcon from '@phosphor/clock-clockwise.svg';import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';import PlugIcon from '@phosphor/plugs-connected.svg';@@ -136,10 +135,8 @@ function Row(props: {title={title()}data-kind="chat"onClick={props.onOpen}+ class="pl-3">- <ViewSidebar.Icon>- <ChatIcon />- </ViewSidebar.Icon><span class="min-w-0 flex-1 truncate">{title()}</span><span class="shrink-0 text-xs text-ink-extra-muted tabular-nums">{compactAge(conversationTimestamp(props.conversation))}diff --git a/apps/web/src/features/agents-view/views/AgentSessionListItem.tsx b/apps/web/src/features/agents-view/views/AgentSessionListItem.tsxindex b07f73d695..d677c3a5d0 100644--- a/apps/web/src/features/agents-view/views/AgentSessionListItem.tsx+++ b/apps/web/src/features/agents-view/views/AgentSessionListItem.tsx@@ -60,6 +60,16 @@ export function AgentSessionListItem(props: Props) {};};+ const hideLeading = () => props.surface === 'agents';+ const codeStatusIndicator = () =>+ props.surface === 'agents' && mode() === 'code' ? (+ <AgentSessionStatusIndicator state={state()} unread={props.unread} />+ ) : undefined;+ const workStatusIndicator = () =>+ props.surface === 'agents' && mode() !== 'code' ? (+ <AgentSessionStatusIndicator state={state()} unread={props.unread} />+ ) : undefined;+return (<AgentSessionRowid={props.entity.id}@@ -68,6 +78,7 @@ export function AgentSessionListItem(props: Props) {state={state()}active={props.active}unread={props.unread}+ hideLeading={hideLeading()}onOpen={props.onOpen}timestamp={compactAge(conversationTimestamp(props.entity))}leading={@@ -86,18 +97,22 @@ export function AgentSessionListItem(props: Props) {</Show>}trailing={- <Show when={props.surface === 'home' && props.unread}>- <span- aria-label="Unread"- class="size-1.5 shrink-0 rounded-full bg-accent"- />- </Show>+ <>+ <Show when={props.surface === 'home' && props.unread}>+ <span+ aria-label="Unread"+ class="size-1.5 shrink-0 rounded-full bg-accent"+ />+ </Show>+ {workStatusIndicator()}+ </>}><Show when={details()}>{(details) => (<AgentSessionCodeDetailsdetails={details()}+ statusIndicator={codeStatusIndicator()}onOpenPullRequest={props.entity.pullRequestId? (event) => {