2026-02-24 17:44:43 +08:00
|
|
|
import React, { useRef, useEffect } from 'react';
|
|
|
|
|
import { motion, useMotionValue, animate } from 'motion/react';
|
2026-01-22 14:12:19 +02:00
|
|
|
import { Header } from './Header';
|
2026-02-09 03:13:34 +02:00
|
|
|
import { BottomTerminalDock } from './BottomTerminalDock';
|
2026-03-20 01:01:03 +02:00
|
|
|
import { Sidebar, SIDEBAR_CONTENT_WIDTH } from './Sidebar';
|
|
|
|
|
import { RightSidebar, RIGHT_SIDEBAR_CONTENT_WIDTH } from './RightSidebar';
|
2026-02-16 14:15:19 +02:00
|
|
|
import { RightSidebarTabs } from './RightSidebarTabs';
|
|
|
|
|
import { ContextPanel } from './ContextPanel';
|
2025-12-07 19:32:53 +02:00
|
|
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
|
|
|
import { CommandPalette } from '../ui/CommandPalette';
|
|
|
|
|
import { HelpDialog } from '../ui/HelpDialog';
|
2026-02-05 01:59:49 +02:00
|
|
|
import { OpenCodeStatusDialog } from '../ui/OpenCodeStatusDialog';
|
2025-12-07 19:32:53 +02:00
|
|
|
import { SessionSidebar } from '@/components/session/SessionSidebar';
|
|
|
|
|
import { SessionDialogs } from '@/components/session/SessionDialogs';
|
2025-12-14 02:29:46 +02:00
|
|
|
import { DiffWorkerProvider } from '@/contexts/DiffWorkerProvider';
|
2026-01-01 14:59:51 +02:00
|
|
|
import { MultiRunLauncher } from '@/components/multirun';
|
2026-02-24 17:44:43 +08:00
|
|
|
import { DrawerProvider } from '@/contexts/DrawerContext';
|
2025-12-07 19:32:53 +02:00
|
|
|
|
|
|
|
|
import { useUIStore } from '@/stores/useUIStore';
|
2025-12-20 01:04:32 +02:00
|
|
|
import { useUpdateStore } from '@/stores/useUpdateStore';
|
2025-12-07 19:32:53 +02:00
|
|
|
import { useDeviceInfo } from '@/lib/device';
|
2026-02-16 14:15:19 +02:00
|
|
|
import { useEffectiveDirectory } from '@/hooks/useEffectiveDirectory';
|
2026-05-18 23:05:13 +08:00
|
|
|
import { useVisualViewport } from '@/hooks/useVisualViewport';
|
2026-04-26 14:03:39 +03:00
|
|
|
import { useI18n } from '@/lib/i18n';
|
2025-12-07 19:32:53 +02:00
|
|
|
import { cn } from '@/lib/utils';
|
2026-04-25 16:56:37 +03:00
|
|
|
import { lazyWithChunkRecovery } from '@/lib/chunkLoadRecovery';
|
2025-12-07 19:32:53 +02:00
|
|
|
|
2026-05-06 02:43:13 +03:00
|
|
|
import { ChatView } from '@/components/views/ChatView';
|
2026-04-23 02:31:42 -07:00
|
|
|
|
|
|
|
|
// Heavy views loaded on-demand to reduce initial bundle parse time.
|
2026-04-25 16:56:37 +03:00
|
|
|
const PlanView = lazyWithChunkRecovery(() => import('@/components/views/PlanView').then(m => ({ default: m.PlanView })));
|
|
|
|
|
const GitView = lazyWithChunkRecovery(() => import('@/components/views/GitView').then(m => ({ default: m.GitView })));
|
|
|
|
|
const DiffView = lazyWithChunkRecovery(() => import('@/components/views/DiffView').then(m => ({ default: m.DiffView })));
|
|
|
|
|
const TerminalView = lazyWithChunkRecovery(() => import('@/components/views/TerminalView').then(m => ({ default: m.TerminalView })));
|
|
|
|
|
const FilesView = lazyWithChunkRecovery(() => import('@/components/views/FilesView').then(m => ({ default: m.FilesView })));
|
|
|
|
|
const SettingsView = lazyWithChunkRecovery(() => import('@/components/views/SettingsView').then(m => ({ default: m.SettingsView })));
|
|
|
|
|
const SettingsWindow = lazyWithChunkRecovery(() => import('@/components/views/SettingsWindow').then(m => ({ default: m.SettingsWindow })));
|
|
|
|
|
const MultiRunWindow = lazyWithChunkRecovery(() => import('@/components/views/MultiRunWindow').then(m => ({ default: m.MultiRunWindow })));
|
2025-12-07 19:32:53 +02:00
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Mobile drawer width as screen percentage
|
2026-02-24 17:44:43 +08:00
|
|
|
const MOBILE_DRAWER_WIDTH_PERCENT = 85;
|
2026-03-20 01:01:03 +02:00
|
|
|
const DESKTOP_SIDEBAR_MIN_WIDTH = 250;
|
|
|
|
|
const DESKTOP_SIDEBAR_MAX_WIDTH = 500;
|
|
|
|
|
const DESKTOP_RIGHT_SIDEBAR_MIN_WIDTH = 400;
|
|
|
|
|
const DESKTOP_RIGHT_SIDEBAR_MAX_WIDTH = 860;
|
2026-02-24 17:44:43 +08:00
|
|
|
|
2026-02-16 14:15:19 +02:00
|
|
|
const normalizeDirectoryKey = (value: string): string => {
|
|
|
|
|
if (!value) return '';
|
|
|
|
|
|
|
|
|
|
const raw = value.replace(/\\/g, '/');
|
|
|
|
|
const hadUncPrefix = raw.startsWith('//');
|
|
|
|
|
let normalized = raw.replace(/\/+$/g, '');
|
|
|
|
|
normalized = normalized.replace(/\/+/g, '/');
|
|
|
|
|
|
|
|
|
|
if (hadUncPrefix && !normalized.startsWith('//')) {
|
|
|
|
|
normalized = `/${normalized}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (normalized === '') {
|
|
|
|
|
return raw.startsWith('/') ? '/' : '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return normalized;
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
export const MainLayout: React.FC = () => {
|
2026-04-26 14:03:39 +03:00
|
|
|
const { t } = useI18n();
|
2026-02-09 03:13:34 +02:00
|
|
|
const RIGHT_SIDEBAR_AUTO_CLOSE_WIDTH = 1140;
|
|
|
|
|
const RIGHT_SIDEBAR_AUTO_OPEN_WIDTH = 1220;
|
|
|
|
|
const BOTTOM_TERMINAL_AUTO_CLOSE_HEIGHT = 640;
|
|
|
|
|
const BOTTOM_TERMINAL_AUTO_OPEN_HEIGHT = 700;
|
2026-04-04 02:19:55 +03:00
|
|
|
const isSidebarOpen = useUIStore((state) => state.isSidebarOpen);
|
|
|
|
|
const isRightSidebarOpen = useUIStore((state) => state.isRightSidebarOpen);
|
|
|
|
|
const isBottomTerminalOpen = useUIStore((state) => state.isBottomTerminalOpen);
|
|
|
|
|
const setRightSidebarOpen = useUIStore((state) => state.setRightSidebarOpen);
|
|
|
|
|
const setBottomTerminalOpen = useUIStore((state) => state.setBottomTerminalOpen);
|
|
|
|
|
const activeMainTab = useUIStore((state) => state.activeMainTab);
|
|
|
|
|
const setIsMobile = useUIStore((state) => state.setIsMobile);
|
|
|
|
|
const isSessionSwitcherOpen = useUIStore((state) => state.isSessionSwitcherOpen);
|
|
|
|
|
const isSettingsDialogOpen = useUIStore((state) => state.isSettingsDialogOpen);
|
|
|
|
|
const setSettingsDialogOpen = useUIStore((state) => state.setSettingsDialogOpen);
|
|
|
|
|
const isMultiRunLauncherOpen = useUIStore((state) => state.isMultiRunLauncherOpen);
|
|
|
|
|
const setMultiRunLauncherOpen = useUIStore((state) => state.setMultiRunLauncherOpen);
|
|
|
|
|
const multiRunLauncherPrefillPrompt = useUIStore((state) => state.multiRunLauncherPrefillPrompt);
|
2026-01-01 14:59:51 +02:00
|
|
|
|
2026-05-05 16:26:34 +07:00
|
|
|
const { isMobile, isTablet } = useDeviceInfo();
|
2026-05-18 23:05:13 +08:00
|
|
|
const visualViewport = useVisualViewport();
|
2026-03-20 01:01:03 +02:00
|
|
|
const sidebarWidth = useUIStore((state) => state.sidebarWidth);
|
|
|
|
|
const rightSidebarWidth = useUIStore((state) => state.rightSidebarWidth);
|
2026-02-16 14:15:19 +02:00
|
|
|
const effectiveDirectory = useEffectiveDirectory() ?? '';
|
|
|
|
|
const directoryKey = React.useMemo(() => normalizeDirectoryKey(effectiveDirectory), [effectiveDirectory]);
|
|
|
|
|
const isContextPanelOpen = useUIStore((state) => {
|
|
|
|
|
if (!directoryKey) {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
const panelState = state.contextPanelByDirectory[directoryKey];
|
2026-03-02 02:11:33 +02:00
|
|
|
const tabs = panelState?.tabs ?? [];
|
|
|
|
|
const activeTab = tabs.find((tab) => tab.id === panelState?.activeTabId) ?? tabs[tabs.length - 1];
|
|
|
|
|
return Boolean(panelState?.isOpen && activeTab);
|
2026-02-16 14:15:19 +02:00
|
|
|
});
|
|
|
|
|
const setSidebarOpen = useUIStore((state) => state.setSidebarOpen);
|
2026-02-09 03:13:34 +02:00
|
|
|
const rightSidebarAutoClosedRef = React.useRef(false);
|
|
|
|
|
const bottomTerminalAutoClosedRef = React.useRef(false);
|
2026-02-16 14:15:19 +02:00
|
|
|
const leftSidebarAutoClosedByContextRef = React.useRef(false);
|
2025-12-07 19:32:53 +02:00
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Mobile drawer state
|
2026-02-24 17:44:43 +08:00
|
|
|
const [mobileLeftDrawerOpen, setMobileLeftDrawerOpen] = React.useState(false);
|
|
|
|
|
const mobileRightDrawerOpenRef = React.useRef(false);
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Left drawer motion value
|
2026-02-24 17:44:43 +08:00
|
|
|
const leftDrawerX = useMotionValue(0);
|
|
|
|
|
const leftDrawerWidth = useRef(0);
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Right drawer motion value
|
2026-02-24 17:44:43 +08:00
|
|
|
const rightDrawerX = useMotionValue(0);
|
|
|
|
|
const rightDrawerWidth = useRef(0);
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Compute drawer width
|
2026-02-24 17:44:43 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (isMobile) {
|
|
|
|
|
leftDrawerWidth.current = window.innerWidth * (MOBILE_DRAWER_WIDTH_PERCENT / 100);
|
|
|
|
|
rightDrawerWidth.current = window.innerWidth * (MOBILE_DRAWER_WIDTH_PERCENT / 100);
|
|
|
|
|
}
|
|
|
|
|
}, [isMobile]);
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Sync left drawer state and motion value
|
2026-02-24 17:44:43 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isMobile) return;
|
|
|
|
|
const targetX = mobileLeftDrawerOpen ? 0 : -leftDrawerWidth.current;
|
|
|
|
|
animate(leftDrawerX, targetX, {
|
|
|
|
|
type: "spring",
|
|
|
|
|
stiffness: 400,
|
|
|
|
|
damping: 35,
|
|
|
|
|
mass: 0.8
|
|
|
|
|
});
|
|
|
|
|
}, [mobileLeftDrawerOpen, isMobile, leftDrawerX]);
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Sync right drawer state and motion value
|
2026-02-24 17:44:43 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isMobile) return;
|
|
|
|
|
mobileRightDrawerOpenRef.current = isRightSidebarOpen;
|
|
|
|
|
const targetX = isRightSidebarOpen ? 0 : rightDrawerWidth.current;
|
|
|
|
|
animate(rightDrawerX, targetX, {
|
|
|
|
|
type: "spring",
|
|
|
|
|
stiffness: 400,
|
|
|
|
|
damping: 35,
|
|
|
|
|
mass: 0.8
|
|
|
|
|
});
|
|
|
|
|
}, [isMobile, isRightSidebarOpen, rightDrawerX]);
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Sync session switcher state to left drawer (one-way)
|
2026-02-24 17:44:43 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (isMobile) {
|
|
|
|
|
setMobileLeftDrawerOpen(isSessionSwitcherOpen);
|
|
|
|
|
}
|
|
|
|
|
}, [isSessionSwitcherOpen, isMobile]);
|
|
|
|
|
|
2026-04-01 20:32:32 +08:00
|
|
|
// Ensure mobile drawers are closed when opening full-screen settings
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (!isMobile || !isSettingsDialogOpen) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setMobileLeftDrawerOpen(false);
|
|
|
|
|
if (isSessionSwitcherOpen) {
|
|
|
|
|
useUIStore.getState().setSessionSwitcherOpen(false);
|
|
|
|
|
}
|
|
|
|
|
if (isRightSidebarOpen) {
|
|
|
|
|
setRightSidebarOpen(false);
|
|
|
|
|
}
|
|
|
|
|
}, [isMobile, isSettingsDialogOpen, isSessionSwitcherOpen, isRightSidebarOpen, setRightSidebarOpen]);
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
// Sync right drawer and git sidebar state
|
2026-02-24 17:44:43 +08:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (isMobile) {
|
|
|
|
|
mobileRightDrawerOpenRef.current = isRightSidebarOpen;
|
|
|
|
|
}
|
|
|
|
|
}, [isRightSidebarOpen, isMobile]);
|
2025-12-07 19:32:53 +02:00
|
|
|
|
2026-03-15 23:14:37 +02:00
|
|
|
// Trigger initial update check shortly after mount, then repeat using server-suggested cadence.
|
2025-12-20 01:04:32 +02:00
|
|
|
const checkForUpdates = useUpdateStore((state) => state.checkForUpdates);
|
|
|
|
|
React.useEffect(() => {
|
2026-03-04 01:41:01 +02:00
|
|
|
const initialDelayMs = 3000;
|
2026-03-15 23:14:37 +02:00
|
|
|
const defaultIntervalMs = 60 * 60 * 1000;
|
|
|
|
|
const minIntervalMs = 5 * 60 * 1000;
|
|
|
|
|
const maxIntervalMs = 24 * 60 * 60 * 1000;
|
|
|
|
|
let disposed = false;
|
|
|
|
|
let timer: number | null = null;
|
|
|
|
|
|
|
|
|
|
const clampIntervalMs = (seconds: number): number => {
|
|
|
|
|
const ms = Math.round(seconds * 1000);
|
|
|
|
|
return Math.max(minIntervalMs, Math.min(maxIntervalMs, ms));
|
|
|
|
|
};
|
2026-03-04 01:41:01 +02:00
|
|
|
|
2026-03-15 23:14:37 +02:00
|
|
|
const scheduleNext = (delayMs: number) => {
|
|
|
|
|
if (disposed) return;
|
|
|
|
|
timer = window.setTimeout(async () => {
|
|
|
|
|
const suggestedSec = await checkForUpdates();
|
|
|
|
|
const nextDelay = typeof suggestedSec === 'number' && Number.isFinite(suggestedSec)
|
|
|
|
|
? clampIntervalMs(suggestedSec)
|
|
|
|
|
: defaultIntervalMs;
|
|
|
|
|
scheduleNext(nextDelay);
|
|
|
|
|
}, delayMs);
|
|
|
|
|
};
|
2026-03-04 01:41:01 +02:00
|
|
|
|
2026-03-15 23:14:37 +02:00
|
|
|
scheduleNext(initialDelayMs);
|
2026-03-04 01:41:01 +02:00
|
|
|
|
|
|
|
|
return () => {
|
2026-03-15 23:14:37 +02:00
|
|
|
disposed = true;
|
|
|
|
|
if (timer !== null) {
|
|
|
|
|
window.clearTimeout(timer);
|
|
|
|
|
}
|
2026-03-04 01:41:01 +02:00
|
|
|
};
|
2025-12-20 01:04:32 +02:00
|
|
|
}, [checkForUpdates]);
|
|
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
React.useEffect(() => {
|
|
|
|
|
const previous = useUIStore.getState().isMobile;
|
|
|
|
|
if (previous !== isMobile) {
|
|
|
|
|
setIsMobile(isMobile);
|
|
|
|
|
}
|
|
|
|
|
}, [isMobile, setIsMobile]);
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (typeof window === 'undefined') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let timeoutId: number | undefined;
|
|
|
|
|
|
|
|
|
|
const handleResize = () => {
|
|
|
|
|
if (timeoutId !== undefined) {
|
|
|
|
|
window.clearTimeout(timeoutId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timeoutId = window.setTimeout(() => {
|
|
|
|
|
useUIStore.getState().updateProportionalSidebarWidths();
|
|
|
|
|
}, 150);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
window.addEventListener('resize', handleResize);
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
window.removeEventListener('resize', handleResize);
|
|
|
|
|
if (timeoutId !== undefined) {
|
|
|
|
|
window.clearTimeout(timeoutId);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}, []);
|
|
|
|
|
|
2026-02-16 14:15:19 +02:00
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (isContextPanelOpen) {
|
|
|
|
|
const currentlyOpen = useUIStore.getState().isSidebarOpen;
|
|
|
|
|
if (currentlyOpen) {
|
|
|
|
|
setSidebarOpen(false);
|
|
|
|
|
leftSidebarAutoClosedByContextRef.current = true;
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (leftSidebarAutoClosedByContextRef.current) {
|
|
|
|
|
setSidebarOpen(true);
|
|
|
|
|
leftSidebarAutoClosedByContextRef.current = false;
|
|
|
|
|
}
|
|
|
|
|
}, [isContextPanelOpen, setSidebarOpen]);
|
|
|
|
|
|
2026-02-09 03:13:34 +02:00
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (typeof window === 'undefined') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let timeoutId: number | undefined;
|
|
|
|
|
|
|
|
|
|
const handleResponsivePanels = () => {
|
|
|
|
|
const state = useUIStore.getState();
|
|
|
|
|
const width = window.innerWidth;
|
|
|
|
|
const height = window.innerHeight;
|
|
|
|
|
|
2026-05-05 16:26:34 +07:00
|
|
|
// Touch devices frequently resize when the on-screen keyboard opens.
|
2026-05-12 18:49:15 +07:00
|
|
|
// Treat panel auto-collapse/restore as desktop-only so keyboard
|
|
|
|
|
// viewport changes do not churn drawer or terminal layout state.
|
2026-05-05 16:26:34 +07:00
|
|
|
if (!isMobile && !isTablet) {
|
2026-05-12 18:49:15 +07:00
|
|
|
const shouldCloseRightSidebar = width < RIGHT_SIDEBAR_AUTO_CLOSE_WIDTH;
|
|
|
|
|
const canAutoOpenRightSidebar = width >= RIGHT_SIDEBAR_AUTO_OPEN_WIDTH;
|
|
|
|
|
|
|
|
|
|
if (shouldCloseRightSidebar) {
|
|
|
|
|
if (state.isRightSidebarOpen) {
|
|
|
|
|
setRightSidebarOpen(false);
|
|
|
|
|
rightSidebarAutoClosedRef.current = true;
|
|
|
|
|
}
|
|
|
|
|
} else if (canAutoOpenRightSidebar && rightSidebarAutoClosedRef.current) {
|
|
|
|
|
setRightSidebarOpen(true);
|
|
|
|
|
rightSidebarAutoClosedRef.current = false;
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-05 16:26:34 +07:00
|
|
|
const shouldCloseBottomTerminal =
|
|
|
|
|
height < BOTTOM_TERMINAL_AUTO_CLOSE_HEIGHT;
|
|
|
|
|
const canAutoOpenBottomTerminal =
|
|
|
|
|
height >= BOTTOM_TERMINAL_AUTO_OPEN_HEIGHT;
|
|
|
|
|
|
|
|
|
|
if (shouldCloseBottomTerminal) {
|
|
|
|
|
if (state.isBottomTerminalOpen) {
|
|
|
|
|
setBottomTerminalOpen(false);
|
|
|
|
|
bottomTerminalAutoClosedRef.current = true;
|
|
|
|
|
}
|
|
|
|
|
} else if (canAutoOpenBottomTerminal && bottomTerminalAutoClosedRef.current) {
|
|
|
|
|
setBottomTerminalOpen(true);
|
|
|
|
|
bottomTerminalAutoClosedRef.current = false;
|
2026-02-09 03:13:34 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleResize = () => {
|
|
|
|
|
if (timeoutId !== undefined) {
|
|
|
|
|
window.clearTimeout(timeoutId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
timeoutId = window.setTimeout(() => {
|
|
|
|
|
handleResponsivePanels();
|
|
|
|
|
}, 100);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleResponsivePanels();
|
|
|
|
|
window.addEventListener('resize', handleResize);
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
window.removeEventListener('resize', handleResize);
|
|
|
|
|
if (timeoutId !== undefined) {
|
|
|
|
|
window.clearTimeout(timeoutId);
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-05-05 16:26:34 +07:00
|
|
|
}, [isMobile, isTablet, setBottomTerminalOpen, setRightSidebarOpen]);
|
2026-02-09 03:13:34 +02:00
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (typeof window === 'undefined') {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const unsubscribe = useUIStore.subscribe((state, prevState) => {
|
|
|
|
|
const width = window.innerWidth;
|
|
|
|
|
const height = window.innerHeight;
|
|
|
|
|
|
|
|
|
|
const rightCanAutoOpen = width >= RIGHT_SIDEBAR_AUTO_OPEN_WIDTH;
|
|
|
|
|
const bottomCanAutoOpen =
|
|
|
|
|
height >= BOTTOM_TERMINAL_AUTO_OPEN_HEIGHT;
|
|
|
|
|
|
|
|
|
|
if (state.isRightSidebarOpen !== prevState.isRightSidebarOpen && rightCanAutoOpen) {
|
|
|
|
|
rightSidebarAutoClosedRef.current = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (state.isBottomTerminalOpen !== prevState.isBottomTerminalOpen && bottomCanAutoOpen) {
|
|
|
|
|
bottomTerminalAutoClosedRef.current = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
|
unsubscribe();
|
|
|
|
|
};
|
2026-05-05 16:26:34 +07:00
|
|
|
}, [isMobile, isTablet, setBottomTerminalOpen, setRightSidebarOpen]);
|
2026-02-09 03:13:34 +02:00
|
|
|
|
2025-12-07 19:32:53 +02:00
|
|
|
const secondaryView = React.useMemo(() => {
|
|
|
|
|
switch (activeMainTab) {
|
2026-01-25 15:52:02 +02:00
|
|
|
case 'plan':
|
2026-04-23 02:31:42 -07:00
|
|
|
return <React.Suspense fallback={null}><PlanView /></React.Suspense>;
|
2025-12-07 19:32:53 +02:00
|
|
|
case 'git':
|
2026-04-23 02:31:42 -07:00
|
|
|
return <React.Suspense fallback={null}><GitView /></React.Suspense>;
|
2025-12-07 19:32:53 +02:00
|
|
|
case 'diff':
|
2026-04-23 02:31:42 -07:00
|
|
|
return <React.Suspense fallback={null}><DiffView /></React.Suspense>;
|
2025-12-07 19:32:53 +02:00
|
|
|
case 'terminal':
|
2026-04-23 02:31:42 -07:00
|
|
|
return <React.Suspense fallback={null}><TerminalView /></React.Suspense>;
|
2026-01-15 20:19:06 +02:00
|
|
|
case 'files':
|
2026-04-23 02:31:42 -07:00
|
|
|
return <React.Suspense fallback={null}><FilesView /></React.Suspense>;
|
2025-12-07 19:32:53 +02:00
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}, [activeMainTab]);
|
|
|
|
|
|
|
|
|
|
const isChatActive = activeMainTab === 'chat';
|
2026-03-20 01:01:03 +02:00
|
|
|
const visibleSidebarWidth = React.useMemo(() => {
|
|
|
|
|
const rawWidth = sidebarWidth || SIDEBAR_CONTENT_WIDTH;
|
|
|
|
|
return Math.min(DESKTOP_SIDEBAR_MAX_WIDTH, Math.max(DESKTOP_SIDEBAR_MIN_WIDTH, rawWidth));
|
|
|
|
|
}, [sidebarWidth]);
|
|
|
|
|
const visibleRightSidebarWidth = React.useMemo(() => {
|
|
|
|
|
const rawWidth = rightSidebarWidth || RIGHT_SIDEBAR_CONTENT_WIDTH;
|
|
|
|
|
return Math.min(DESKTOP_RIGHT_SIDEBAR_MAX_WIDTH, Math.max(DESKTOP_RIGHT_SIDEBAR_MIN_WIDTH, rawWidth));
|
|
|
|
|
}, [rightSidebarWidth]);
|
2025-12-07 19:32:53 +02:00
|
|
|
|
|
|
|
|
return (
|
2025-12-14 02:29:46 +02:00
|
|
|
<DiffWorkerProvider>
|
|
|
|
|
<div
|
2026-04-27 16:14:09 +07:00
|
|
|
data-page-scroll-lock="true"
|
2025-12-14 02:29:46 +02:00
|
|
|
className={cn(
|
2026-05-18 23:05:13 +08:00
|
|
|
'main-content-safe-area',
|
|
|
|
|
isMobile ? 'flex flex-col' : 'flex h-[100dvh]',
|
2026-04-07 21:46:38 +03:00
|
|
|
'bg-background'
|
2025-12-14 02:29:46 +02:00
|
|
|
)}
|
2026-05-18 23:05:13 +08:00
|
|
|
style={isMobile && visualViewport.height > 0 ? { height: visualViewport.height } : undefined}
|
2025-12-14 02:29:46 +02:00
|
|
|
>
|
|
|
|
|
<CommandPalette />
|
|
|
|
|
<HelpDialog />
|
2026-02-05 01:59:49 +02:00
|
|
|
<OpenCodeStatusDialog />
|
2025-12-14 02:29:46 +02:00
|
|
|
<SessionDialogs />
|
|
|
|
|
|
|
|
|
|
{isMobile ? (
|
2026-02-24 17:44:43 +08:00
|
|
|
<DrawerProvider value={{
|
|
|
|
|
leftDrawerOpen: mobileLeftDrawerOpen,
|
|
|
|
|
rightDrawerOpen: isRightSidebarOpen,
|
|
|
|
|
toggleLeftDrawer: () => {
|
|
|
|
|
if (isRightSidebarOpen) {
|
|
|
|
|
setRightSidebarOpen(false);
|
|
|
|
|
}
|
|
|
|
|
setMobileLeftDrawerOpen(!mobileLeftDrawerOpen);
|
|
|
|
|
},
|
|
|
|
|
toggleRightDrawer: () => {
|
|
|
|
|
if (mobileLeftDrawerOpen) {
|
|
|
|
|
setMobileLeftDrawerOpen(false);
|
|
|
|
|
}
|
|
|
|
|
setRightSidebarOpen(!isRightSidebarOpen);
|
|
|
|
|
},
|
|
|
|
|
leftDrawerX,
|
|
|
|
|
rightDrawerX,
|
|
|
|
|
leftDrawerWidth,
|
|
|
|
|
rightDrawerWidth,
|
|
|
|
|
setMobileLeftDrawerOpen,
|
|
|
|
|
setRightSidebarOpen,
|
|
|
|
|
}}>
|
2026-02-24 23:38:12 +08:00
|
|
|
{/* Mobile: header + drawer mode */}
|
2026-03-22 22:31:29 +02:00
|
|
|
{!isSettingsDialogOpen && <Header
|
2026-02-24 17:44:43 +08:00
|
|
|
onToggleLeftDrawer={() => {
|
|
|
|
|
if (isRightSidebarOpen) {
|
|
|
|
|
setRightSidebarOpen(false);
|
|
|
|
|
}
|
|
|
|
|
setMobileLeftDrawerOpen(!mobileLeftDrawerOpen);
|
|
|
|
|
}}
|
|
|
|
|
onToggleRightDrawer={() => {
|
|
|
|
|
if (mobileLeftDrawerOpen) {
|
|
|
|
|
setMobileLeftDrawerOpen(false);
|
|
|
|
|
}
|
|
|
|
|
setRightSidebarOpen(!isRightSidebarOpen);
|
|
|
|
|
}}
|
|
|
|
|
leftDrawerOpen={mobileLeftDrawerOpen}
|
|
|
|
|
rightDrawerOpen={isRightSidebarOpen}
|
|
|
|
|
/>}
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
{/* Backdrop */}
|
2026-02-24 17:44:43 +08:00
|
|
|
<motion.button
|
|
|
|
|
type="button"
|
|
|
|
|
initial={false}
|
|
|
|
|
animate={{
|
|
|
|
|
opacity: mobileLeftDrawerOpen || isRightSidebarOpen ? 1 : 0,
|
|
|
|
|
pointerEvents: mobileLeftDrawerOpen || isRightSidebarOpen ? 'auto' : 'none',
|
|
|
|
|
}}
|
2026-03-20 01:01:03 +02:00
|
|
|
className="fixed left-0 right-0 bottom-0 top-[var(--oc-header-height,56px)] z-40 bg-black/50 cursor-default"
|
2026-02-24 17:44:43 +08:00
|
|
|
onClick={() => {
|
|
|
|
|
setMobileLeftDrawerOpen(false);
|
|
|
|
|
setRightSidebarOpen(false);
|
|
|
|
|
}}
|
2026-04-26 14:03:39 +03:00
|
|
|
aria-label={t('mainLayout.mobile.closeDrawerAria')}
|
2026-02-24 17:44:43 +08:00
|
|
|
/>
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
{/* Left drawer (Session) */}
|
2026-02-24 17:44:43 +08:00
|
|
|
<motion.aside
|
|
|
|
|
drag="x"
|
|
|
|
|
dragElastic={0.08}
|
|
|
|
|
dragMomentum={false}
|
|
|
|
|
dragConstraints={{ left: -(leftDrawerWidth.current || window.innerWidth * 0.85), right: 0 }}
|
|
|
|
|
style={{
|
|
|
|
|
width: `${MOBILE_DRAWER_WIDTH_PERCENT}%`,
|
|
|
|
|
x: leftDrawerX,
|
|
|
|
|
}}
|
|
|
|
|
onDragEnd={(_, info) => {
|
|
|
|
|
const drawerWidthPx = leftDrawerWidth.current || window.innerWidth * 0.85;
|
|
|
|
|
const threshold = drawerWidthPx * 0.3;
|
|
|
|
|
const velocityThreshold = 500;
|
|
|
|
|
const currentX = leftDrawerX.get();
|
|
|
|
|
|
|
|
|
|
const shouldClose = info.offset.x < -threshold || info.velocity.x < -velocityThreshold;
|
|
|
|
|
const shouldOpen = info.offset.x > threshold || info.velocity.x > velocityThreshold;
|
|
|
|
|
|
|
|
|
|
if (shouldClose) {
|
|
|
|
|
leftDrawerX.set(-drawerWidthPx);
|
|
|
|
|
setMobileLeftDrawerOpen(false);
|
|
|
|
|
} else if (shouldOpen) {
|
|
|
|
|
leftDrawerX.set(0);
|
|
|
|
|
setMobileLeftDrawerOpen(true);
|
|
|
|
|
} else {
|
|
|
|
|
if (currentX > -drawerWidthPx / 2) {
|
|
|
|
|
leftDrawerX.set(0);
|
|
|
|
|
} else {
|
|
|
|
|
leftDrawerX.set(-drawerWidthPx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
className={cn(
|
2026-04-07 21:46:38 +03:00
|
|
|
'fixed left-0 top-[var(--oc-header-height,56px)] z-50 h-[calc(100%-var(--oc-header-height,56px))] bg-background',
|
2026-02-24 17:44:43 +08:00
|
|
|
'cursor-grab active:cursor-grabbing'
|
|
|
|
|
)}
|
|
|
|
|
aria-hidden={!mobileLeftDrawerOpen}
|
|
|
|
|
>
|
2026-03-20 01:01:03 +02:00
|
|
|
<div
|
2026-04-27 16:14:09 +07:00
|
|
|
data-page-scroll-lock="true"
|
2026-03-20 01:01:03 +02:00
|
|
|
className="h-full overflow-hidden flex bg-[var(--surface-background)] shadow-none drawer-safe-area"
|
|
|
|
|
style={{ backgroundImage: 'linear-gradient(var(--surface-muted), var(--surface-muted))' }}
|
|
|
|
|
>
|
2026-04-27 16:14:09 +07:00
|
|
|
<div className="flex-1 min-w-0 overflow-hidden flex flex-col" data-page-scroll-lock="true">
|
2026-02-24 17:44:43 +08:00
|
|
|
<ErrorBoundary>
|
|
|
|
|
<SessionSidebar mobileVariant />
|
|
|
|
|
</ErrorBoundary>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</motion.aside>
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
{/* Right drawer (Git) */}
|
2026-02-24 17:44:43 +08:00
|
|
|
<motion.aside
|
|
|
|
|
drag="x"
|
|
|
|
|
dragElastic={0.08}
|
|
|
|
|
dragMomentum={false}
|
|
|
|
|
dragConstraints={{ left: 0, right: rightDrawerWidth.current || window.innerWidth * 0.85 }}
|
|
|
|
|
style={{
|
|
|
|
|
width: `${MOBILE_DRAWER_WIDTH_PERCENT}%`,
|
|
|
|
|
x: rightDrawerX,
|
|
|
|
|
}}
|
|
|
|
|
onDragEnd={(_, info) => {
|
|
|
|
|
const drawerWidthPx = rightDrawerWidth.current || window.innerWidth * 0.85;
|
|
|
|
|
const threshold = drawerWidthPx * 0.3;
|
|
|
|
|
const velocityThreshold = 500;
|
|
|
|
|
const currentX = rightDrawerX.get();
|
|
|
|
|
|
|
|
|
|
const shouldClose = info.offset.x > threshold || info.velocity.x > velocityThreshold;
|
|
|
|
|
const shouldOpen = info.offset.x < -threshold || info.velocity.x < -velocityThreshold;
|
|
|
|
|
|
|
|
|
|
if (shouldClose) {
|
|
|
|
|
rightDrawerX.set(drawerWidthPx);
|
|
|
|
|
setRightSidebarOpen(false);
|
|
|
|
|
} else if (shouldOpen) {
|
|
|
|
|
rightDrawerX.set(0);
|
|
|
|
|
setRightSidebarOpen(true);
|
|
|
|
|
} else {
|
|
|
|
|
if (currentX < drawerWidthPx / 2) {
|
|
|
|
|
rightDrawerX.set(0);
|
|
|
|
|
} else {
|
|
|
|
|
rightDrawerX.set(drawerWidthPx);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}}
|
2025-12-28 02:17:09 +02:00
|
|
|
className={cn(
|
2026-04-07 21:46:38 +03:00
|
|
|
'fixed right-0 top-[var(--oc-header-height,56px)] z-50 h-[calc(100%-var(--oc-header-height,56px))] bg-background',
|
2026-02-24 17:44:43 +08:00
|
|
|
'cursor-grab active:cursor-grabbing'
|
|
|
|
|
)}
|
|
|
|
|
aria-hidden={!isRightSidebarOpen}
|
|
|
|
|
>
|
2026-04-27 16:14:09 +07:00
|
|
|
<div className="h-full overflow-hidden flex flex-col bg-background shadow-none drawer-safe-area" data-page-scroll-lock="true">
|
2026-02-24 17:44:43 +08:00
|
|
|
<ErrorBoundary>
|
2026-04-23 02:31:42 -07:00
|
|
|
<React.Suspense fallback={null}><GitView /></React.Suspense>
|
2026-02-24 17:44:43 +08:00
|
|
|
</ErrorBoundary>
|
|
|
|
|
</div>
|
|
|
|
|
</motion.aside>
|
|
|
|
|
|
2026-02-24 23:38:12 +08:00
|
|
|
{/* Main content area (fixed) */}
|
|
|
|
|
<div
|
2026-04-27 16:14:09 +07:00
|
|
|
data-page-scroll-lock="true"
|
2026-02-24 17:44:43 +08:00
|
|
|
className={cn(
|
|
|
|
|
'flex flex-1 overflow-hidden relative',
|
2026-03-22 22:31:29 +02:00
|
|
|
isSettingsDialogOpen && 'hidden'
|
2025-12-28 02:17:09 +02:00
|
|
|
)}
|
2025-12-18 11:20:37 +02:00
|
|
|
>
|
2026-04-27 16:14:09 +07:00
|
|
|
<main className="w-full h-full overflow-hidden bg-background relative" data-page-scroll-lock="true">
|
2026-02-11 10:08:15 -08:00
|
|
|
<div className={cn('absolute inset-0', !isChatActive && 'invisible')}>
|
|
|
|
|
<ErrorBoundary><ChatView /></ErrorBoundary>
|
2025-12-07 19:32:53 +02:00
|
|
|
</div>
|
2026-02-11 10:08:15 -08:00
|
|
|
{secondaryView && (
|
|
|
|
|
<div className="absolute inset-0">
|
|
|
|
|
<ErrorBoundary>{secondaryView}</ErrorBoundary>
|
2025-12-07 19:32:53 +02:00
|
|
|
</div>
|
2026-02-11 10:08:15 -08:00
|
|
|
)}
|
2026-03-22 22:31:29 +02:00
|
|
|
{isMultiRunLauncherOpen && (
|
|
|
|
|
<div className="absolute inset-0 z-10 bg-background">
|
|
|
|
|
<ErrorBoundary>
|
|
|
|
|
<MultiRunLauncher
|
|
|
|
|
initialPrompt={multiRunLauncherPrefillPrompt}
|
|
|
|
|
onCreated={() => setMultiRunLauncherOpen(false)}
|
|
|
|
|
onCancel={() => setMultiRunLauncherOpen(false)}
|
|
|
|
|
/>
|
|
|
|
|
</ErrorBoundary>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-11 10:08:15 -08:00
|
|
|
</main>
|
2026-02-24 23:38:12 +08:00
|
|
|
</div>
|
2025-12-07 19:32:53 +02:00
|
|
|
|
2025-12-28 02:17:09 +02:00
|
|
|
{/* Mobile settings: full screen */}
|
|
|
|
|
{isSettingsDialogOpen && (
|
2026-03-20 01:01:03 +02:00
|
|
|
<div
|
|
|
|
|
className="absolute inset-0 z-10 bg-background"
|
|
|
|
|
style={{ paddingTop: 'var(--oc-safe-area-top, 0px)' }}
|
|
|
|
|
>
|
2026-04-23 02:31:42 -07:00
|
|
|
<ErrorBoundary>
|
|
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
|
<SettingsView onClose={() => setSettingsDialogOpen(false)} />
|
|
|
|
|
</React.Suspense>
|
|
|
|
|
</ErrorBoundary>
|
2025-12-28 02:17:09 +02:00
|
|
|
</div>
|
|
|
|
|
)}
|
2026-02-24 17:44:43 +08:00
|
|
|
</DrawerProvider>
|
2025-12-07 19:32:53 +02:00
|
|
|
) : (
|
|
|
|
|
<>
|
2026-05-20 19:30:10 +03:00
|
|
|
{/* Desktop: full-width Header above [Sidebar | chat-frame | RightSidebar] row */}
|
|
|
|
|
<div className="flex flex-1 flex-col overflow-hidden">
|
|
|
|
|
<Header />
|
|
|
|
|
<div className="relative flex flex-1 min-h-0 overflow-hidden bg-sidebar" data-page-scroll-lock="true">
|
2026-05-20 20:43:13 +03:00
|
|
|
<div
|
|
|
|
|
aria-hidden
|
|
|
|
|
className="pointer-events-none absolute top-0 z-0 bg-sidebar transition-[left,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
|
|
|
style={{
|
|
|
|
|
left: `${isSidebarOpen ? visibleSidebarWidth : 0}px`,
|
|
|
|
|
opacity: isSidebarOpen ? 1 : 0,
|
|
|
|
|
width: '10px',
|
|
|
|
|
height: '10px',
|
|
|
|
|
WebkitMaskImage: 'radial-gradient(circle at 100% 100%, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
maskImage: 'radial-gradient(circle at 100% 100%, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<div
|
|
|
|
|
aria-hidden
|
|
|
|
|
className="pointer-events-none absolute bottom-0 z-0 bg-sidebar transition-[left,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
|
|
|
style={{
|
|
|
|
|
left: `${isSidebarOpen ? visibleSidebarWidth : 0}px`,
|
|
|
|
|
opacity: isSidebarOpen ? 1 : 0,
|
|
|
|
|
width: '10px',
|
|
|
|
|
height: '10px',
|
|
|
|
|
WebkitMaskImage: 'radial-gradient(circle at 100% 0%, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
maskImage: 'radial-gradient(circle at 100% 0%, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<div
|
|
|
|
|
aria-hidden
|
|
|
|
|
className="pointer-events-none absolute top-0 z-0 bg-sidebar transition-[right,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
|
|
|
style={{
|
|
|
|
|
right: `${isRightSidebarOpen ? visibleRightSidebarWidth : 0}px`,
|
|
|
|
|
opacity: isRightSidebarOpen ? 1 : 0,
|
|
|
|
|
width: '10px',
|
|
|
|
|
height: '10px',
|
|
|
|
|
WebkitMaskImage: 'radial-gradient(circle at 0 100%, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
maskImage: 'radial-gradient(circle at 0 100%, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
<div
|
|
|
|
|
aria-hidden
|
|
|
|
|
className="pointer-events-none absolute bottom-0 z-0 bg-sidebar transition-[right,opacity] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)] motion-reduce:transition-none"
|
|
|
|
|
style={{
|
|
|
|
|
right: `${isRightSidebarOpen ? visibleRightSidebarWidth : 0}px`,
|
|
|
|
|
opacity: isRightSidebarOpen ? 1 : 0,
|
|
|
|
|
width: '10px',
|
|
|
|
|
height: '10px',
|
|
|
|
|
WebkitMaskImage: 'radial-gradient(circle at 0 0, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
maskImage: 'radial-gradient(circle at 0 0, transparent calc(10px - 1px), black 10px)',
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2026-03-20 01:01:03 +02:00
|
|
|
<Sidebar
|
|
|
|
|
isOpen={isSidebarOpen}
|
|
|
|
|
isMobile={isMobile}
|
|
|
|
|
className="border-0"
|
|
|
|
|
>
|
|
|
|
|
<SessionSidebar />
|
|
|
|
|
</Sidebar>
|
|
|
|
|
<div className={cn(
|
|
|
|
|
'relative flex flex-1 min-w-0 flex-col overflow-hidden',
|
2026-05-20 19:30:10 +03:00
|
|
|
'bg-background',
|
2026-05-20 20:43:13 +03:00
|
|
|
'border border-border/50 rounded-[10px]',
|
|
|
|
|
!isSidebarOpen && 'border-l-transparent',
|
|
|
|
|
!isRightSidebarOpen && 'border-r-transparent'
|
2026-04-27 16:14:09 +07:00
|
|
|
)} data-page-scroll-lock="true">
|
2026-05-20 19:30:10 +03:00
|
|
|
<div className="flex flex-1 min-h-0 overflow-hidden" data-page-scroll-lock="true">
|
2026-04-27 16:14:09 +07:00
|
|
|
<div className="relative flex flex-1 min-h-0 min-w-0 overflow-hidden" data-page-scroll-lock="true">
|
|
|
|
|
<main className="flex-1 overflow-hidden bg-background relative" data-page-scroll-lock="true">
|
2026-03-20 01:01:03 +02:00
|
|
|
<div className={cn('absolute inset-0', !isChatActive && 'invisible')}>
|
|
|
|
|
<ErrorBoundary><ChatView /></ErrorBoundary>
|
|
|
|
|
</div>
|
|
|
|
|
{secondaryView && (
|
|
|
|
|
<div className="absolute inset-0">
|
|
|
|
|
<ErrorBoundary>{secondaryView}</ErrorBoundary>
|
2026-02-09 03:13:34 +02:00
|
|
|
</div>
|
2026-03-20 01:01:03 +02:00
|
|
|
)}
|
|
|
|
|
</main>
|
|
|
|
|
<ContextPanel />
|
2025-12-07 19:32:53 +02:00
|
|
|
</div>
|
2026-02-25 14:32:23 +02:00
|
|
|
</div>
|
2026-03-20 01:01:03 +02:00
|
|
|
<BottomTerminalDock isOpen={isBottomTerminalOpen} isMobile={isMobile}>
|
2026-04-23 02:31:42 -07:00
|
|
|
{isBottomTerminalOpen ? (
|
|
|
|
|
<ErrorBoundary>
|
|
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
|
<TerminalView />
|
|
|
|
|
</React.Suspense>
|
|
|
|
|
</ErrorBoundary>
|
|
|
|
|
) : null}
|
2026-03-20 01:01:03 +02:00
|
|
|
</BottomTerminalDock>
|
2025-12-28 02:17:09 +02:00
|
|
|
</div>
|
2026-03-20 01:01:03 +02:00
|
|
|
<RightSidebar
|
|
|
|
|
isOpen={isRightSidebarOpen}
|
|
|
|
|
className="border-0"
|
|
|
|
|
>
|
|
|
|
|
<ErrorBoundary><RightSidebarTabs /></ErrorBoundary>
|
|
|
|
|
</RightSidebar>
|
2025-12-07 19:32:53 +02:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-28 02:17:09 +02:00
|
|
|
|
2026-02-01 20:55:39 +02:00
|
|
|
{/* Desktop settings: windowed dialog with blur */}
|
2026-04-23 02:31:42 -07:00
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
|
<SettingsWindow
|
|
|
|
|
open={isSettingsDialogOpen}
|
|
|
|
|
onOpenChange={setSettingsDialogOpen}
|
|
|
|
|
/>
|
|
|
|
|
</React.Suspense>
|
|
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
|
<MultiRunWindow
|
|
|
|
|
open={isMultiRunLauncherOpen}
|
|
|
|
|
onOpenChange={setMultiRunLauncherOpen}
|
|
|
|
|
initialPrompt={multiRunLauncherPrefillPrompt}
|
|
|
|
|
/>
|
|
|
|
|
</React.Suspense>
|
2025-12-07 19:32:53 +02:00
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
</div>
|
2025-12-14 02:29:46 +02:00
|
|
|
</DiffWorkerProvider>
|
2025-12-07 19:32:53 +02:00
|
|
|
);
|
|
|
|
|
};
|