Skip to content

Commit 3cd2729

Browse files
author
Dylan Huang
committed
Update ChatInterface component to adjust maximum width calculation for chat window resizing from 80% to 66% of the available width, improving layout responsiveness.
1 parent 7ea7007 commit 3cd2729

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vite-app/src/components/ChatInterface.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ export const ChatInterface = ({ messages }: ChatInterfaceProps) => {
2727
const deltaX = e.clientX - initialMouseX;
2828
const newWidth = initialWidth + deltaX;
2929

30-
// Calculate max width as 80% of container width
30+
// Calculate max width as 66% of available width
31+
// Get the parent container that has the flex layout
32+
const parentContainer = chatContainerRef.current?.closest(".flex");
3133
const containerWidth =
32-
chatContainerRef.current?.parentElement?.clientWidth ||
33-
window.innerWidth;
34-
const maxWidth = containerWidth * 0.8;
34+
parentContainer?.clientWidth || window.innerWidth;
35+
const maxWidth = containerWidth * 0.66;
3536

36-
setChatWidth(Math.max(300, Math.min(maxWidth, newWidth))); // Min 300px, max 80% of container
37+
setChatWidth(Math.max(300, Math.min(maxWidth, newWidth))); // Min 300px, max 70% of container
3738
}
3839
};
3940

0 commit comments

Comments
 (0)