({ className = '' })
| 74 | } |
| 75 | |
| 76 | const AppLayout: React.FC<AppLayoutProps> = ({ className = '' }) => { |
| 77 | const { t } = useI18n('components'); |
| 78 | const { t: tCommon } = useI18n('common'); |
| 79 | const { |
| 80 | currentWorkspace, |
| 81 | hasWorkspace, |
| 82 | openWorkspace, |
| 83 | switchWorkspace, |
| 84 | recentWorkspaces, |
| 85 | loading, |
| 86 | } = useWorkspaceContext(); |
| 87 | const sshContext = useContext(SSHContext); |
| 88 | /** When SSH finishes connecting, re-run FlowChat init (first run may have skipped while disconnected). */ |
| 89 | const remoteSshFlowChatKey = |
| 90 | currentWorkspace?.workspaceKind === WorkspaceKind.Remote && currentWorkspace?.connectionId |
| 91 | ? sshContext?.workspaceStatuses[currentWorkspace.connectionId] ?? 'unknown' |
| 92 | : 'local'; |
| 93 | |
| 94 | const { isToolbarMode } = useToolbarModeContext(); |
| 95 | const { ensureForWorkspace: ensureAssistantBootstrapForWorkspace } = useAssistantBootstrap(); |
| 96 | const isMacOS = useMemo(() => { |
| 97 | return isMacOSDesktopRuntime(); |
| 98 | }, []); |
| 99 | |
| 100 | const { |
| 101 | handleMinimize, |
| 102 | handleMaximize, |
| 103 | handleToggleFullscreen, |
| 104 | handleClose, |
| 105 | isMaximized, |
| 106 | isFullscreen, |
| 107 | canUseNativeWindowControls, |
| 108 | } = |
| 109 | useWindowControls({ isToolbarMode }); |
| 110 | |
| 111 | const { state, switchLeftPanelTab, toggleLeftPanel, toggleRightPanel } = useApp(); |
| 112 | const [windowModeHint, setWindowModeHint] = useState<WindowModeHint | null>(null); |
| 113 | const windowModeHintTimerRef = useRef<number | null>(null); |
| 114 | |
| 115 | const showWindowFullscreenHint = useCallback((enteredFullscreen: boolean) => { |
| 116 | if (windowModeHintTimerRef.current) { |
| 117 | window.clearTimeout(windowModeHintTimerRef.current); |
| 118 | } |
| 119 | |
| 120 | const shortcut = isMacOS ? 'Control+Command+F' : 'F11'; |
| 121 | setWindowModeHint({ |
| 122 | id: Date.now(), |
| 123 | title: t(enteredFullscreen |
| 124 | ? 'appLayout.windowFullscreenEntered' |
| 125 | : 'appLayout.windowFullscreenExited'), |
| 126 | detail: t(enteredFullscreen |
| 127 | ? 'appLayout.windowFullscreenExitHint' |
| 128 | : 'appLayout.windowFullscreenEnterHint', { shortcut }), |
| 129 | }); |
| 130 | |
| 131 | windowModeHintTimerRef.current = window.setTimeout(() => { |
| 132 | setWindowModeHint(null); |
| 133 | windowModeHintTimerRef.current = null; |
nothing calls this directly
no test coverage detected