@@ -55,6 +55,7 @@ import {
5555 FolderPlusIcon ,
5656 MessageSquareDashedIcon ,
5757 LinkIcon ,
58+ Maximize2Icon ,
5859 MessageSquareIcon ,
5960 MonitorIcon ,
6061 MoonIcon ,
@@ -125,11 +126,15 @@ import {
125126 resolveProjectPathForDispatch ,
126127} from "../lib/projectPaths" ;
127128import { onOpenCommandPalette } from "../commandPaletteBus" ;
129+ import { useMediaQuery } from "../hooks/useMediaQuery" ;
130+ import { RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY } from "../rightPanelLayout" ;
131+ import { dispatchToggleRightPanelMaximized } from "../rightPanelActionBus" ;
128132import { isPreviewFocused } from "../lib/previewFocus" ;
129133import { isTerminalFocused } from "../lib/terminalFocus" ;
130134import {
131135 PULL_REQUESTS_PANEL_REF ,
132136 selectActiveRightPanel ,
137+ selectThreadRightPanelState ,
133138 useRightPanelStore ,
134139} from "../rightPanelStore" ;
135140import { getLatestThreadForProject , sortThreads } from "../lib/threadSort" ;
@@ -739,6 +744,15 @@ function OpenCommandPaletteDialog(props: {
739744 const availableSettingsSearchItems = useAvailableSettingsSearchItems ( ) ;
740745 const { activeDraftThread, activeThread, defaultProjectRef, handleNewThread } =
741746 useHandleNewThread ( ) ;
747+ const panelThreadRef = activeThread
748+ ? scopeThreadRef ( activeThread . environmentId , activeThread . id )
749+ : activeDraftThread
750+ ? scopeThreadRef ( activeDraftThread . environmentId , activeDraftThread . threadId )
751+ : null ;
752+ const rightPanelOpen = useRightPanelStore (
753+ ( state ) => selectThreadRightPanelState ( state . byThreadKey , panelThreadRef ) . isOpen ,
754+ ) ;
755+ const rightPanelUsesSheet = useMediaQuery ( RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY ) ;
742756 const projects = useProjects ( ) ;
743757 const referenceThreadRef =
744758 pathname === "/pull-requests"
@@ -1880,6 +1894,20 @@ function OpenCommandPaletteDialog(props: {
18801894
18811895 const actionItems : Array < CommandPaletteActionItem | CommandPaletteSubmenuItem > = [ ] ;
18821896
1897+ if ( panelThreadRef !== null && rightPanelOpen && ! rightPanelUsesSheet ) {
1898+ actionItems . push ( {
1899+ kind : "action" ,
1900+ value : "action:toggle-right-panel-maximized" ,
1901+ searchTerms : [ "maximize" , "restore" , "panel" , "size" , "expand" ] ,
1902+ title : "Toggle right panel maximized" ,
1903+ icon : < Maximize2Icon className = { ITEM_ICON_CLASS } /> ,
1904+ shortcutCommand : "rightPanel.toggleMaximized" ,
1905+ run : async ( ) => {
1906+ dispatchToggleRightPanelMaximized ( ) ;
1907+ } ,
1908+ } ) ;
1909+ }
1910+
18831911 if ( projects . length > 0 ) {
18841912 const activeProjectTitle =
18851913 projectPickerEntries . find ( ( entry ) => entry . isPreferred ) ?. group . displayName ??
0 commit comments