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, 08:45 UTC
Prevent compact diff sidebar from breaking chat composer layout
- Add composer footer/action data attributes for targeted width measurement - Enforce a minimum composer width before allowing inline diff sidebar
Julius Marminge committed
Mar 9, 2026 at 11:17 UTC
e354e8697f490c729d7022b28e921f4c12e0a8ae
2 files changed
+19
-2
apps/web/src/components/ChatView.tsx
+2
-1
@@ -3707,6 +3707,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
3707
</div>
3708
) : (
3709
<div
3710
+ data-chat-composer-footer="true"
3711
className={cn(
3712
"flex items-center justify-between px-2.5 pb-2.5 sm:px-3 sm:pb-3",
3713
isComposerFooterCompact ? "gap-1.5" : "flex-wrap gap-2 sm:flex-nowrap sm:gap-0",
@@ -3835,7 +3836,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
3836
</div>
3837
3838
{/* Right side: send / stop button */}
3838
- <div className="flex shrink-0 items-center gap-2">
3839
+ <div data-chat-composer-actions="right" className="flex shrink-0 items-center gap-2">
3840
{isPreparingWorktree ? (
3841
<span className="text-muted-foreground/70 text-xs">Preparing worktree...</span>
3842
) : null}
apps/web/src/routes/_chat.$threadId.tsx
+17
-1
@@ -15,6 +15,7 @@ const DIFF_INLINE_LAYOUT_MEDIA_QUERY = "(max-width: 1180px)";
15
const DIFF_INLINE_SIDEBAR_WIDTH_STORAGE_KEY = "chat_diff_sidebar_width";
16
const DIFF_INLINE_DEFAULT_WIDTH = "clamp(28rem,48vw,44rem)";
17
const DIFF_INLINE_SIDEBAR_MIN_WIDTH = 26 * 16;
18
+const COMPOSER_COMPACT_MIN_LEFT_CONTROLS_WIDTH_PX = 208;
19
20
const DiffPanelSheet = (props: {
21
children: ReactNode;
@@ -91,8 +92,23 @@ const DiffPanelInlineSidebar = (props: {
92
composerViewport.clientWidth - viewportPaddingLeft - viewportPaddingRight,
93
);
94
const formRect = composerForm.getBoundingClientRect();
95
+ const composerFooter = composerForm.querySelector<HTMLElement>("[data-chat-composer-footer='true']");
96
+ const composerRightActions = composerForm.querySelector<HTMLElement>(
97
+ "[data-chat-composer-actions='right']",
98
+ );
99
+ const composerRightActionsWidth = composerRightActions?.getBoundingClientRect().width ?? 0;
100
+ const composerFooterGap = composerFooter
101
+ ? Number.parseFloat(window.getComputedStyle(composerFooter).columnGap) ||
102
+ Number.parseFloat(window.getComputedStyle(composerFooter).gap) ||
103
+ 0
104
+ : 0;
105
+ const minimumComposerWidth =
106
+ COMPOSER_COMPACT_MIN_LEFT_CONTROLS_WIDTH_PX +
107
+ composerRightActionsWidth +
108
+ composerFooterGap;
109
const hasComposerOverflow = composerForm.scrollWidth > composerForm.clientWidth + 0.5;
110
const overflowsViewport = formRect.width > viewportContentWidth + 0.5;
111
+ const violatesMinimumComposerWidth = composerForm.clientWidth + 0.5 < minimumComposerWidth;
112
113
if (previousSidebarWidth.length > 0) {
114
wrapper.style.setProperty("--sidebar-width", previousSidebarWidth);
@@ -100,7 +116,7 @@ const DiffPanelInlineSidebar = (props: {
116
wrapper.style.removeProperty("--sidebar-width");
117
}
118
103
- return !hasComposerOverflow && !overflowsViewport;
119
+ return !hasComposerOverflow && !overflowsViewport && !violatesMinimumComposerWidth;
120
},
121
[],
122
);