diff --git a/cptr/frontend/src/lib/stores.ts b/cptr/frontend/src/lib/stores.ts index 1bae2c9..7715e10 100644 --- a/cptr/frontend/src/lib/stores.ts +++ b/cptr/frontend/src/lib/stores.ts @@ -119,8 +119,17 @@ export const workspaceList = writable<{ path: string; name: string }[]>([]); /** Global user preferences. */ export const sidebarOpen = writable( - typeof window !== 'undefined' ? window.innerWidth >= 768 : false + typeof window !== 'undefined' ? window.innerWidth >= 1024 : false ); + +// Auto-close sidebar when window is resized below mobile breakpoint +if (typeof window !== 'undefined') { + window.addEventListener('resize', () => { + if (window.innerWidth < 768) { + sidebarOpen.set(false); + } + }); +} export const sidebarWidth = writable(220); export const theme = writable('dark'); export const toolApprovalMode = writable('auto');