@@ -34,6 +34,7 @@ import {
3434 getPaneFocusShortcut ,
3535 isCommandPaletteShortcut ,
3636 isEditorFindShortcut ,
37+ isFocusModeShortcut ,
3738 isNotesSearchShortcut ,
3839 isSidebarToggleShortcut ,
3940} from "@/shared/lib/keyboard" ;
@@ -85,7 +86,9 @@ function App() {
8586
8687 const setSettingsOpen = useUIStore ( ( s ) => s . setSettingsOpen ) ;
8788 const sidebarVisible = useUIStore ( ( s ) => s . sidebarVisible ) ;
89+ const notesPanelVisible = useUIStore ( ( s ) => s . notesPanelVisible ) ;
8890 const toggleSidebar = useUIStore ( ( s ) => s . toggleSidebar ) ;
91+ const toggleFocusMode = useUIStore ( ( s ) => s . toggleFocusMode ) ;
8992 const setFocusedPane = useShellStore ( ( s ) => s . setFocusedPane ) ;
9093
9194 const openCommandPalette = useEffectEvent ( ( ) => {
@@ -123,11 +126,23 @@ function App() {
123126 return ;
124127 }
125128
129+ if ( isFocusModeShortcut ( event ) ) {
130+ event . preventDefault ( ) ;
131+ event . stopPropagation ( ) ;
132+ event . stopImmediatePropagation ( ) ;
133+ toggleFocusMode ( ) ;
134+ return ;
135+ }
136+
126137 if ( isSidebarToggleShortcut ( event ) ) {
127138 event . preventDefault ( ) ;
128139 event . stopPropagation ( ) ;
129140 event . stopImmediatePropagation ( ) ;
130- toggleSidebar ( ) ;
141+ if ( useUIStore . getState ( ) . notesPanelVisible ) {
142+ toggleSidebar ( ) ;
143+ } else {
144+ toggleFocusMode ( ) ;
145+ }
131146 return ;
132147 }
133148
@@ -291,11 +306,7 @@ function App() {
291306 data-tauri-drag-region
292307 />
293308 ) : null }
294- < Container
295- className = "h-full w-full"
296- id = "comet-shell"
297- key = { sidebarVisible ? "s" : "h" }
298- >
309+ < Container className = "h-full w-full" id = "comet-shell" >
299310 { sidebarVisible ? (
300311 < >
301312 < Section
@@ -314,21 +325,25 @@ function App() {
314325 </ >
315326 ) : null }
316327
317- < Section
318- defaultSize = { 280 }
319- disableResponsive
320- maxSize = { 340 }
321- minSize = { 220 }
322- className = "select-none"
323- >
324- < NotesPane { ...notesPaneProps } />
325- </ Section >
328+ { notesPanelVisible ? (
329+ < >
330+ < Section
331+ defaultSize = { 280 }
332+ disableResponsive
333+ maxSize = { 340 }
334+ minSize = { 220 }
335+ className = "select-none"
336+ >
337+ < NotesPane { ...notesPaneProps } />
338+ </ Section >
326339
327- < Bar
328- className = "bg-accent/35 z-30 cursor-col-resize"
329- expandInteractiveArea = { { left : 5 , right : 5 } }
330- size = { 1 }
331- />
340+ < Bar
341+ className = "bg-accent/35 z-30 cursor-col-resize"
342+ expandInteractiveArea = { { left : 5 , right : 5 } }
343+ size = { 1 }
344+ />
345+ </ >
346+ ) : null }
332347
333348 < Section minSize = { 300 } >
334349 < EditorPane { ...editorPaneProps } />
0 commit comments