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(settings): only allow sidebar collapse at narrow widths (#8013)

teo4f90e8875d70
diff --git a/apps/web/src/components/view-shell/ViewShell.test.tsx b/apps/web/src/components/view-shell/ViewShell.test.tsx
index fc6ea044f4..8e93702091 100644
--- a/apps/web/src/components/view-shell/ViewShell.test.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.test.tsx
@@ -273,6 +273,7 @@ describe('ViewShell aside resize preference', () => {
function Workspace(props: {
app: string;
asideRequired?: boolean;
+ asidePinned?: boolean;
mounted?: () => void;
}) {
function Content() {
@@ -284,6 +285,7 @@ function Workspace(props: {
<ViewShell.Root
asidePreferenceKey={props.app}
asideRequired={props.asideRequired}
+ asidePinned={props.asidePinned}
>
<ViewShell.Aside>
<ViewSidebar.Header>
@@ -392,12 +394,52 @@ it('reopens automatic narrow collapse as a dismissible overlay', () => {
).toBeNull();
});
-describe('required navigation', () => {
- const asideDocked = () =>
- !document
- .querySelector('[data-view-shell-aside]')!
- .parentElement!.classList.contains('hidden');
+const asideDocked = () =>
+ !document
+ .querySelector('[data-view-shell-aside]')!
+ .parentElement!.classList.contains('hidden');
+
+describe('pinned navigation', () => {
+ it('docks wide navigation without a collapse control, even when saved hidden', () => {
+ const unpinned = render(() => <Workspace app="settings" />);
+ fireEvent.click(screen.getByRole('button', { name: 'Hide navigation' }));
+ expect(asideDocked()).toBe(false);
+ unpinned.unmount();
+
+ render(() => <Workspace app="settings" asidePinned />);
+ expect(asideDocked()).toBe(true);
+ expect(
+ screen.queryByRole('button', { name: 'Hide navigation' })
+ ).toBeNull();
+ expect(
+ screen.queryByRole('button', { name: 'Show navigation' })
+ ).toBeNull();
+ });
+
+ it('collapses only into the narrow overlay, which starts closed', () => {
+ const [width, setWidth] = createSignal(1000);
+ measurement.width = width;
+ render(() => <Workspace app="settings" asidePinned />);
+
+ setWidth(600);
+ expect(
+ screen.queryByRole('button', { name: 'Close navigation backdrop' })
+ ).toBeNull();
+ fireEvent.click(screen.getByRole('button', { name: 'Show navigation' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Hide navigation' }));
+ expect(
+ screen.queryByRole('button', { name: 'Close navigation backdrop' })
+ ).toBeNull();
+ setWidth(1000);
+ expect(asideDocked()).toBe(true);
+ expect(
+ screen.queryByRole('button', { name: 'Hide navigation' })
+ ).toBeNull();
+ });
+});
+
+describe('required navigation', () => {
it('docks a hidden wide sidebar without a collapse control until a selection returns', () => {
const [required, setRequired] = createSignal(false);
render(() => <Workspace app="channels" asideRequired={required()} />);
diff --git a/apps/web/src/components/view-shell/ViewShell.tsx b/apps/web/src/components/view-shell/ViewShell.tsx
index 05529c47e8..65a6b3bb4e 100644
--- a/apps/web/src/components/view-shell/ViewShell.tsx
+++ b/apps/web/src/components/view-shell/ViewShell.tsx
@@ -144,6 +144,13 @@ export type ViewShellRootProps = Omit<
* open the overlay, which stays dismissible.
*/
asideRequired?: boolean;
+ /**
+ * Keep navigation docked in wide layouts, for views that are unusable
+ * without it. Like `asideRequired`, it withholds the collapse control and
+ * ignores the saved preference there; narrow layouts still start with the
+ * overlay closed.
+ */
+ asidePinned?: boolean;
main?: Partial<MainLayout>;
detail?: Partial<DetailLayout>;
/** Controlled detail open state. Omit for uncontrolled. */
@@ -168,6 +175,7 @@ function Root(props: ViewShellRootProps) {
'aside',
'asidePreferenceKey',
'asideRequired',
+ 'asidePinned',
'main',
'detail',
'detailOpen',
@@ -252,7 +260,8 @@ function Root(props: ViewShellRootProps) {
);
// Only a docked aside can be pinned open: a pinned overlay would hide Main
// behind a backdrop with no way to dismiss it.
- const asidePinned = () => asideRequired() && !atLayoutBreakpoint();
+ const asidePinned = () =>
+ (asideRequired() || (local.asidePinned ?? false)) && !atLayoutBreakpoint();
const asideMode = (): AsideMode =>
local.aside === false ||
diff --git a/apps/web/src/features/settings/Settings.tsx b/apps/web/src/features/settings/Settings.tsx
index d40282f386..bbbc0964c8 100644
--- a/apps/web/src/features/settings/Settings.tsx
+++ b/apps/web/src/features/settings/Settings.tsx
@@ -231,6 +231,7 @@ export function SettingsPanel(props: SettingsPanelProps) {
<SplitPanel.Body>
<ViewShell.Root
asidePreferenceKey="settings"
+ asidePinned
resizable
aside={{ preserveDuringResize: false }}
main={{ preferredWidth: 960 }}
diff --git a/docs/AGENT_GUIDE/navigation.md b/docs/AGENT_GUIDE/navigation.md
index 7f03773972..d77f72ca63 100644
--- a/docs/AGENT_GUIDE/navigation.md
+++ b/docs/AGENT_GUIDE/navigation.md
@@ -269,6 +269,8 @@ Shrinking again starts with the overlay closed. Chat is the exception while no
conversation is selected: its navigation stays docked with no **Hide
navigation** control, and narrow Chat opens the overlay on its own (see
[Chat navigation rail](channels.md#chat-navigation-rail)).
+Settings navigation always stays docked at desktop width with no **Hide
+navigation** control; only its narrow overlay opens and closes.
The overlay never contains the split's **Close** button. Mobile keeps
its existing navigation controls. Block detail panels (including Calendar) have
**Hide side panel** in their own header and a hamburger **Show side panel** beside
diff --git a/docs/AGENT_GUIDE/surfaces.md b/docs/AGENT_GUIDE/surfaces.md
index 804934952a..1376bd11e9 100644
--- a/docs/AGENT_GUIDE/surfaces.md
+++ b/docs/AGENT_GUIDE/surfaces.md
@@ -2387,10 +2387,12 @@ split view: the rail's gear button (or `Ctrl ;`) opens it in the active split
like any other rail item, and Shift-click opens it in a new split.
`/app/settings/<tab>` opens it as the only split with the app rail still
visible, and `/app/home/~/settings/<tab>` places it beside Home. Its inner
-sidebar matches Email and Tasks: a **Settings** title bar with the
-**Hide navigation** toggle (`Cmd .`), a rounded **Search settings** field, the
-grouped section pills, and **Log out** pinned to the bottom. Below 720px the
-sidebar becomes an overlay opened from **Show navigation**. Escape closes a
+sidebar matches Email and Tasks: a **Settings** title bar, a rounded
+**Search settings** field, the grouped section pills, and **Log out** pinned to
+the bottom. Unlike other views, it cannot be hidden at desktop widths: there is
+no **Hide navigation** toggle and `Cmd .` does nothing, even if it was hidden
+before. Below 720px the sidebar becomes an overlay opened from **Show
+navigation** (or `Cmd .`), which starts closed. Escape closes a
settings split that shares the layout, or steps back to the previous view when
it is the only split (Home when there is none). Leave settings by picking any
other rail item; there is no separate back or fullscreen control.