From 6356b3ca6dbf9389edab055dfa1d7b5ad454df0f Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Wed, 18 Feb 2026 22:58:28 -0800 Subject: [PATCH] Restore diff panel activity and worker pool wrapper Co-authored-by: codex --- apps/web/src/routes/_chat.tsx | 65 +++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/apps/web/src/routes/_chat.tsx b/apps/web/src/routes/_chat.tsx index 427982e1748299701f2a674f19cd6ad694c9316f..702e873b07fdf761c80121b9de3378e86257da4e 100644 --- a/apps/web/src/routes/_chat.tsx +++ b/apps/web/src/routes/_chat.tsx @@ -1,17 +1,78 @@ import { Outlet, createFileRoute } from "@tanstack/react-router"; +import { Activity, Suspense, lazy, type ReactNode } from "react"; -import DiffPanel from "../components/DiffPanel"; import Sidebar from "../components/Sidebar"; +import { useMediaQuery } from "../hooks/useMediaQuery"; import { useStore } from "../store"; +import { Sheet, SheetPopup } from "../components/ui/sheet"; + +const DiffPanel = lazy(() => import("../components/DiffPanel")); +const DiffWorkerPoolProvider = lazy(() => + import("../components/DiffPanel").then((module) => ({ + default: module.DiffWorkerPoolProvider, + })), +); +const DIFF_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 1180px)"; + +const DiffPanelWrapper = (props: { children: ReactNode; sheet: boolean }) => { + const { state, dispatch } = useStore(); + if (props.sheet) { + return ( + { + if (!open) { + dispatch({ type: "CLOSE_DIFF" }); + } + }} + > + + {props.children} + + + ); + } + + return ( + + ); +}; function ChatRouteLayout() { const { state } = useStore(); + const shouldUseDiffSheet = useMediaQuery(DIFF_INLINE_LAYOUT_MEDIA_QUERY); + + const diffLoadingFallback = + !state.diffOpen || shouldUseDiffSheet ? ( +
+ Loading diff viewer... +
+ ) : ( + + ); return (
- {state.diffOpen && } + + + + + + + + +
); } -- 2.54.0