Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(chat): keep the sidebar view name from collapsing (#9092)

Wolf Mermelstein95daeea4a330
diff --git a/apps/web/AGENTS.md b/apps/web/AGENTS.md
index 8ce61c1ada..15f35a02bb 100644
--- a/apps/web/AGENTS.md
+++ b/apps/web/AGENTS.md
@@ -20,6 +20,10 @@ During iterative visual tweaks, use focused browser verification; defer full typ
Any user-visible change should be exercised in a browser before you call it fixed — type-check, biome, and vitest all pass on code that still has the interaction bug.
+Desktop sidebar view titles staying whole at a typical rail width have a
+backend-free regression:
+`bunx playwright test --config src/components/view-shell/browser-test/playwright.config.ts sidebar-title.browser.e2e.ts`.
+
Agent image attachments preserve external and inline image URLs; only configured
static-file endpoints receive thumbnail sizing. The backend-free regression is
`bunx playwright test --config src/features/block-agent/browser-test/attachments.playwright.config.ts`.
diff --git a/apps/web/src/components/app/sidebar-next/view-switcher.tsx b/apps/web/src/components/app/sidebar-next/view-switcher.tsx
index edc0e69bca..17dcffbd59 100644
--- a/apps/web/src/components/app/sidebar-next/view-switcher.tsx
+++ b/apps/web/src/components/app/sidebar-next/view-switcher.tsx
@@ -80,12 +80,15 @@ export function ViewSwitcher(props: ViewSwitcherProps) {
</Dropdown.Item>
);
+ // Size to the view name so short labels stay whole. Cap with `max-w-full`
+ // only when the title row has a real width; a percentage `calc` treats an
+ // indefinite parent as 0 and collapses "Chat" to "C…".
return (
<Dropdown placement="bottom-start">
<Dropdown.Trigger
variant="ghost"
size="sm"
- class="-ml-2 min-w-0 max-w-[calc(100%+0.5rem)] shrink"
+ class="-ml-2 w-max min-w-0 max-w-full"
data-view-switcher=""
>
<span class="truncate text-sm font-semibold tracking-[-0.03em] text-ink">
diff --git a/apps/web/src/components/view-shell/ViewSidebar.tsx b/apps/web/src/components/view-shell/ViewSidebar.tsx
index 7b67f64ad7..23475e1a54 100644
--- a/apps/web/src/components/view-shell/ViewSidebar.tsx
+++ b/apps/web/src/components/view-shell/ViewSidebar.tsx
@@ -77,7 +77,7 @@ function Header(
)}
data-view-sidebar-header=""
>
- {local.children}
+ <div class="min-w-0 flex-1">{local.children}</div>
<div class="ml-auto flex shrink-0 items-center gap-1">
{local.actions}
<Show when={!isTouchDevice() && local.search}>
@@ -141,7 +141,7 @@ function Title(
<h1
{...rest}
class={cn(
- 'flex min-w-0 items-center text-sm font-semibold tracking-[-0.03em] text-ink',
+ 'flex min-w-0 max-w-full flex-1 items-center text-sm font-semibold tracking-[-0.03em] text-ink',
local.class
)}
>
diff --git a/apps/web/src/components/view-shell/browser-test/playwright.config.ts b/apps/web/src/components/view-shell/browser-test/playwright.config.ts
index fef5b97ed4..7d18bfd883 100644
--- a/apps/web/src/components/view-shell/browser-test/playwright.config.ts
+++ b/apps/web/src/components/view-shell/browser-test/playwright.config.ts
@@ -8,7 +8,13 @@ export default defineConfig({
testMatch: '*.browser.e2e.ts',
workers: 1,
timeout: 60000,
- use: { baseURL: `http://localhost:${port}`, headless: true },
+ use: {
+ baseURL: `http://localhost:${port}`,
+ headless: true,
+ launchOptions: {
+ executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,
+ },
+ },
webServer: {
command: `MACRO_DEV_HTTPS=false bunx vite --port ${port} --strictPort`,
cwd: webDirectory,
diff --git a/apps/web/src/components/view-shell/browser-test/sidebar-title.browser.e2e.ts b/apps/web/src/components/view-shell/browser-test/sidebar-title.browser.e2e.ts
new file mode 100644
index 0000000000..36e6be2912
--- /dev/null
+++ b/apps/web/src/components/view-shell/browser-test/sidebar-title.browser.e2e.ts
@@ -0,0 +1,26 @@
+import { expect, test } from '@playwright/test';
+
+const fixture = '/src/components/view-shell/browser-test/sidebar-title.html';
+
+test('keeps the Chat sidebar title whole at a typical rail width', async ({
+ page,
+}) => {
+ await page.setViewportSize({ width: 1280, height: 800 });
+ const pageErrors: string[] = [];
+ page.on('pageerror', (error) => pageErrors.push(error.message));
+ await page.goto(fixture, { waitUntil: 'networkidle' });
+ if (pageErrors.length) {
+ throw new Error(pageErrors.join('\n'));
+ }
+ const trigger = page.getByRole('button', { name: 'Chat' });
+ await expect(trigger).toBeVisible();
+ await expect(trigger).toHaveText(/Chat/);
+ const box = await trigger.boundingBox();
+ expect(box).toBeTruthy();
+ expect(box!.width).toBeGreaterThan(48);
+ const overflow = await trigger.evaluate((el) => {
+ const label = el.querySelector('span');
+ return label ? label.scrollWidth - label.clientWidth : 0;
+ });
+ expect(overflow).toBeLessThanOrEqual(1);
+});
diff --git a/apps/web/src/components/view-shell/browser-test/sidebar-title.html b/apps/web/src/components/view-shell/browser-test/sidebar-title.html
new file mode 100644
index 0000000000..aedb1eaef3
--- /dev/null
+++ b/apps/web/src/components/view-shell/browser-test/sidebar-title.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <title>Sidebar view title</title>
+ </head>
+ <body>
+ <div id="root"></div>
+ <script type="module" src="./sidebar-title.tsx"></script>
+ </body>
+</html>
diff --git a/apps/web/src/components/view-shell/browser-test/sidebar-title.tsx b/apps/web/src/components/view-shell/browser-test/sidebar-title.tsx
new file mode 100644
index 0000000000..7ee9591494
--- /dev/null
+++ b/apps/web/src/components/view-shell/browser-test/sidebar-title.tsx
@@ -0,0 +1,55 @@
+import '@app/index.css';
+import { AnalyticsContextProvider } from '@app/lib/analytics/analytics-context';
+import { PosthogProvider } from '@app/lib/analytics/posthog';
+import { SidebarPrefsProvider } from '@components/app/sidebar-next/use-sidebar-prefs';
+import { ViewSwitcher } from '@components/app/sidebar-next/view-switcher';
+import {
+ SplitPanelContext,
+ type SplitPanelContextType,
+} from '@components/app/split-layout/context';
+import { createSignal } from 'solid-js';
+import { render } from 'solid-js/web';
+import { ViewSidebar, ViewSwitcherContext } from '../ViewSidebar';
+
+function Fixture() {
+ const [content, setContent] = createSignal({
+ type: 'component',
+ id: 'chat',
+ });
+ const panel = {
+ handle: {
+ content,
+ setContent,
+ isPopover: () => false,
+ },
+ } as unknown as SplitPanelContextType;
+
+ return (
+ <AnalyticsContextProvider>
+ <PosthogProvider>
+ <SidebarPrefsProvider>
+ <SplitPanelContext.Provider value={panel}>
+ <ViewSwitcherContext.Provider value={ViewSwitcher}>
+ <div class="min-h-screen bg-page p-8 text-ink">
+ <aside class="w-[280px] rounded-xl border border-edge-muted bg-panel">
+ <ViewSidebar.Header
+ searchLabel="Search conversations"
+ search={() => (
+ <input aria-label="Search conversations" class="w-full" />
+ )}
+ >
+ <div class="flex min-w-0 items-center gap-1">
+ <ViewSidebar.Title>Chat</ViewSidebar.Title>
+ </div>
+ </ViewSidebar.Header>
+ </aside>
+ </div>
+ </ViewSwitcherContext.Provider>
+ </SplitPanelContext.Provider>
+ </SidebarPrefsProvider>
+ </PosthogProvider>
+ </AnalyticsContextProvider>
+ );
+}
+
+render(() => <Fixture />, document.getElementById('root')!);
diff --git a/docs/agent-guide/navigation.md b/docs/agent-guide/navigation.md
index 365e8691a0..b0280a2fa5 100644
--- a/docs/agent-guide/navigation.md
+++ b/docs/agent-guide/navigation.md
@@ -376,7 +376,7 @@ A desktop view's name opens the view switcher: clicking it shows the rail's apps
in rail order, then the More apps, with a check on the current one. Choosing one
replaces the view in that split, not the active split; Shift opens it in a new
split. The navigation panel's title shows the name with a caret, sharing one
-hover background. Main headers show the name alone, with the same hover:
+hover background. Short names stay whole; long names ellipsize. Main headers show the name alone, with the same hover:
`ViewSidebar.Title caret={false}` for plain titles, and the first breadcrumb
(Drive, Email, Tasks, Reviews) while it is the current page; deeper, that crumb
returns to the list. Titles that name content rather than the view (Calendar's