MCPcopy Create free account
hub / github.com/GCWing/BitFun / AppLayout

Function AppLayout

src/web-ui/src/app/layout/AppLayout.tsx:76–783  ·  view source on GitHub ↗
({ className = '' })

Source from the content-addressed store, hash-verified

74}
75
76const 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;

Callers

nothing calls this directly

Calls 15

useI18nFunction · 0.90
useWorkspaceContextFunction · 0.90
useToolbarModeContextFunction · 0.90
useAssistantBootstrapFunction · 0.90
isMacOSDesktopRuntimeFunction · 0.90
useWindowControlsFunction · 0.90
useAppFunction · 0.90
useShortcutFunction · 0.90
handleShowAboutFunction · 0.85
fnFunction · 0.85
initializeFlowChatFunction · 0.85
setupWindowCloseListenerFunction · 0.85

Tested by

no test coverage detected