diff --git a/frontend/src/v2/__tests__/V2LayoutSelection.test.tsx b/frontend/src/v2/__tests__/V2LayoutSelection.test.tsx index 52ca5fb54d..461cc5d49d 100644 --- a/frontend/src/v2/__tests__/V2LayoutSelection.test.tsx +++ b/frontend/src/v2/__tests__/V2LayoutSelection.test.tsx @@ -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( + + + } /> + + , + ); + + 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(); diff --git a/frontend/src/v2/components/V2Layout.tsx b/frontend/src/v2/components/V2Layout.tsx index 9f5ff70198..4c9fa147a8 100644 --- a/frontend/src/v2/components/V2Layout.tsx +++ b/frontend/src/v2/components/V2Layout.tsx @@ -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) => {