From 781ac0753c5096b93cbe1982879d6f2bf48dead5 Mon Sep 17 00:00:00 2001 From: xuxu777xu <1728019186@qq.com> Date: Sat, 7 Mar 2026 12:56:41 +0800 Subject: [PATCH] fix(layout): avoid Windows title bar overlap - detect Windows after mount without SSR mismatch - add top spacing only for right panel states affected by title bar controls --- src/components/layout/RightPanel.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/layout/RightPanel.tsx b/src/components/layout/RightPanel.tsx index e55cbe31..46998e01 100644 --- a/src/components/layout/RightPanel.tsx +++ b/src/components/layout/RightPanel.tsx @@ -1,6 +1,6 @@ "use client"; -import { useCallback } from "react"; +import { useCallback, useSyncExternalStore } from "react"; import { HugeiconsIcon } from "@hugeicons/react"; import { StructureFolderIcon, PanelRightCloseIcon } from "@hugeicons/core-free-icons"; import { Button } from "@/components/ui/button"; @@ -21,6 +21,9 @@ interface RightPanelProps { export function RightPanel({ width }: RightPanelProps) { const { panelOpen, setPanelOpen, workingDirectory, sessionId, previewFile, setPreviewFile } = usePanel(); const { t } = useTranslation(); + const emptySubscribe = useCallback(() => () => {}, []); + const mounted = useSyncExternalStore(emptySubscribe, () => true, () => false); + const isWindows = mounted && /windows/i.test(navigator.userAgent); const handleFileAdd = useCallback((path: string) => { window.dispatchEvent(new CustomEvent('attach-file-to-chat', { detail: { path } })); @@ -50,7 +53,7 @@ export function RightPanel({ width }: RightPanelProps) { if (!panelOpen) { return ( -