Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

AdaptiveWorkspaceLayout.tsx

636 lines23.2 KB

1import type {
2 EnvironmentProject,
3 EnvironmentThreadShell,
4} from "@t3tools/client-runtime/state/shell";
5import { EnvironmentId, ThreadId, type SidebarProjectGroupingMode } from "@t3tools/contracts";
6import { useAtomValue } from "@effect/atom-react";
7import { useFocusEffect } from "@react-navigation/native";
8import {
9 CommonActions,
10 NavigationContext,
11 NavigationRouteContext,
12 StackActions,
13 useNavigation,
14} from "@react-navigation/native";
15import {
16 createContext,
17 use,
18 useCallback,
19 useEffect,
20 useMemo,
21 useRef,
22 useState,
23 type ReactNode,
24} from "react";
25import { useWindowDimensions, View } from "react-native";
26import Animated, {
27 useAnimatedStyle,
28 useDerivedValue,
29 useSharedValue,
30 withTiming,
31} from "react-native-reanimated";
32import { AsyncResult } from "effect/unstable/reactivity";
33​
34import {
35 deriveFileInspectorPaneLayout,
36 deriveLayout,
37 deriveWorkspacePaneLayout,
38 type FileInspectorPaneLayout,
39 type Layout,
40 type WorkspaceAuxiliaryPaneRole,
41 type WorkspacePaneLayout,
42} from "../../lib/layout";
43import {
44 resolveThreadSelectionNavigationAction,
45 resolveThreadSelectionOverlayState,
46} from "../../lib/adaptive-navigation";
47import { scopedThreadKey } from "../../lib/scopedEntities";
48import { mobilePreferencesAtom } from "../../state/preferences";
49import {
50 DEFAULT_MOBILE_PROJECT_GROUPING_SETTINGS,
51 resolveMobileProjectGroupingSettings,
52} from "../../state/project-grouping";
53import {
54 parseActiveThreadPath,
55 useHardwareKeyboardCommand,
56} from "../keyboard/hardwareKeyboardCommands";
57import { AndroidHomeFabLayout } from "../home/AndroidHomeFab";
58import { HomeListOptionsProvider } from "../home/home-list-options";
59import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
60import { ThreadNavigationSidebar } from "../threads/ThreadNavigationSidebar";
61import { WORKSPACE_PANE_TIMING } from "./workspace-pane-animation";
62import { WorkspaceInspectorPane } from "./workspace-inspector-pane";
63import { WorkspaceContentWidthContext } from "./workspace-content-width";
64​
65interface AdaptiveWorkspaceContextValue {
66 readonly layout: Layout;
67 readonly panes: WorkspacePaneLayout;
68 readonly fileInspector: FileInspectorPaneLayout;
69 readonly primarySidebarSearchQuery: string;
70 readonly selectThread: (thread: EnvironmentThreadShell) => void;
71 readonly activateAuxiliaryPaneRole: (role: WorkspaceAuxiliaryPaneRole) => () => void;
72 /**
73 * Route screens hand their inspector pane content to the workspace so it
74 * renders BESIDE the navigator (outside the native stack header) instead of
75 * inside the route. Returns a deactivate callback: the pane animates closed
76 * (content kept mounted for the exit transition) unless a newer
77 * registration already took over — stale deactivates never clobber it.
78 * Prefer useRegisterWorkspaceInspector over calling this directly.
79 */
80 readonly registerWorkspaceInspector: (render: () => ReactNode) => () => void;
81 readonly setPrimarySidebarSearchQuery: (query: string) => void;
82 readonly showAuxiliaryPane: (role: WorkspaceAuxiliaryPaneRole) => void;
83 readonly toggleAuxiliaryPane: () => void;
84 readonly togglePrimarySidebar: () => void;
85 readonly setAuxiliaryPaneWidth: (width: number) => void;
87​
88const compactLayout = deriveLayout({ width: 0, height: 0 });
89const compactPanes = deriveWorkspacePaneLayout({
90 layout: compactLayout,
91 viewportWidth: 0,
92 primarySidebarPreferredVisible: true,
93 auxiliaryPanePreferredVisible: true,
94});
95const compactFileInspector = deriveFileInspectorPaneLayout({
96 layout: compactLayout,
97 viewportWidth: 0,
98});
99const AdaptiveWorkspaceContext = createContext<AdaptiveWorkspaceContextValue>({
100 layout: compactLayout,
101 panes: compactPanes,
102 fileInspector: compactFileInspector,
103 primarySidebarSearchQuery: "",
104 selectThread: () => undefined,
105 activateAuxiliaryPaneRole: () => () => undefined,
106 registerWorkspaceInspector: () => () => undefined,
107 setPrimarySidebarSearchQuery: () => undefined,
108 showAuxiliaryPane: () => undefined,
109 toggleAuxiliaryPane: () => undefined,
110 togglePrimarySidebar: () => undefined,
111 setAuxiliaryPaneWidth: () => undefined,
112});
113​
114export function useAdaptiveWorkspaceLayout(): AdaptiveWorkspaceContextValue {
115 return use(AdaptiveWorkspaceContext);
117​
118export function useAdaptiveWorkspacePaneRole(role: WorkspaceAuxiliaryPaneRole) {
119 const { activateAuxiliaryPaneRole } = useAdaptiveWorkspaceLayout();
120​
121 useFocusEffect(
122 useCallback(() => activateAuxiliaryPaneRole(role), [activateAuxiliaryPaneRole, role]),
123 );
125​
126/**
127 * Register this screen's inspector pane content with the workspace column.
128 *
129 * The column renders BESIDE the navigator — outside any screen — so the
130 * registering screen's navigation and route contexts are captured here and
131 * re-provided around the portal content. Without them, useNavigation/useRoute
132 * inside the pane (e.g. GitOverviewSheet via useThreadSelection) throw
133 * "Couldn't find a route object".
134 *
135 * Registration is FOCUS-scoped, driven by navigation events rather than the
136 * screen's own render cycle: react-native-screens freezes blurred screens, so
137 * a cleanup that depends on the blurred subtree re-rendering never runs and
138 * would leak the pane into the next route. Blur deactivates the pane (it
139 * animates closed, or is replaced seamlessly when the next route registers in
140 * the same commit); focus re-registers it.
141 */
142export function useRegisterWorkspaceInspector(render: (() => ReactNode) | undefined) {
143 const { registerWorkspaceInspector } = useAdaptiveWorkspaceLayout();
144 // Raw context values (not the useNavigation/useRoute wrappers) so the
145 // portal re-provides exactly what this screen sees.
146 const navigation = use(NavigationContext);
147 const route = use(NavigationRouteContext);
148​
149 const wrappedRender = useMemo(() => {
150 if (render === undefined) {
151 return undefined;
152 }
153 return () => (
154 <NavigationContext.Provider value={navigation}>
155 <NavigationRouteContext.Provider value={route}>{render()}</NavigationRouteContext.Provider>
156 </NavigationContext.Provider>
157 );
158 }, [navigation, render, route]);
159​
160 const wrappedRenderRef = useRef(wrappedRender);
161 wrappedRenderRef.current = wrappedRender;
162 const focusedRef = useRef(false);
163 const deactivateRef = useRef<(() => void) | null>(null);
164​
165 const syncRegistration = useCallback(() => {
166 if (!focusedRef.current || wrappedRenderRef.current === undefined) {
167 deactivateRef.current?.();
168 return;
169 }
170 deactivateRef.current = registerWorkspaceInspector(wrappedRenderRef.current);
171 }, [registerWorkspaceInspector]);
172​
173 // Focus lifecycle. Blur/focus events fire even when the blurred subtree is
174 // frozen (events are navigation-driven, renders are not).
175 useFocusEffect(
176 useCallback(() => {
177 focusedRef.current = true;
178 syncRegistration();
179 return () => {
180 focusedRef.current = false;
181 syncRegistration();
182 };
183 }, [syncRegistration]),
184 );
185​
186 // Content changes while focused re-register in place.
187 useEffect(() => {
188 if (focusedRef.current) {
189 syncRegistration();
190 }
191 }, [syncRegistration, wrappedRender]);
192​
193 // Unmount: hand the pane back (owner-guarded, so a route that already
194 // took over is unaffected).
195 useEffect(
196 () => () => {
197 deactivateRef.current?.();
198 deactivateRef.current = null;
199 },
200 [],
201 );
203​
204export function AdaptiveWorkspaceLayout(props: {
205 readonly children: ReactNode;
206 readonly pathname: string;
207 readonly workspaceRouteKey: string | undefined;
208}) {
209 const preferencesResult = useAtomValue(mobilePreferencesAtom);
210 if (!AsyncResult.isSuccess(preferencesResult)) {
211 return AsyncResult.isFailure(preferencesResult) ? (
212 <AdaptiveWorkspaceLayoutContent
213 {...props}
214 projectGroupingMode={DEFAULT_MOBILE_PROJECT_GROUPING_SETTINGS.sidebarProjectGroupingMode}
215 />
216 ) : null;
217 }
218 const groupingSettings = resolveMobileProjectGroupingSettings(preferencesResult.value);
219 return (
220 <AdaptiveWorkspaceLayoutContent
221 {...props}
222 projectGroupingMode={groupingSettings.sidebarProjectGroupingMode}
223 />
224 );
226​
227function AdaptiveWorkspaceLayoutContent(
228 props: {
229 readonly children: ReactNode;
230 readonly pathname: string;
231 readonly workspaceRouteKey: string | undefined;
232 } & {
233 readonly projectGroupingMode: SidebarProjectGroupingMode;
234 },
235) {
236 const projectGroupingMode = props.projectGroupingMode;
237 const { materialYouStyleLayoutActive } = useAppearancePreferences();
238 const { width, height } = useWindowDimensions();
239 const pathname = props.pathname;
240 const navigation = useNavigation();
241 const activeRoleOwner = useRef<symbol | null>(null);
242 const [primarySidebarPreferredVisible, setPrimarySidebarPreferredVisible] = useState(true);
243 const [supplementaryPanePreferredVisible, setSupplementaryPanePreferredVisible] = useState(true);
244 const [supplementaryPanePreferredWidth, setSupplementaryPanePreferredWidth] = useState<
245 number | null
246 >(null);
247 const [fileInspectorPreferredVisible, setFileInspectorPreferredVisible] = useState(true);
248 const [fileInspectorPreferredWidth, setFileInspectorPreferredWidth] = useState<number | null>(
249 null,
250 );
251 const [primarySidebarSearchQuery, setPrimarySidebarSearchQuery] = useState("");
252 const [focusedAuxiliaryPaneRole, setFocusedAuxiliaryPaneRole] =
253 useState<WorkspaceAuxiliaryPaneRole | null>(null);
254 const baseLayout = useMemo(() => deriveLayout({ width, height }), [height, width]);
255 const layout = baseLayout;
256 // In split layouts the sidebar IS the thread list — it renders on every
257 // route, including Home (which shows an empty-detail pane instead of the
258 // compact list).
259 const shouldRenderPrimarySidebar = layout.usesSplitView;
260 const fileInspector = useMemo(
261 () =>
262 deriveFileInspectorPaneLayout({
263 layout,
264 viewportWidth: width,
265 preferredWidth: fileInspectorPreferredWidth ?? undefined,
266 reservedLeadingWidth:
267 shouldRenderPrimarySidebar && primarySidebarPreferredVisible
268 ? (layout.listPaneWidth ?? 0)
269 : 0,
270 }),
271 [
272 fileInspectorPreferredWidth,
273 layout,
274 primarySidebarPreferredVisible,
275 shouldRenderPrimarySidebar,
276 width,
277 ],
278 );
279 const auxiliaryPaneRole: WorkspaceAuxiliaryPaneRole =
280 focusedAuxiliaryPaneRole ?? (/\/files(?:\/|$)/.test(pathname) ? "inspector" : "supplementary");
281 const auxiliaryPanePreferredVisible =
282 auxiliaryPaneRole === "inspector"
283 ? fileInspectorPreferredVisible
284 : supplementaryPanePreferredVisible;
285 const auxiliaryPanePreferredWidth =
286 auxiliaryPaneRole === "inspector"
287 ? fileInspectorPreferredWidth
288 : supplementaryPanePreferredWidth;
289 const panes = useMemo(
290 () =>
291 deriveWorkspacePaneLayout({
292 layout,
293 viewportWidth: width,
294 primarySidebarPreferredVisible,
295 auxiliaryPanePreferredVisible,
296 auxiliaryPaneRole,
297 auxiliaryPanePreferredWidth: auxiliaryPanePreferredWidth ?? undefined,
298 }),
299 [
300 auxiliaryPanePreferredVisible,
301 auxiliaryPaneRole,
302 auxiliaryPanePreferredWidth,
303 layout,
304 primarySidebarPreferredVisible,
305 width,
306 ],
307 );
308 const activeThread = parseActiveThreadPath(pathname);
309 const environmentId = activeThread?.environmentId ?? null;
310 const threadId = activeThread?.threadId ?? null;
311 const selectedThreadKey = useMemo(() => {
312 if (environmentId === null || threadId === null) {
313 return null;
314 }
315 try {
316 return scopedThreadKey(EnvironmentId.make(environmentId), ThreadId.make(threadId));
317 } catch {
318 return null;
319 }
320 }, [environmentId, threadId]);
321 // Wrapped in an object: bare functions in useState would be treated as
322 // lazy initializers/updaters. `active: false` keeps the outgoing route's
323 // content mounted so the pane can animate closed (or be replaced
324 // seamlessly by the next route's registration in the same commit).
325 const [workspaceInspector, setWorkspaceInspector] = useState<{
326 readonly render: () => ReactNode;
327 readonly active: boolean;
328 } | null>(null);
329 const workspaceInspectorOwner = useRef<symbol | null>(null);
330 const registerWorkspaceInspector = useCallback((render: () => ReactNode) => {
331 const owner = Symbol("workspace-inspector");
332 workspaceInspectorOwner.current = owner;
333 setWorkspaceInspector({ render, active: true });
334​
335 return () => {
336 // During a push/replace the outgoing screen deactivates AFTER the
337 // incoming screen registered — only the current owner may deactivate.
338 if (workspaceInspectorOwner.current !== owner) {
339 return;
340 }
341 setWorkspaceInspector((current) => (current === null ? null : { ...current, active: false }));
342 };
343 }, []);
344 // Once the close animation settles, drop the stale content entirely.
345 const handleWorkspaceInspectorClosed = useCallback(() => {
346 setWorkspaceInspector((current) => (current !== null && !current.active ? null : current));
347 }, []);
348 const activateAuxiliaryPaneRole = useCallback((role: WorkspaceAuxiliaryPaneRole) => {
349 const owner = Symbol(role);
350 activeRoleOwner.current = owner;
351 setFocusedAuxiliaryPaneRole(role);
352​
353 return () => {
354 if (activeRoleOwner.current !== owner) {
355 return;
356 }
357 activeRoleOwner.current = null;
358 setFocusedAuxiliaryPaneRole(null);
359 };
360 }, []);
361 const togglePrimarySidebar = useCallback(() => {
362 if (!panes.primarySidebarVisible && panes.primarySidebarSuppressedByAuxiliary) {
363 setFileInspectorPreferredVisible(false);
364 setPrimarySidebarPreferredVisible(true);
365 return;
366 }
367 setPrimarySidebarPreferredVisible((current) => !current);
368 }, [panes.primarySidebarSuppressedByAuxiliary, panes.primarySidebarVisible]);
369 const revealPrimarySidebar = useCallback(() => {
370 if (panes.primarySidebarSuppressedByAuxiliary) {
371 setFileInspectorPreferredVisible(false);
372 }
373 setPrimarySidebarPreferredVisible(true);
374 }, [panes.primarySidebarSuppressedByAuxiliary]);
375 const handleToggleSidebarCommand = useCallback(() => {
376 togglePrimarySidebar();
377 return true;
378 }, [togglePrimarySidebar]);
379 useHardwareKeyboardCommand("toggleSidebar", handleToggleSidebarCommand);
380 const showAuxiliaryPane = useCallback((role: WorkspaceAuxiliaryPaneRole) => {
381 if (role === "inspector") {
382 setFocusedAuxiliaryPaneRole("inspector");
383 setFileInspectorPreferredVisible(true);
384 return;
385 }
386 setFocusedAuxiliaryPaneRole("supplementary");
387 setSupplementaryPanePreferredVisible(true);
388 }, []);
389 const handleOpenFilesCommand = useCallback(() => {
390 const activeThread = parseActiveThreadPath(pathname);
391 if (!layout.usesSplitView || !fileInspector.supported || activeThread === null) {
392 return false;
393 }
394 showAuxiliaryPane("inspector");
395 if (/\/files(?:\/|$)/.test(pathname)) {
396 return true;
397 }
398 navigation.navigate("ThreadFiles", activeThread);
399 return true;
400 }, [fileInspector.supported, layout.usesSplitView, pathname, navigation, showAuxiliaryPane]);
401 useHardwareKeyboardCommand("files", handleOpenFilesCommand);
402 const toggleAuxiliaryPane = useCallback(() => {
403 if (auxiliaryPaneRole === "inspector") {
404 setFileInspectorPreferredVisible((current) => !current);
405 return;
406 }
407 setSupplementaryPanePreferredVisible((current) => !current);
408 }, [auxiliaryPaneRole]);
409 const setAuxiliaryPaneWidth = useCallback(
410 (nextWidth: number) => {
411 if (auxiliaryPaneRole === "inspector") {
412 setFileInspectorPreferredWidth(nextWidth);
413 return;
414 }
415 setSupplementaryPanePreferredWidth(nextWidth);
416 },
417 [auxiliaryPaneRole],
418 );
419 const handleOpenSettings = useCallback(() => {
420 navigation.navigate("SettingsSheet", {
421 screen: "SettingsContent",
422 params: { screen: "Settings" },
423 });
424 }, [navigation]);
425​
426 const handleStartNewTask = useCallback(() => {
427 navigation.navigate("NewTaskSheet", { screen: "NewTask" });
428 }, [navigation]);
429​
430 // Minted here (root stack navigation) so the sidebar pane stays free of
431 // navigation hooks — on iOS it renders inside an independent nav tree.
432 const handleOpenEnvironmentSettings = useCallback(() => {
433 navigation.navigate("SettingsSheet", {
434 screen: "SettingsContent",
435 params: { screen: "SettingsEnvironments" },
436 });
437 }, [navigation]);
438​
439 const handleNewThreadOnBranch = useCallback(
440 (thread: EnvironmentThreadShell) => {
441 navigation.navigate("NewTaskSheet", {
442 screen: "NewTaskDraft",
443 params: {
444 environmentId: String(thread.environmentId),
445 projectId: String(thread.projectId),
446 branch: thread.branch,
447 worktreePath: thread.worktreePath,
448 },
449 });
450 },
451 [navigation],
452 );
453​
454 const handleNewThreadInProject = useCallback(
455 (project: EnvironmentProject) => {
456 navigation.navigate("NewTaskSheet", {
457 screen: "NewTaskDraft",
458 params: {
459 environmentId: String(project.environmentId),
460 projectId: String(project.id),
461 title: project.title,
462 },
463 });
464 },
465 [navigation],
466 );
467​
468 const renderedSidebarWidth = useSharedValue(
469 panes.primarySidebarVisible ? (layout.listPaneWidth ?? 0) : 0,
470 );
471 useEffect(() => {
472 const targetWidth = panes.primarySidebarVisible ? (layout.listPaneWidth ?? 0) : 0;
473 renderedSidebarWidth.value = withTiming(targetWidth, WORKSPACE_PANE_TIMING);
474 }, [layout.listPaneWidth, panes.primarySidebarVisible, renderedSidebarWidth]);
475 const sidebarAnimatedStyle = useAnimatedStyle(() => ({
476 opacity: Math.min(1, renderedSidebarWidth.value / 80),
477 width: renderedSidebarWidth.value,
478 }));
479​
480 // Freeze the content pane at its SETTLED width while the side panes
481 // animate. The navigator (native header + markdown feed) lays out ONCE per
482 // pane toggle instead of re-measuring on every animation frame — the
483 // animating columns merely clip/reveal it over a matching background.
484 // Continuously re-wrapping the chat feed was the main source of dropped
485 // frames during sidebar/inspector transitions.
486 const inspectorColumnTargetWidth =
487 workspaceInspector !== null && workspaceInspector.active && panes.auxiliaryPaneVisible
488 ? (panes.auxiliaryPaneWidth ?? 0)
489 : 0;
490 const contentSettledWidth = layout.usesSplitView
491 ? Math.max(0, panes.contentPaneWidth - inspectorColumnTargetWidth)
492 : null;
493 const renderedInspectorWidth = useSharedValue(inspectorColumnTargetWidth);
494 const renderedContentWidth = useDerivedValue(() =>
495 Math.max(0, width - renderedSidebarWidth.value - renderedInspectorWidth.value),
496 );
497​
498 const handleSelectThread = useCallback(
499 (thread: EnvironmentThreadShell) => {
500 const params = {
501 environmentId: String(thread.environmentId),
502 threadId: String(thread.id),
503 };
504 const navigationAction = resolveThreadSelectionNavigationAction({
505 usesSplitView: layout.usesSplitView,
506 pathname,
507 });
508 const overlayState = resolveThreadSelectionOverlayState({
509 state: navigation.getState(),
510 workspaceRouteKey: props.workspaceRouteKey,
511 action: navigationAction,
512 params,
513 });
514 if (overlayState !== null) {
515 setFileInspectorPreferredVisible(false);
516 navigation.dispatch(CommonActions.reset(overlayState));
517 return;
518 }
519 if (navigationAction === "set-params") {
520 const nextThreadKey = scopedThreadKey(thread.environmentId, thread.id);
521 if (nextThreadKey === selectedThreadKey) {
522 return;
523 }
524 setFileInspectorPreferredVisible(false);
525 navigation.navigate("Thread", params);
526 return;
527 }
528 if (navigationAction === "replace") {
529 setFileInspectorPreferredVisible(false);
530 navigation.dispatch(StackActions.replace("Thread", params));
531 return;
532 }
533 navigation.navigate("Thread", params);
534 },
535 [layout.usesSplitView, pathname, navigation, selectedThreadKey, props.workspaceRouteKey],
536 );
537​
538 const contextValue = useMemo(
539 () => ({
540 layout,
541 panes,
542 fileInspector,
543 primarySidebarSearchQuery,
544 selectThread: handleSelectThread,
545 activateAuxiliaryPaneRole,
546 registerWorkspaceInspector,
547 setPrimarySidebarSearchQuery,
548 showAuxiliaryPane,
549 toggleAuxiliaryPane,
550 togglePrimarySidebar,
551 setAuxiliaryPaneWidth,
552 }),
553 [
554 activateAuxiliaryPaneRole,
555 fileInspector,
556 handleSelectThread,
557 layout,
558 panes,
559 primarySidebarSearchQuery,
560 registerWorkspaceInspector,
561 showAuxiliaryPane,
562 setPrimarySidebarSearchQuery,
563 setAuxiliaryPaneWidth,
564 toggleAuxiliaryPane,
565 togglePrimarySidebar,
566 ],
567 );
568​
569 return (
570 <HomeListOptionsProvider projectGroupingMode={projectGroupingMode}>
571 <AdaptiveWorkspaceContext.Provider value={contextValue}>
572 <View testID="adaptive-workspace-layout" className="flex-1 flex-row">
573 {shouldRenderPrimarySidebar && layout.listPaneWidth !== null ? (
574 <Animated.View
575 className="self-stretch overflow-hidden"
576 accessibilityElementsHidden={!panes.primarySidebarVisible}
577 collapsable={false}
578 importantForAccessibility={
579 panes.primarySidebarVisible ? "auto" : "no-hide-descendants"
580 }
581 pointerEvents={panes.primarySidebarVisible ? "auto" : "none"}
582 style={sidebarAnimatedStyle}
583 >
584 <View className="flex-1" style={{ width: layout.listPaneWidth }}>
585 <AndroidHomeFabLayout onStartNewTask={handleStartNewTask}>
586 <ThreadNavigationSidebar
587 width={layout.listPaneWidth}
588 visible={panes.primarySidebarVisible}
589 onRequestVisibility={revealPrimarySidebar}
590 selectedThreadKey={selectedThreadKey}
591 onOpenSettings={handleOpenSettings}
592 onOpenEnvironmentSettings={handleOpenEnvironmentSettings}
593 onNewThreadInProject={handleNewThreadInProject}
594 onNewThreadOnBranch={handleNewThreadOnBranch}
595 onSelectThread={handleSelectThread}
596 onSearchQueryChange={setPrimarySidebarSearchQuery}
597 searchQuery={primarySidebarSearchQuery}
598 />
599 </AndroidHomeFabLayout>
600 </View>
601 </Animated.View>
602 ) : null}
603 <View
604 className={
605 materialYouStyleLayoutActive
606 ? "flex-1 overflow-hidden bg-header"
607 : "flex-1 overflow-hidden bg-screen"
608 }
609 collapsable={false}
610 >
611 <View
612 collapsable={false}
613 style={
614 contentSettledWidth !== null ? { flex: 1, width: contentSettledWidth } : { flex: 1 }
615 }
616 >
617 <WorkspaceContentWidthContext
618 value={layout.usesSplitView ? renderedContentWidth : null}
619 >
620 {props.children}
621 </WorkspaceContentWidthContext>
622 </View>
623 </View>
624 <WorkspaceInspectorPane
625 renderedInspectorWidth={renderedInspectorWidth}
626 active={workspaceInspector?.active ?? false}
627 panes={panes}
628 renderInspector={workspaceInspector?.render}
629 setAuxiliaryPaneWidth={setAuxiliaryPaneWidth}
630 onClosed={handleWorkspaceInspectorClosed}
631 />
632 </View>
633 </AdaptiveWorkspaceContext.Provider>
634 </HomeListOptionsProvider>
635 );