Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions frontend/src/v2/__tests__/V2LayoutSelection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,37 @@ describe('V2Layout default pod selection', () => {
expect(phoneViewport.addEventListener).toHaveBeenCalledWith('change', expect.any(Function));
});

test.each([
[390, null, false],
[1199, null, false],
[1200, null, true],
[1440, null, true],
[1440, '1', false],
[1199, '0', true],
])('inspector visibility at %ipx with stored preference %s is %s', (width, preference, visible) => {
Object.defineProperty(window, 'matchMedia', {
configurable: true,
writable: true,
value: jest.fn((query: string) => ({
matches: query === '(max-width: 760px)' ? Number(width) <= 760 : Number(width) >= 1200,
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
})),
});
if (preference !== null) localStorage.setItem('v2.inspectorCollapsed', String(preference));

render(
<MemoryRouter initialEntries={['/v2/pods/workspace']}>
<Routes>
<Route path="/v2/pods/:podId" element={<V2Layout selectionMode="param" />} />
</Routes>
</MemoryRouter>,
);

expect(screen.queryByTestId('workspace-inspector') !== null).toBe(visible);
expect(localStorage.getItem('v2.inspectorCollapsed')).toBe(preference);
});

test('lands a new user in their oldest own workspace instead of auto-joined HQ', async () => {
renderAutoLayout();

Expand Down
10 changes: 5 additions & 5 deletions frontend/src/v2/components/V2Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ const isPhoneViewport = (): boolean => (
const readInspectorCollapsed = (): boolean => {
try {
const v = localStorage.getItem(INSPECTOR_PREF_KEY);
// Default to collapsed — pod chat reads better when the third column is
// out of the way until you ask for it. See user feedback 2026-04-30.
if (v === null) return true;
return v === '1';
if (v !== null) return v === '1';
} catch {
return true;
// Unavailable storage uses the same default as a fresh session.
}
// The artboard opens the desktop inspector by default; narrower viewports
// keep it closed until requested. Explicit preferences take precedence.
return !(typeof window !== 'undefined' && window.matchMedia?.('(min-width: 1200px)').matches);
};

const writeInspectorCollapsed = (next: boolean) => {
Expand Down
Loading