TypeScript
fix(web): keep right panel maximize available in narrow windows (#25389)
Alex70eccd48e473
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsxindex 75160d214e6..f0b6877c42e 100644--- a/apps/web/src/components/ChatView.tsx+++ b/apps/web/src/components/ChatView.tsx@@ -277,6 +277,7 @@ import { useOpenFavoriteEditorShortcut } from "./chat/OpenInPickerShortcut";import {PanelLayoutControls,type PanelLayoutControlsProps,+ RightPanelMaximizeControl,ThreadPanelHeaderControl,WorkspaceTitlebarControls,} from "./chat/PanelLayoutControls";@@ -678,7 +679,7 @@ export default function ChatView(props: ChatViewProps) {window.addEventListener("dragend", clearWorkspaceFileDrag);return () => window.removeEventListener("dragend", clearWorkspaceFileDrag);}, [isWorkspaceFileDragActive]);- const shouldUsePlanSidebarSheet = useMediaQuery(RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY);+ const prefersPlanSidebarSheet = useMediaQuery(RIGHT_PANEL_INLINE_LAYOUT_MEDIA_QUERY);const isMobileViewport = useMediaQuery("max-sm");const [workspaceLayoutElement, setWorkspaceLayoutElement] = useState<HTMLDivElement | null>(null);const threadPanelPopoverAnchorRef = useRef<HTMLElement | null>(null);@@ -948,6 +949,7 @@ export default function ChatView(props: ChatViewProps) {const rightPanelState = useRightPanelStore((state) =>selectThreadRightPanelState(state.byThreadKey, activeThreadRef),);+ const shouldUsePlanSidebarSheet = prefersPlanSidebarSheet && rightPanelState.maximized !== true;const activeRightPanelSurface = useRightPanelStore((state) =>selectActiveRightPanelSurface(state.byThreadKey, activeThreadRef),);@@ -990,7 +992,7 @@ export default function ChatView(props: ChatViewProps) {activePreviewMiniPlayer?.source ?? null,renderedRightPanelSurface,);- const canMaximizeRightPanel = rightPanelOpen && !shouldUsePlanSidebarSheet;+ const canMaximizeRightPanel = rightPanelOpen;const rightPanelMaximized = canMaximizeRightPanel && rightPanelState.maximized === true;const inlineRightPanelOwnsTitleBar = rightPanelOpen && !shouldUsePlanSidebarSheet;const [threadPanelPopoverHandle] = useState(PopoverCreateHandle);@@ -3757,7 +3759,13 @@ export default function ChatView(props: ChatViewProps) {maximized={rightPanelMaximized}layoutControls={rightPanelOpen ? (- <div className="mr-px flex items-center">{panelToggleControls}</div>+ <div className="mr-px flex items-center gap-1">+ <RightPanelMaximizeControl+ maximized={rightPanelMaximized}+ onToggle={toggleRightPanelMaximizedStable}+ />+ {panelToggleControls}+ </div>) : null}surfaces={renderedRightPanelSurfaces}