History

Fix plan composer layout and sidebar flex shrink behavior

- add `min-w-0` to chat/flex containers to prevent composer/sidebar overflow - move `BranchToolbar` into the chat column so layout stays aligned with plan sidebar - extract sidebar inset base classes to shared logic and add a regression test for `min-w-0`

Julius Marminge committed 8 months ago

Commit e9ffd571 parent 24122b14 files · +23 −11Browse files

Unified · Split

4 files
  1. apps/web/src/components/ChatView.tsx +10 −10
  2. apps/web/src/components/ui/sidebar.logic.ts +2 −0
  3. apps/web/src/components/ui/sidebar.test.tsx +9 −0
  4. apps/web/src/components/ui/sidebar.tsx +2 −1
apps/web/src/components/ChatView.tsx+10−10
@@ -3468,7 +3468,7 @@ export default function ChatView({ threadId }: ChatViewProps) { · 3467 unmodified lines
34683468 onDismiss={() => setThreadError(activeThread.id, null)}
34693469 />
34703470 {/* Main content area with optional plan sidebar */}
3471− <div className="flex min-h-0 flex-1">
3471+ <div className="flex min-h-0 min-w-0 flex-1">
34723472 {/* Chat column */}
34733473 <div className="flex min-h-0 min-w-0 flex-1 flex-col">
34743474
@@ -3953,6 +3953,15 @@ export default function ChatView({ threadId }: ChatViewProps) { · 478 unmodified lines
39533953 </form>
39543954 </div>
39553955
3956+ {isGitRepo && (
3957+ <BranchToolbar
3958+ threadId={activeThread.id}
3959+ onEnvModeChange={onEnvModeChange}
3960+ envLocked={envLocked}
3961+ onComposerFocusRequest={scheduleComposerFocus}
3962+ />
3963+ )}
3964+
39563965 </div>{/* end chat column */}
39573966
39583967 {/* Plan sidebar */}
@@ -3974,15 +3983,6 @@ export default function ChatView({ threadId }: ChatViewProps) { · 15 unmodified lines
39743983 ) : null}
39753984 </div>{/* end horizontal flex container */}
39763985
3977− {isGitRepo && (
3978− <BranchToolbar
3979− threadId={activeThread.id}
3980− onEnvModeChange={onEnvModeChange}
3981− envLocked={envLocked}
3982− onComposerFocusRequest={scheduleComposerFocus}
3983− />
3984− )}
3985−
39863986 {(() => {
39873987 if (!terminalState.terminalOpen || !activeProject) {
39883988 return null;
apps/web/src/components/ui/sidebar.logic.ts+2−0
@@ -0,0 +1,2 @@
1+export const SIDEBAR_INSET_BASE_CLASSNAME =
2+ "relative flex min-w-0 w-full flex-1 flex-col bg-background";
apps/web/src/components/ui/sidebar.test.tsx+9−0
@@ -0,0 +1,9 @@
1+import { describe, expect, it } from "vitest";
2+
3+import { SIDEBAR_INSET_BASE_CLASSNAME } from "./sidebar.logic";
4+
5+describe("SidebarInset", () => {
6+ it("stays shrinkable inside flex layouts", () => {
7+ expect(SIDEBAR_INSET_BASE_CLASSNAME).toContain("min-w-0");
8+ });
9+});
apps/web/src/components/ui/sidebar.tsx+2−1
@@ -18,6 +18,7 @@ import { · 17 unmodified lines
1818 import { Skeleton } from "~/components/ui/skeleton";
1919 import { Tooltip, TooltipPopup, TooltipTrigger } from "~/components/ui/tooltip";
2020 import { useMediaQuery } from "~/hooks/useMediaQuery";
21+import { SIDEBAR_INSET_BASE_CLASSNAME } from "./sidebar.logic";
2122
2223 const SIDEBAR_COOKIE_NAME = "sidebar_state";
2324 const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
@@ -595,7 +596,7 @@ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) { · 571 unmodified lines
595596 return (
596597 <main
597598 className={cn(
598− "relative flex w-full flex-1 flex-col bg-background",
599+ SIDEBAR_INSET_BASE_CLASSNAME,
599600 "md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ms-2 md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ms-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm/5",
600601 className,
601602 )}