Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: allow chat column to shrink below content min-content (#435)

Hiep Leba3ab462510e
diff --git a/__tests__/components/features/conversation/chat-interface-wrapper.test.tsx b/__tests__/components/features/conversation/chat-interface-wrapper.test.tsx
new file mode 100644
index 0000000000..9617e3fcb7
--- /dev/null
+++ b/__tests__/components/features/conversation/chat-interface-wrapper.test.tsx
@@ -0,0 +1,21 @@
+import { render, screen } from "@testing-library/react";
+import { describe, it, expect, vi } from "vitest";
+import { ChatInterfaceWrapper } from "#/components/features/conversation/conversation-main/chat-interface-wrapper";
+
+vi.mock("#/components/features/chat/chat-interface", () => ({
+ ChatInterface: () => <div data-testid="chat-interface" />,
+}));
+
+describe("ChatInterfaceWrapper", () => {
+ it("renders the chat interface when the right panel is hidden", () => {
+ render(<ChatInterfaceWrapper isRightPanelShown={false} />);
+
+ expect(screen.getByTestId("chat-interface")).toBeInTheDocument();
+ });
+
+ it("renders the chat interface when the right panel is shown", () => {
+ render(<ChatInterfaceWrapper isRightPanelShown />);
+
+ expect(screen.getByTestId("chat-interface")).toBeInTheDocument();
+ });
+});
diff --git a/src/components/features/conversation/conversation-main/chat-interface-wrapper.tsx b/src/components/features/conversation/conversation-main/chat-interface-wrapper.tsx
index 7acabf4c3b..ebe13ebd65 100644
--- a/src/components/features/conversation/conversation-main/chat-interface-wrapper.tsx
+++ b/src/components/features/conversation/conversation-main/chat-interface-wrapper.tsx
@@ -12,7 +12,7 @@ export function ChatInterfaceWrapper({
<div className="flex justify-center w-full h-full">
<div
className={cn(
- "w-full transition-all duration-300 ease-in-out",
+ "w-full min-w-0 transition-all duration-300 ease-in-out",
isRightPanelShown ? "max-w-4xl" : "max-w-6xl",
)}
>
diff --git a/src/routes/root-layout.tsx b/src/routes/root-layout.tsx
index a891c18278..d6306865be 100644
--- a/src/routes/root-layout.tsx
+++ b/src/routes/root-layout.tsx
@@ -107,7 +107,7 @@ export default function MainApp() {
<title>{appTitle}</title>
<Sidebar />
- <div className="flex flex-col w-full h-[calc(100%-50px)] md:h-full gap-3">
+ <div className="flex flex-col w-full min-w-0 h-[calc(100%-50px)] md:h-full gap-3">
{config.data &&
(config.data.maintenance_start_time ||
(config.data.faulty_models &&