The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 17:15 UTC
Restore diff panel activity and worker pool wrapper
Co-authored-by: codex <codex@users.noreply.github.com>
Julius Marminge committed
Feb 18, 2026 at 22:58 UTC
6356b3ca6dbf9389edab055dfa1d7b5ad454df0f
1 file changed
+63
-2
apps/web/src/routes/_chat.tsx
+63
-2
@@ -1,17 +1,78 @@
1
import { Outlet, createFileRoute } from "@tanstack/react-router";
2
+import { Activity, Suspense, lazy, type ReactNode } from "react";
3
3
-import DiffPanel from "../components/DiffPanel";
4
import Sidebar from "../components/Sidebar";
5
+import { useMediaQuery } from "../hooks/useMediaQuery";
6
import { useStore } from "../store";
7
+import { Sheet, SheetPopup } from "../components/ui/sheet";
8
+
9
+const DiffPanel = lazy(() => import("../components/DiffPanel"));
10
+const DiffWorkerPoolProvider = lazy(() =>
11
+ import("../components/DiffPanel").then((module) => ({
12
+ default: module.DiffWorkerPoolProvider,
13
+ })),
14
+);
15
+const DIFF_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 1180px)";
16
+
17
+const DiffPanelWrapper = (props: { children: ReactNode; sheet: boolean }) => {
18
+ const { state, dispatch } = useStore();
19
+ if (props.sheet) {
20
+ return (
21
+ <Sheet
22
+ open={state.diffOpen}
23
+ onOpenChange={(open) => {
24
+ if (!open) {
25
+ dispatch({ type: "CLOSE_DIFF" });
26
+ }
27
+ }}
28
+ >
29
+ <SheetPopup
30
+ side="right"
31
+ showCloseButton={false}
32
+ keepMounted
33
+ className="w-[min(88vw,820px)] max-w-[820px] p-0"
34
+ >
35
+ {props.children}
36
+ </SheetPopup>
37
+ </Sheet>
38
+ );
39
+ }
40
+
41
+ return (
42
+ <aside className={state.diffOpen ? undefined : "hidden"} aria-hidden={!state.diffOpen}>
43
+ {props.children}
44
+ </aside>
45
+ );
46
+};
47
48
function ChatRouteLayout() {
49
const { state } = useStore();
50
+ const shouldUseDiffSheet = useMediaQuery(DIFF_INLINE_LAYOUT_MEDIA_QUERY);
51
+
52
+ const diffLoadingFallback =
53
+ !state.diffOpen || shouldUseDiffSheet ? (
54
+ <div className="flex h-full min-h-0 items-center justify-center px-4 text-center text-xs text-muted-foreground/70">
55
+ Loading diff viewer...
56
+ </div>
57
+ ) : (
58
+ <aside className="flex h-full w-[560px] shrink-0 items-center justify-center border-l border-border bg-card px-4 text-center text-xs text-muted-foreground/70">
59
+ Loading diff viewer...
60
+ </aside>
61
+ );
62
63
return (
64
<div className="flex h-screen overflow-hidden bg-background text-foreground isolate">
65
<Sidebar />
66
<Outlet />
14
- {state.diffOpen && <DiffPanel />}
67
+ <Activity mode={state.diffOpen ? "visible" : "hidden"}>
68
+ <DiffPanelWrapper sheet={shouldUseDiffSheet}>
69
+ <Suspense fallback={diffLoadingFallback}>
70
+ <DiffWorkerPoolProvider>
71
+ <DiffPanel mode={shouldUseDiffSheet ? "sheet" : "inline"} />
72
+ </DiffWorkerPoolProvider>
73
+ </Suspense>
74
+ </DiffPanelWrapper>
75
+ </Activity>
76
</div>
77
);
78
}