@devries-cameron20 / t3code Mirror · read-only / commits / 447d71d901
Fork 0

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 22, 10:45 UTC

fix(web): chat stays centered while the thread details card fits beside it (#25838)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Koushik_xd committed Oct 31, 2026 at 07:06 UTC 447d71d9012dd8e36af6bd8dc988af6a8d8c115a
2 files changed +8 -21
apps/web/src/components/chat/chatCanvasLayout.test.ts
+7 -5
@@ -102,17 +102,16 @@ describe("chat canvas layout", () => {
102 });
103 expect(result.frame).toEqual({ x: 1260, y: 351, width: 240, height: 365 });
104 expect(result.overlapsDetailsCard).toBe(false);
105 - expect(result.chat).toEqual({ left: 330, width: 736, insetStart: 0, insetEnd: 188 });
105 + expect(result.chat).toEqual({ left: 424, width: 736, insetStart: 0, insetEnd: 0 });
106 });
107 - it("centers the chat beside a details card it would crowd", () => {
107 + it("moves the chat left only as far as a details card it would crowd requires", () => {
108 const { chat } = resolveChatCanvasLayout({
109 container: { width: 1344, height: 988 },
110 maxChatWidth: 736,
111 detailsCard: { left: 1052, right: 1332, bottom: 339 },
112 preview: null,
113 });
114 - // Equal space on both sides of the chat.
115 - expect(chat).toMatchObject({ left: (1052 - 736) / 2, width: 736 });
114 + expect(chat).toMatchObject({ left: 1052 - 32 - 736, width: 736 });
115 });
116 it("keeps the chat canvas-centered when it clears the details card", () => {
117 const result = resolveChatCanvasLayout({
@@ -255,7 +254,7 @@ describe("chat canvas layout", () => {
254 const compact = layout(460);
255 expect(compact.frame!.x + compact.frame!.width).toBe(1572);
256 expect(compact.frame!.width).toBe(460);
258 - expect(compact.chat.left).toBe(330);
257 + expect(compact.chat.left).toBe(364);
258 expect(compact.overlapsDetailsCard).toBe(true);
259 expect(density(compact)).toBe("compact");
260 expectClear(compact);
@@ -295,6 +294,9 @@ describe("workspace card beside chat", () => {
294 detailsCard: { left: width - 292, right: width - 12, bottom: 400 },
295 preview: player,
296 });
297 + it("keeps chat centered while the card fits beside it", () => {
298 + expect(withCard(1500).chat).toEqual({ left: 382, width: 736, insetStart: 0, insetEnd: 0 });
299 + });
300 it("narrows chat only after it reaches the left padding", () => {
301 expect(withCard(1108).chat).toMatchObject({ left: 48, width: 736 });
302 expect(withCard(1028).chat).toEqual({ left: 48, width: 656, insetStart: 0, insetEnd: 276 });
apps/web/src/components/chat/chatCanvasLayout.ts
+1 -16
@@ -46,22 +46,7 @@ export function resolveChatCanvasLayout({
46 : container.width - padding;
47 const normalWidth = Math.max(0, Math.min(centeredWidth, laneRight - padding));
48 const canvasCenterLeft = (container.width - normalWidth) / 2;
49 - // Beside a card it would crowd, the chat centers between the card and the canvas edge. The shift
50 - // eases to zero as clearance grows, so very wide windows keep the chat still and a resize
51 - // never jumps it.
52 - const besideShift = detailsCard
53 - ? Math.min(
54 - (container.width - detailsCard.left) / 2,
55 - Math.max(
56 - 0,
57 - (container.width - detailsCard.left) / 2 - (laneRight - canvasCenterLeft - normalWidth),
58 - ),
59 - )
60 - : 0;
61 - const normalLeft = Math.max(
62 - padding,
63 - Math.min(canvasCenterLeft - besideShift, laneRight - normalWidth),
64 - );
49 + const normalLeft = Math.max(padding, Math.min(canvasCenterLeft, laneRight - normalWidth));
50 let chat = {
51 left: normalLeft,
52 width: normalWidth,