Skip to content

🙌 OpenHands: AI-Driven Development

Improve UI consistency: themes, tokens, chat chrome, and right-panel tabs (#508)

FraterCCCLXIIIf37cd5bd179d
diff --git a/__tests__/components/features/chat/components/chat-input-model.test.tsx b/__tests__/components/features/chat/components/chat-input-model.test.tsx
index ce41334964..d34406b479 100644
--- a/__tests__/components/features/chat/components/chat-input-model.test.tsx
+++ b/__tests__/components/features/chat/components/chat-input-model.test.tsx
@@ -36,7 +36,7 @@ describe("ChatInputModel", () => {
const model = screen.getByTestId("chat-input-llm-model");
expect(model).toBeInTheDocument();
- expect(model).toHaveTextContent("openai/gpt-4o");
+ expect(model).toHaveTextContent("openai/gpt…");
expect(model).toHaveAttribute("title", "openai/gpt-4o");
expect(
screen.queryByTestId("chat-input-llm-model-popover"),
@@ -51,32 +51,6 @@ describe("ChatInputModel", () => {
expect(llmSettingsLink).toHaveAttribute("href", "/settings");
});
- it("renders long model names in full on both the button and the popover", () => {
- // Arrange — reproduces the bug-report scenario where a 24-char model name
- // was previously rendered as "claude-son…" on the button and wrapped onto
- // two lines inside the popover.
- const longModel = "claude-sonnet-4-20250514";
- useActiveConversationMock.mockReturnValue({
- data: {
- conversation_id: "test-conversation-id",
- llm_model: longModel,
- },
- });
-
- renderWithProviders(<ChatInputModel />);
-
- // Act
- const button = screen.getByTestId("chat-input-llm-model");
- fireEvent.click(button);
-
- // Assert — button shows the full name (no truncation),
- // and the popover renders the same full string.
- expect(button).toHaveTextContent(longModel);
- expect(
- screen.getByTestId("chat-input-llm-model-popover"),
- ).toHaveTextContent(longModel);
- });
-
it("renders nothing when llm_model is missing", () => {
useActiveConversationMock.mockReturnValue({
data: { conversation_id: "test-conversation-id" },
@@ -99,7 +73,10 @@ describe("ChatInputModel", () => {
renderWithProviders(<ChatInputModel />);
- expect(screen.getByTestId("chat-input-llm-model")).toHaveTextContent(
+ const model = screen.getByTestId("chat-input-llm-model");
+ expect(model).toHaveTextContent("anthropic/…");
+ expect(model).toHaveAttribute(
+ "title",
"anthropic/claude-sonnet-4-20250514",
);
});
diff --git a/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsx b/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsx
index 995429f0a2..166e1550c3 100644
--- a/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsx
+++ b/__tests__/components/features/conversation/conversation-tabs-context-menu.test.tsx
@@ -57,7 +57,6 @@ describe("ConversationTabsContextMenu", () => {
it("should render all default tabs when open", () => {
render(<ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />);
- // Default active backend is local, so the Code (vscode) entry is hidden.
const expectedTabs = [
"COMMON$PLANNER",
"COMMON$FILES",
@@ -70,7 +69,6 @@ describe("ConversationTabsContextMenu", () => {
});
it("should show the Code entry when the active backend is cloud", () => {
- // Arrange
seedActiveBackend({
id: "cloud-test",
name: "Cloud Test",
@@ -79,63 +77,64 @@ describe("ConversationTabsContextMenu", () => {
kind: "cloud",
});
- // Act
render(
<ActiveBackendProvider>
<ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />
</ActiveBackendProvider>,
);
- // Assert
expect(screen.getByText("COMMON$CODE")).toBeInTheDocument();
});
- it("should re-pin a tab when clicking an unpinned tab", async () => {
+ it("should open a tab from the label button without changing pin state", async () => {
const user = userEvent.setup();
render(<ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />);
- const terminalItem = screen.getByText("COMMON$TERMINAL");
+ await user.click(screen.getByTestId("conversation-tabs-menu-open-terminal"));
- // Unpin
- await user.click(terminalItem);
+ expect(useConversationStore.getState().selectedTab).toBe("terminal");
+ const storedState = JSON.parse(
+ localStorage.getItem(`conversation-state-${CONVERSATION_ID}`)!,
+ );
+ expect(storedState.unpinnedTabs).toEqual([]);
+ });
+
+ it("should re-pin a tab when clicking the pin control on an unpinned tab", async () => {
+ const user = userEvent.setup();
+
+ render(<ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />);
+
+ await user.click(screen.getByTestId("conversation-tabs-menu-pin-terminal"));
let storedState = JSON.parse(
localStorage.getItem(`conversation-state-${CONVERSATION_ID}`)!,
);
expect(storedState.unpinnedTabs).toContain("terminal");
- // Re-pin
- await user.click(terminalItem);
+ await user.click(screen.getByTestId("conversation-tabs-menu-pin-terminal"));
storedState = JSON.parse(
localStorage.getItem(`conversation-state-${CONVERSATION_ID}`)!,
);
expect(storedState.unpinnedTabs).not.toContain("terminal");
});
- it("should switch to another pinned tab when unpinning the currently active tab", async () => {
+ it("should switch to another pinned tab when unpinning the currently active tab via pin control", async () => {
const user = userEvent.setup();
render(<ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />);
- // Initially selected tab is "files"
expect(useConversationStore.getState().selectedTab).toBe("files");
- // Unpin the active "files" tab
- await user.click(screen.getByText("COMMON$FILES"));
+ await user.click(screen.getByTestId("conversation-tabs-menu-pin-files"));
- // Panel should still be shown
const storeState = useConversationStore.getState();
expect(storeState.hasRightPanelToggled).toBe(true);
-
- // Should have switched to another pinned tab (planner is first in list)
expect(storeState.selectedTab).toBe("planner");
- // Verify the files tab was unpinned
const storedState = JSON.parse(
localStorage.getItem(`conversation-state-${CONVERSATION_ID}`)!,
);
expect(storedState.unpinnedTabs).toContain("files");
- // Selected tab should be persisted as the new tab
expect(storedState.selectedTab).toBe("planner");
});
@@ -144,7 +143,7 @@ describe("ConversationTabsContextMenu", () => {
render(<ConversationTabsContextMenu isOpen={true} onClose={vi.fn()} />);
- await user.click(screen.getByText("COMMON$TERMINAL"));
+ await user.click(screen.getByTestId("conversation-tabs-menu-pin-terminal"));
const storeState = useConversationStore.getState();
expect(storeState.hasRightPanelToggled).toBe(true);
diff --git a/__tests__/components/features/conversation/conversation-tabs.test.tsx b/__tests__/components/features/conversation/conversation-tabs.test.tsx
index d64ed47fc8..bbac228d97 100644
--- a/__tests__/components/features/conversation/conversation-tabs.test.tsx
+++ b/__tests__/components/features/conversation/conversation-tabs.test.tsx
@@ -312,6 +312,49 @@ describe("ConversationTabs localStorage behavior", () => {
expect(testIds).toContain("conversation-tab-tasklist");
});
+ it("shows an unpinned tab in the bar while it is selected", () => {
+ mockConversationId = REAL_CONVERSATION_ID;
+ seedConversationState(REAL_CONVERSATION_ID, {
+ selectedTab: "planner",
+ unpinnedTabs: ["planner"],
+ });
+ useConversationStore.setState({
+ selectedTab: "planner",
+ isRightPanelShown: true,
+ hasRightPanelToggled: true,
+ });
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ expect(
+ screen.getByTestId("conversation-tab-planner"),
+ ).toBeInTheDocument();
+ });
+
+ it("hides an unpinned tab from the bar once another tab is selected", () => {
+ mockConversationId = REAL_CONVERSATION_ID;
+ seedConversationState(REAL_CONVERSATION_ID, {
+ selectedTab: "files",
+ unpinnedTabs: ["planner"],
+ });
+ useConversationStore.setState({
+ selectedTab: "files",
+ isRightPanelShown: true,
+ hasRightPanelToggled: true,
+ });
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ expect(
+ screen.queryByTestId("conversation-tab-planner"),
+ ).not.toBeInTheDocument();
+ expect(screen.getByTestId("conversation-tab-files")).toBeInTheDocument();
+ });
+
it("does not show the build button when the planner tab is inactive", () => {
setActiveTabState("files");
useConversationStore.setState({
diff --git a/__tests__/components/features/sidebar/sidebar.test.tsx b/__tests__/components/features/sidebar/sidebar.test.tsx
index 9ea4b9ae42..a7cae7901e 100644
--- a/__tests__/components/features/sidebar/sidebar.test.tsx
+++ b/__tests__/components/features/sidebar/sidebar.test.tsx
@@ -202,18 +202,19 @@ describe("Sidebar", () => {
["/automations"],
["/automations/abc-123"],
["/settings"],
+ ["/"],
])(
- "keeps the sidebar's default top padding on %s so spacing stays consistent with the conversations page",
+ "does not add md top padding to the sidebar shell on %s",
(currentPath) => {
renderSidebar(currentPath);
const sidebar = screen.getByRole("navigation").parentElement;
- expect(sidebar?.className).toMatch(/(^|\s)md:pt-4(\s|$)/);
+ expect(sidebar?.className).not.toMatch(/(^|\s)md:pt-4(\s|$)/);
expect(sidebar?.className).not.toMatch(/(^|\s)md:pt-6\.5(\s|$)/);
},
);
- it("renders sidebar nav links with the muted default text color", () => {
+ it("renders inactive sidebar nav links with the muted token color", () => {
renderSidebar("/skills");
const conversationsLink = screen.getByTestId("sidebar-conversations-link");
diff --git a/__tests__/routes/task-list-tab.test.tsx b/__tests__/routes/task-list-tab.test.tsx
index 83994b5a57..0b9153cde1 100644
--- a/__tests__/routes/task-list-tab.test.tsx
+++ b/__tests__/routes/task-list-tab.test.tsx
@@ -71,11 +71,11 @@ describe("TaskListTab", () => {
expect(container.querySelector("svg")).toBeInTheDocument();
});
- it("renders empty state message using Text component (span)", () => {
+ it("renders empty state message in a centered caption", () => {
render(<TaskListTab />);
const message = screen.getByText("No tasks yet");
- expect(message.tagName).toBe("SPAN");
+ expect(message.tagName).toBe("P");
});
it("renders task items when tasks exist", () => {
@@ -96,9 +96,7 @@ describe("TaskListTab", () => {
});
it("does not display task IDs", () => {
- setTasks([
- { id: "task-1", title: "First task", status: "todo" },
- ]);
+ setTasks([{ id: "task-1", title: "First task", status: "todo" }]);
render(<TaskListTab />);
@@ -117,13 +115,17 @@ describe("TaskListTab", () => {
// Find each task item via its text, then check the wrapper div
const activeItem = screen.getByText("Active task").closest("[data-name]");
const activeWrapper = activeItem?.parentElement;
- expect(activeWrapper?.className).toContain("bg-[var(--oh-surface-raised)]");
+ expect(activeWrapper?.className).toContain("oh-surface-raised");
const todoItem = screen.getByText("Todo task").closest("[data-name]");
- expect(todoItem?.parentElement?.className).not.toContain("bg-[var(--oh-surface-raised)]");
+ expect(todoItem?.parentElement?.className).not.toContain(
+ "oh-surface-raised",
+ );
const doneItem = screen.getByText("Done task").closest("[data-name]");
- expect(doneItem?.parentElement?.className).not.toContain("bg-[var(--oh-surface-raised)]");
+ expect(doneItem?.parentElement?.className).not.toContain(
+ "oh-surface-raised",
+ );
});
it("displays task notes when present and omits when absent", () => {
diff --git a/src/components/features/browser/empty-browser-message.tsx b/src/components/features/browser/empty-browser-message.tsx
index 3d8618c968..efd325e8f1 100644
--- a/src/components/features/browser/empty-browser-message.tsx
+++ b/src/components/features/browser/empty-browser-message.tsx
@@ -1,17 +1,14 @@
import { useTranslation } from "react-i18next";
import { IoIosGlobe } from "react-icons/io";
import { I18nKey } from "#/i18n/declaration";
+import { ConversationTabEmptyState } from "#/components/features/conversation/conversation-tab-empty-state";
export function EmptyBrowserMessage() {
const { t } = useTranslation("openhands");
return (
- <div className="flex flex-col items-center justify-center w-full h-full p-10 gap-4">
- <IoIosGlobe size={113} />
- <span className="text-[var(--oh-text-dim)] text-[19px] font-normal leading-5">
- {" "}
- {t(I18nKey.BROWSER$NO_PAGE_LOADED)}
- </span>
- </div>
+ <ConversationTabEmptyState icon={<IoIosGlobe />}>
+ {t(I18nKey.BROWSER$NO_PAGE_LOADED)}
+ </ConversationTabEmptyState>
);
}
diff --git a/src/components/features/chat/components/chat-input-grip.tsx b/src/components/features/chat/components/chat-input-grip.tsx
index fdf4852d34..1578f6210f 100644
--- a/src/components/features/chat/components/chat-input-grip.tsx
+++ b/src/components/features/chat/components/chat-input-grip.tsx
@@ -4,6 +4,7 @@ import { cn } from "#/utils/utils";
interface ChatInputGripProps {
gripRef: React.RefObject<HTMLDivElement | null>;
isGripVisible: boolean;
+ isGripDragging: boolean;
handleTopEdgeClick: (e: React.MouseEvent) => void;
handleGripMouseDown: (e: React.MouseEvent) => void;
handleGripTouchStart: (e: React.TouchEvent) => void;
@@ -12,26 +13,33 @@ interface ChatInputGripProps {
export function ChatInputGrip({
gripRef,
isGripVisible,
+ isGripDragging,
handleTopEdgeClick,
handleGripMouseDown,
handleGripTouchStart,
}: ChatInputGripProps) {
return (
<div
- className="absolute -top-[12px] left-0 w-full h-6 lg:h-3 z-20 group"
+ className="absolute top-0 left-0 w-full h-6 lg:h-3 z-20 group"
id="resize-grip"
onClick={handleTopEdgeClick}
>
- {/* Resize Grip - appears on hover of top edge area, when dragging, or when clicked */}
+ {/* Tall hit target; 1px line is drawn at top-0 (flush with chat input box) */}
<div
- ref={gripRef}
- className={cn(
- "absolute top-[4px] left-0 w-full h-[3px] bg-white cursor-ns-resize z-10 transition-opacity duration-200",
- isGripVisible ? "opacity-100" : "opacity-0 group-hover:opacity-100",
- )}
+ className="absolute inset-0 z-[1] cursor-ns-resize"
onMouseDown={handleGripMouseDown}
onTouchStart={handleGripTouchStart}
style={{ userSelect: "none" }}
+ aria-hidden
+ />
+ <div
+ ref={gripRef}
+ className={cn(
+ "pointer-events-none absolute top-0 left-0 w-full h-px bg-white z-[2] transition-opacity duration-200",
+ isGripVisible || isGripDragging
+ ? "opacity-100"
+ : "opacity-0 group-hover:opacity-100",
+ )}
/>
</div>
);
diff --git a/src/components/features/chat/components/chat-input-model.tsx b/src/components/features/chat/components/chat-input-model.tsx
index bc0b965875..f21f77acb8 100644
--- a/src/components/features/chat/components/chat-input-model.tsx
+++ b/src/components/features/chat/components/chat-input-model.tsx
@@ -11,6 +11,15 @@ import { cn } from "#/utils/utils";
import React from "react";
import { useTranslation } from "react-i18next";
+const MODEL_LABEL_MAX_CHARS = 10;
+
+function truncateModelLabel(model: string): string {
+ if (model.length <= MODEL_LABEL_MAX_CHARS) {
+ return model;
+ }
+ return `${model.slice(0, MODEL_LABEL_MAX_CHARS)}…`;
+}
+
export function ChatInputModel() {
const { t } = useTranslation("openhands");
const { data: conversation } = useActiveConversation();
@@ -27,6 +36,7 @@ export function ChatInputModel() {
if (!llmModel) {
return null;
}
+ const truncatedModelLabel = truncateModelLabel(llmModel);
return (
<div className="relative min-w-0">
@@ -46,7 +56,7 @@ export function ChatInputModel() {
setIsPopoverOpen((open) => !open);
}}
>
- <span>{llmModel}</span>
+ <span>{truncatedModelLabel}</span>
<ChevronDownSmallIcon
width={18}
height={18}
@@ -63,7 +73,7 @@ export function ChatInputModel() {
position="top"
alignment="left"
spacing="none"
- className="z-[60] mb-2 min-w-[200px]"
+ className="z-[60] mb-2 min-w-[200px] max-w-[320px]"
>
<li className="text-sm">
<div className="p-2 leading-5 text-white break-all">{llmModel}</div>
diff --git a/src/components/features/chat/custom-chat-input.tsx b/src/components/features/chat/custom-chat-input.tsx
index 7e82766a8e..4f5f6a49ec 100644
--- a/src/components/features/chat/custom-chat-input.tsx
+++ b/src/components/features/chat/custom-chat-input.tsx
@@ -97,6 +97,7 @@ export function CustomChatInput({
const {
gripRef,
isGripVisible,
+ isGripDragging,
handleTopEdgeClick,
smartResize,
handleGripMouseDown,
@@ -165,6 +166,7 @@ export function CustomChatInput({
<ChatInputGrip
gripRef={gripRef}
isGripVisible={isGripVisible}
+ isGripDragging={isGripDragging}
handleTopEdgeClick={handleTopEdgeClick}
handleGripMouseDown={handleGripMouseDown}
handleGripTouchStart={handleGripTouchStart}
diff --git a/src/components/features/chat/git-control-bar.tsx b/src/components/features/chat/git-control-bar.tsx
index 7670bd0a66..6117565c76 100644
--- a/src/components/features/chat/git-control-bar.tsx
+++ b/src/components/features/chat/git-control-bar.tsx
@@ -33,7 +33,6 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
const { conversationId } = useConversationId();
const [isOpenRepoModalOpen, setIsOpenRepoModalOpen] = useState(false);
const [isWorkspaceMenuOpen, setIsWorkspaceMenuOpen] = useState(false);
- const [isFolderBrowserOpen, _setIsFolderBrowserOpen] = useState(false);
const workspaceMenuContainerRef = useRef<HTMLDivElement>(null);
const { addRecentRepository } = useHomeStore();
const enqueuePendingMessage = useOptimisticUserMessageStore(
@@ -101,7 +100,7 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
const isConversationReady = !!conversation && webSocketStatus === "OPEN";
useEffect(() => {
- if (!isWorkspaceMenuOpen || isFolderBrowserOpen) return undefined;
+ if (!isWorkspaceMenuOpen) return undefined;
const onMouseDown = (event: MouseEvent) => {
if (
workspaceMenuContainerRef.current &&
@@ -112,10 +111,10 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
};
document.addEventListener("mousedown", onMouseDown);
return () => document.removeEventListener("mousedown", onMouseDown);
- }, [isWorkspaceMenuOpen, isFolderBrowserOpen]);
+ }, [isWorkspaceMenuOpen]);
useEffect(() => {
- if (!isWorkspaceMenuOpen || isFolderBrowserOpen) return undefined;
+ if (!isWorkspaceMenuOpen) return undefined;
const onKeyDown = (event: KeyboardEvent) => {
if (event.key === "Escape") {
setIsWorkspaceMenuOpen(false);
@@ -123,7 +122,7 @@ export function GitControlBar({ onSuggestionsClick }: GitControlBarProps) {
};
window.addEventListener("keydown", onKeyDown);
return () => window.removeEventListener("keydown", onKeyDown);
- }, [isWorkspaceMenuOpen, isFolderBrowserOpen]);
+ }, [isWorkspaceMenuOpen]);
const handleLaunchRepository = (
repository: GitRepository,
diff --git a/src/components/features/conversation/conversation-loading.tsx b/src/components/features/conversation/conversation-loading.tsx
index d272400f44..a0b7ca2eb8 100644
--- a/src/components/features/conversation/conversation-loading.tsx
+++ b/src/components/features/conversation/conversation-loading.tsx
@@ -13,12 +13,21 @@ export function ConversationLoading({ className }: ConversationLoadingProps) {
return (
<div
className={cn(
- "bg-[var(--oh-surface)] flex flex-col items-center justify-center h-full w-full",
+ "bg-[var(--oh-surface)] flex h-full w-full flex-col items-center justify-center gap-3",
className,
)}
>
- <LoaderCircle className="animate-spin w-16 h-16" color="white" />
- <span className="text-2xl font-normal leading-5 text-white p-4">
+ <LoaderCircle
+ className="h-8 w-8 shrink-0 animate-spin text-[var(--oh-text-secondary)]"
+ aria-hidden
+ />
+ <span
+ className="text-base font-normal leading-5"
+ style={{
+ color: "var(--oh-focus, #ffffff)",
+ opacity: 0.8,
+ }}
+ >
{t(I18nKey.HOME$LOADING)}
</span>
</div>
diff --git a/src/components/features/conversation/conversation-main/conversation-main.tsx b/src/components/features/conversation/conversation-main/conversation-main.tsx
index 883a275372..69138d23a0 100644
--- a/src/components/features/conversation/conversation-main/conversation-main.tsx
+++ b/src/components/features/conversation/conversation-main/conversation-main.tsx
@@ -71,7 +71,7 @@ export function ConversationMain() {
>
<div
data-testid="chat-pane-header"
- className="flex items-center min-h-9 pt-2 lg:pt-0"
+ className="flex items-center h-10 min-h-10 shrink-0"
>
<ConversationNameWithStatus />
</div>
@@ -84,7 +84,7 @@ export function ConversationMain() {
{/* Resize Handle - only shown on desktop when right panel is visible */}
{!isMobile && isRightPanelShown && (
- <ResizeHandle onMouseDown={handleMouseDown} />
+ <ResizeHandle onMouseDown={handleMouseDown} isDragging={isDragging} />
)}
{/* Tab Content Panel - always mounted, styled as bottom sheet (mobile)
@@ -118,10 +118,10 @@ export function ConversationMain() {
: "flex flex-col h-full w-full",
)}
>
- <div className="flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border border-[var(--oh-border)] overflow-hidden">
+ <div className="flex flex-col flex-1 min-h-0 bg-[var(--oh-surface)] border-l border-[var(--oh-border)] overflow-hidden">
<div
data-testid="tabs-pane-header"
- className="flex items-center min-h-9 px-3 py-1.5 border-b border-[var(--oh-border)]"
+ className="flex shrink-0 flex-col border-b border-[var(--oh-border)]"
>
<ConversationTabs />
</div>
diff --git a/src/components/features/conversation/conversation-tab-empty-state.tsx b/src/components/features/conversation/conversation-tab-empty-state.tsx
new file mode 100644
index 0000000000..198d7a1c82
--- /dev/null
+++ b/src/components/features/conversation/conversation-tab-empty-state.tsx
@@ -0,0 +1,40 @@
+import type { ReactNode } from "react";
+import { cn } from "#/utils/utils";
+
+type ConversationTabEmptyStateProps = {
+ icon: ReactNode;
+ children: ReactNode;
+ action?: ReactNode;
+ className?: string;
+};
+
+/**
+ * Shared empty state for right-drawer conversation tabs: small muted icon,
+ * centered caption, optional action (use {@link BrandButton} variant="secondary").
+ */
+export function ConversationTabEmptyState({
+ icon,
+ children,
+ action,
+ className,
+}: ConversationTabEmptyStateProps) {
+ return (
+ <div
+ className={cn(
+ "flex flex-col items-center justify-center w-full h-full p-10 gap-4 text-center",
+ className,
+ )}
+ >
+ <div
+ className="shrink-0 text-[var(--oh-muted)] [&_svg]:size-10 [&_svg]:max-h-10 [&_svg]:max-w-10 [&_svg]:shrink-0"
+ aria-hidden
+ >
+ {icon}
+ </div>
+ <p className="max-w-sm text-center text-sm font-normal leading-5 text-[var(--oh-muted)]">
+ {children}
+ </p>
+ {action ? <div className="flex justify-center pt-1">{action}</div> : null}
+ </div>
+ );
+}
diff --git a/src/components/features/conversation/conversation-tabs/conversation-tab-nav.tsx b/src/components/features/conversation/conversation-tabs/conversation-tab-nav.tsx
index 3219951049..ba4ba16b33 100644
--- a/src/components/features/conversation/conversation-tabs/conversation-tab-nav.tsx
+++ b/src/components/features/conversation/conversation-tabs/conversation-tab-nav.tsx
@@ -8,6 +8,8 @@ type ConversationTabNavProps = {
isActive?: boolean;
label?: string;
className?: string;
+ /** Omit test id (e.g. offscreen width measurement clones). */
+ measureOnly?: boolean;
};
export function ConversationTabNav({
@@ -17,6 +19,7 @@ export function ConversationTabNav({
isActive,
label,
className,
+ measureOnly,
}: ConversationTabNavProps) {
return (
<button
@@ -24,14 +27,17 @@ export function ConversationTabNav({
onClick={() => {
onClick();
}}
- data-testid={`conversation-tab-${tabValue}`}
+ {...(measureOnly
+ ? {}
+ : { "data-testid": `conversation-tab-${tabValue}` as const })}
+ data-tab-measure={measureOnly ? "true" : undefined}
className={cn(
"flex items-center gap-2 rounded-md cursor-pointer",
"pl-1.5 pr-2 py-1 lg:py-1.5",
"text-[var(--oh-muted)] bg-transparent",
- isActive && "bg-base text-white",
+ isActive && "bg-[var(--oh-interactive-active)] text-white",
isActive
- ? "hover:text-white hover:bg-base"
+ ? "hover:text-white hover:bg-[var(--oh-interactive-hover)]"
: "hover:text-white hover:bg-white/5",
isActive
? "focus-within:text-white"
diff --git a/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsx b/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsx
index e9a82fe7ac..80c18eab63 100644
--- a/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsx
+++ b/src/components/features/conversation/conversation-tabs/conversation-tabs-context-menu.tsx
@@ -1,6 +1,5 @@
import { useTranslation } from "react-i18next";
import { ContextMenu } from "#/ui/context-menu";
-import { ContextMenuListItem } from "../../context-menu/context-menu-list-item";
import { useClickOutsideElement } from "#/hooks/use-click-outside-element";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useConversationLocalStorageState } from "#/utils/conversation-local-storage";
@@ -19,6 +18,8 @@ import LessonPlanIcon from "#/icons/lesson-plan.svg?react";
import DoubleCheckIcon from "#/icons/double-check.svg?react";
import { useTaskList } from "#/hooks/use-task-list";
import { useActiveBackend } from "#/contexts/active-backend-context";
+import { useSelectConversationTab } from "#/hooks/use-select-conversation-tab";
+import { cn } from "#/utils/utils";
interface ConversationTabsContextMenuProps {
isOpen: boolean;
@@ -40,6 +41,8 @@ export function ConversationTabsContextMenu({
const { selectedTab, isRightPanelShown, setSelectedTab } =
useConversationStore();
+ const { navigateToTab } = useSelectConversationTab();
+
const { hasTaskList } = useTaskList();
const { backend } = useActiveBackend();
@@ -63,38 +66,36 @@ export function ConversationTabsContextMenu({
});
}
- // Hide the VSCode pin/unpin entry on local backends, mirroring the tab bar.
const visibleTabConfig = tabConfig.filter(
({ tab }) => tab !== "vscode" || backend.kind === "cloud",
);
if (!isOpen) return null;
- const handleTabClick = (tab: string) => {
+ const handleOpenTab = (tab: string) => {
+ navigateToTab(tab as ConversationTab);
+ onClose();
+ };
+
+ const handlePinToggle = (tab: string, e: React.MouseEvent) => {
+ e.preventDefault();
+ e.stopPropagation();
if (state.unpinnedTabs.includes(tab)) {
- // Re-pinning a tab
setUnpinnedTabs(state.unpinnedTabs.filter((item) => item !== tab));
} else {
- // Unpinning a tab
const newUnpinnedTabs = [...state.unpinnedTabs, tab];
setUnpinnedTabs(newUnpinnedTabs);
- // If we're unpinning the currently selected tab while the panel is open,
- // switch to another pinned tab instead of hiding the panel
if (selectedTab === tab && isRightPanelShown) {
- // Find the first tab that will still be pinned after this unpin
const nextPinnedTab = visibleTabConfig.find(
({ tab: tabKey }) =>
tabKey !== tab && !newUnpinnedTabs.includes(tabKey),
);
if (nextPinnedTab) {
- // Switch to another pinned tab
setSelectedTab(nextPinnedTab.tab as ConversationTab);
setPersistedSelectedTab(nextPinnedTab.tab as ConversationTab);
}
- // If no other tabs are pinned, the panel will still show the last tab's content
- // but the tab won't be highlighted (which is acceptable behavior)
}
}
};
@@ -104,24 +105,49 @@ export function ConversationTabsContextMenu({
ref={ref}
alignment="right"
position="bottom"
- className="mt-2 w-fit z-[9999]"
+ className="z-[9999] mt-2 w-fit"
>
{visibleTabConfig.map(({ tab, icon: Icon, i18nKey }) => {
const pinned = !state.unpinnedTabs.includes(tab);
return (
- <ContextMenuListItem
- key={tab}
- onClick={() => handleTabClick(tab)}
- className="flex items-center gap-2 p-2 hover:bg-[var(--oh-interactive-hover)] rounded h-[30px]"
- >
- <Icon className="w-4 h-4" />
- <span className="text-white text-sm">{t(i18nKey)}</span>
- {pinned ? (
- <PillFillIcon className="w-7 h-7 ml-auto -mr-[5px]" />
- ) : (
- <PillIcon className="w-4.5 h-4.5 ml-auto" />
- )}
- </ContextMenuListItem>
+ <li key={tab} className="list-none">
+ <div
+ className={cn(
+ "flex h-[30px] w-full min-w-0 items-stretch rounded",
+ "hover:bg-[var(--oh-interactive-hover)]",
+ )}
+ >
+ <button
+ type="button"
+ data-testid={`conversation-tabs-menu-open-${tab}`}
+ className={cn(
+ "flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-l p-2 text-start",
+ "text-white transition-colors",
+ )}
+ onClick={() => handleOpenTab(tab)}
+ >
+ <Icon className="h-4 w-4 shrink-0" />
+ <span className="text-sm">{t(i18nKey)}</span>
+ </button>
+ <button
+ type="button"
+ data-testid={`conversation-tabs-menu-pin-${tab}`}
+ className={cn(
+ "flex shrink-0 cursor-pointer items-center justify-center rounded-r px-2",
+ "text-white transition-colors hover:bg-white/10",
+ )}
+ aria-pressed={pinned}
+ aria-label={pinned ? "Unpin tab from bar" : "Pin tab to bar"}
+ onClick={(e) => handlePinToggle(tab, e)}
+ >
+ {pinned ? (
+ <PillFillIcon className="-mr-[5px] ml-auto h-7 w-7" />
+ ) : (
+ <PillIcon className="ml-auto h-4.5 w-4.5" />
+ )}
+ </button>
+ </div>
+ </li>
);
})}
</ContextMenu>
diff --git a/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx b/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx
index 0c9e19f28c..8670193867 100644
--- a/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx
+++ b/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from "react";
+import { useEffect, useLayoutEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import TerminalIcon from "#/icons/terminal.svg?react";
import GlobeIcon from "#/icons/globe.svg?react";
@@ -71,7 +71,7 @@ export function ConversationTabs() {
handlePanelVisibilityChange();
}, [isRightPanelShown, selectedTab, onTabChange]);
- const { t } = useTranslation("openhands");
+ const { t, i18n } = useTranslation("openhands");
// `files` is intentionally the leftmost tab — it's the primary entry
// point for inspecting agent output (workspace files + git diff).
@@ -137,84 +137,210 @@ export function ConversationTabs() {
});
}
- // Filter out unpinned tabs, and hide the VSCode tab on local backends
- // (the agent-server's VSCode URL is only reachable in cloud deployments).
+ // Pinned tabs always show in the bar. Unpinned tabs stay hidden unless the
+ // user has that tab selected — then it appears while active so the bar
+ // matches the open panel. Hide VS Code on local backends (cloud-only URL).
const visibleTabs = tabs.filter((tab) => {
if (tab.tabValue === "vscode" && backend.kind !== "cloud") return false;
- return !persistedState.unpinnedTabs.includes(tab.tabValue);
+ if (!persistedState.unpinnedTabs.includes(tab.tabValue)) return true;
+ return selectedTab === tab.tabValue;
});
+ const unpinnedSignature = persistedState.unpinnedTabs.join(",");
+
const isAgentRunning =
curAgentState === AgentState.RUNNING ||
curAgentState === AgentState.LOADING;
const isBuildDisabled = isAgentRunning || !planContent;
+ const tabsRowInnerRef = useRef<HTMLDivElement>(null);
+ const measureRowRef = useRef<HTMLDivElement>(null);
+ const menuRef = useRef<HTMLDivElement>(null);
+ const [inlineTabCount, setInlineTabCount] = useState(visibleTabs.length);
+
+ useLayoutEffect(() => {
+ const rowInner = tabsRowInnerRef.current;
+ const measureRow = measureRowRef.current;
+ const menuEl = menuRef.current;
+ if (!rowInner || !measureRow || !menuEl) return undefined;
+
+ const measure = () => {
+ const measureButtons = measureRow.querySelectorAll<HTMLButtonElement>(
+ '[data-tab-measure="true"]',
+ );
+ const tabCount = measureButtons.length;
+
+ const rowWidth = rowInner.getBoundingClientRect().width;
+ if (rowWidth === 0) {
+ setInlineTabCount(tabCount);
+ return;
+ }
+
+ const widths = Array.from(measureButtons).map(
+ (button) => button.getBoundingClientRect().width,
+ );
+
+ if (widths.length !== tabCount || tabCount === 0) {
+ setInlineTabCount(Math.max(0, tabCount));
+ return;
+ }
+
+ const menuWidth = menuEl.getBoundingClientRect().width;
+ const gapCss =
+ getComputedStyle(rowInner).columnGap || getComputedStyle(rowInner).gap;
+ const gapPx = parseFloat(gapCss) || 6;
+
+ let nextCount = 0;
+ for (let k = tabCount; k >= 0; k -= 1) {
+ let total = menuWidth;
+ for (let i = 0; i < k; i += 1) {
+ total += widths[i] ?? 0;
+ }
+ if (k > 0) {
+ total += k * gapPx;
+ }
+ if (total <= rowWidth + 0.5) {
+ nextCount = k;
+ break;
+ }
+ }
+
+ setInlineTabCount((prev) => (prev === nextCount ? prev : nextCount));
+ };
+
+ measure();
+ if (typeof ResizeObserver === "undefined") return undefined;
+ const ro = new ResizeObserver(measure);
+ ro.observe(rowInner);
+ return () => ro.disconnect();
+ }, [
+ unpinnedSignature,
+ visibleTabs.length,
+ hasTaskList,
+ backend.kind,
+ selectedTab,
+ isRightPanelShown,
+ i18n.language,
+ ]);
+
+ const safeInlineTabCount = Math.min(inlineTabCount, visibleTabs.length);
+
return (
- <div
- className={cn(
- "relative w-full",
- "flex flex-row justify-start lg:justify-end items-center gap-4.5 flex-wrap",
- )}
- >
- {visibleTabs.map(
- (
- {
- tabValue,
- icon,
- onClick,
- isActive,
- tooltipContent,
- tooltipAriaLabel,
- label,
- className,
- },
- index,
- ) => (
- <ChatActionTooltip
- key={index}
- tooltip={tooltipContent}
- ariaLabel={tooltipAriaLabel}
- >
- <ConversationTabNav
- tabValue={tabValue}
- icon={icon}
- onClick={onClick}
- isActive={isActive}
- label={label}
- className={className}
- />
- </ChatActionTooltip>
- ),
- )}
+ <>
+ <div className="relative min-h-10 w-full min-w-0 p-1">
+ <div
+ ref={measureRowRef}
+ aria-hidden
+ className="pointer-events-none absolute top-0 left-[-10000px] flex flex-nowrap items-center gap-1.5"
+ >
+ {visibleTabs.map(
+ (
+ {
+ tabValue,
+ icon,
+ isActive,
+ tooltipContent,
+ tooltipAriaLabel,
+ label,
+ className: tabClassName,
+ },
+ index,
+ ) => (
+ <ChatActionTooltip
+ key={`measure-${tabValue}-${index}`}
+ tooltip={tooltipContent}
+ ariaLabel={tooltipAriaLabel}
+ >
+ <ConversationTabNav
+ tabValue={tabValue}
+ icon={icon}
+ onClick={() => {}}
+ isActive={isActive}
+ label={label}
+ className={cn(tabClassName, "shrink-0")}
+ measureOnly
+ />
+ </ChatActionTooltip>
+ ),
+ )}
+ </div>
+ <div
+ ref={tabsRowInnerRef}
+ className="flex w-full min-w-0 flex-nowrap justify-start"
+ >
+ <div className="flex w-fit max-w-full min-w-0 flex-nowrap items-center gap-1.5">
+ <div className="flex min-w-0 flex-1 flex-nowrap items-center gap-1.5 overflow-x-hidden">
+ {visibleTabs
+ .slice(0, safeInlineTabCount)
+ .map(
+ (
+ {
+ tabValue,
+ icon,
+ onClick,
+ isActive,
+ tooltipContent,
+ tooltipAriaLabel,
+ label,
+ className: tabClassName,
+ },
+ index,
+ ) => (
+ <ChatActionTooltip
+ key={`${tabValue}-${index}`}
+ tooltip={tooltipContent}
+ ariaLabel={tooltipAriaLabel}
+ >
+ <ConversationTabNav
+ tabValue={tabValue}
+ icon={icon}
+ onClick={onClick}
+ isActive={isActive}
+ label={label}
+ className={cn(tabClassName, "shrink-0")}
+ />
+ </ChatActionTooltip>
+ ),
+ )}
+ </div>
+ <div ref={menuRef} className="relative shrink-0">
+ <EllipsisButton
+ onClick={() => setIsMenuOpen(!isMenuOpen)}
+ ariaLabel={t(I18nKey.COMMON$MORE_OPTIONS)}
+ />
+ <ConversationTabsContextMenu
+ isOpen={isMenuOpen}
+ onClose={() => setIsMenuOpen(false)}
+ />
+ </div>
+ </div>
+ </div>
+ </div>
{isTabActive("planner") && (
- <button
- type="button"
- onClick={handleBuildPlanClick}
- disabled={isBuildDisabled}
+ <div
className={cn(
- "flex items-center justify-center h-5 min-w-17 px-2 rounded bg-white transition-opacity",
- isBuildDisabled
- ? "opacity-50 cursor-not-allowed"
- : "hover:opacity-90 cursor-pointer",
+ "flex h-10 min-h-10 shrink-0 items-center border-t border-[var(--oh-border)] pl-[10px] pr-1",
)}
- data-testid="planner-tab-build-button"
>
- <Typography.Text className="text-black text-[11px] font-medium leading-5">
- {/* eslint-disable-next-line i18next/no-literal-string */}
- {t(I18nKey.COMMON$BUILD)} ⌘↩
- </Typography.Text>
- </button>
+ <button
+ type="button"
+ onClick={handleBuildPlanClick}
+ disabled={isBuildDisabled}
+ className={cn(
+ "flex h-5 min-w-17 items-center justify-center rounded bg-white px-2 transition-opacity",
+ isBuildDisabled
+ ? "cursor-not-allowed opacity-50"
+ : "cursor-pointer hover:opacity-90",
+ )}
+ data-testid="planner-tab-build-button"
+ >
+ <Typography.Text className="text-[11px] font-medium leading-5 text-black">
+ {/* eslint-disable-next-line i18next/no-literal-string */}
+ {t(I18nKey.COMMON$BUILD)} ⌘↩
+ </Typography.Text>
+ </button>
+ </div>
)}
- <div className="relative">
- <EllipsisButton
- onClick={() => setIsMenuOpen(!isMenuOpen)}
- ariaLabel={t(I18nKey.COMMON$MORE_OPTIONS)}
- />
- <ConversationTabsContextMenu
- isOpen={isMenuOpen}
- onClose={() => setIsMenuOpen(false)}
- />
- </div>
- </div>
+ </>
);
}
diff --git a/src/components/features/conversation/right-panel-toggle.tsx b/src/components/features/conversation/right-panel-toggle.tsx
index 2294000813..985060dace 100644
--- a/src/components/features/conversation/right-panel-toggle.tsx
+++ b/src/components/features/conversation/right-panel-toggle.tsx
@@ -44,9 +44,7 @@ export function RightPanelToggle({ className }: RightPanelToggleProps) {
type="button"
onClick={handleToggle}
className={cn(
- "p-1 rounded-md cursor-pointer transition-colors",
- "text-[var(--oh-muted)] hover:text-white hover:bg-white/10",
- isRightPanelShown && "text-white bg-white/10",
+ "p-1 rounded-md cursor-pointer transition-colors text-[var(--oh-muted)] hover:bg-white/10 hover:text-white",
className,
)}
aria-label={tooltipText}
diff --git a/src/components/features/diff-viewer/empty-changes-message.tsx b/src/components/features/diff-viewer/empty-changes-message.tsx
index 7a9cfc5dbc..ff87ebb576 100644
--- a/src/components/features/diff-viewer/empty-changes-message.tsx
+++ b/src/components/features/diff-viewer/empty-changes-message.tsx
@@ -1,16 +1,14 @@
import { useTranslation } from "react-i18next";
import { FaCodeCompare } from "react-icons/fa6";
import { I18nKey } from "#/i18n/declaration";
+import { ConversationTabEmptyState } from "#/components/features/conversation/conversation-tab-empty-state";
export function EmptyChangesMessage() {
const { t } = useTranslation("openhands");
return (
- <div className="flex flex-col items-center justify-center w-full h-full p-10 gap-4">
- <FaCodeCompare size={100} className="text-[var(--oh-muted)]" />
- <span className="text-[var(--oh-text-dim)] text-[19px] font-normal leading-5">
- {t(I18nKey.DIFF_VIEWER$NO_CHANGES)}
- </span>
- </div>
+ <ConversationTabEmptyState icon={<FaCodeCompare />}>
+ {t(I18nKey.DIFF_VIEWER$NO_CHANGES)}
+ </ConversationTabEmptyState>
);
}
diff --git a/src/components/features/settings/brand-button.tsx b/src/components/features/settings/brand-button.tsx
index 53794d3f66..48ddaff670 100644
--- a/src/components/features/settings/brand-button.tsx
+++ b/src/components/features/settings/brand-button.tsx
@@ -48,13 +48,7 @@ export const BrandButton = forwardRef<
aria-label={ariaLabel}
aria-busy={ariaBusy}
className={cn(
- "w-fit p-2 text-sm rounded-sm cursor-pointer",
- // Apply disabled appearance via conditional class so it works
- // regardless of whether the :disabled pseudo-class is available
- // (e.g. Tailwind v4 + postcss-prefix-selector in dev mode).
- isDisabled
- ? "opacity-30 cursor-not-allowed pointer-events-none"
- : "disabled:opacity-30 disabled:cursor-not-allowed",
+ "w-fit p-2 text-sm rounded-sm disabled:opacity-30 disabled:cursor-not-allowed cursor-pointer",
variant === "primary" &&
"bg-primary text-[var(--oh-color-base)] hover:opacity-80",
variant === "secondary" &&
diff --git a/src/components/features/sidebar/sidebar.tsx b/src/components/features/sidebar/sidebar.tsx
index 11eb22a240..2b959f8a21 100644
--- a/src/components/features/sidebar/sidebar.tsx
+++ b/src/components/features/sidebar/sidebar.tsx
@@ -48,6 +48,9 @@ const ManageBackendsModal = React.lazy(() =>
);
const ICON_SIZE = 18;
+/** ~74% of the stock 46×30 mark; `max-w-none` keeps it from clamping in the icon column. */
+const SIDEBAR_LOGO_WIDTH = 34;
+const SIDEBAR_LOGO_HEIGHT = Math.round((SIDEBAR_LOGO_WIDTH * 30) / 46);
export function Sidebar() {
const { t } = useTranslation("openhands");
@@ -169,18 +172,23 @@ export function Sidebar() {
collapsed
? "md:w-[64px] md:min-w-[64px]"
: "md:w-[300px] md:min-w-[300px]",
- collapsed ? "md:px-2 md:pt-4" : "px-2 py-2 md:px-2 md:pt-4",
+ collapsed ? "md:px-2" : "px-2 pb-2 md:px-2",
"flex-row md:flex-col",
- currentPath === "/" && "md:pt-6.5 md:pb-3",
+ currentPath === "/" && "md:pb-3",
)}
>
<div
className={cn(
- "flex items-center gap-2 md:py-1 md:pb-3",
+ "flex items-center gap-2 h-10 min-h-10 shrink-0",
+ // Collapsed desktop: stacked logo + chevron needs more than 40px.
+ collapsed && "md:h-auto md:min-h-0 md:py-2",
// Collapsed: stack the chevron beneath the logo so the 64px rail
// doesn't need to grow to fit two controls in a row. Expanded:
// chevron is right-aligned via ml-auto further down.
- collapsed ? "md:flex-col md:gap-2 md:px-0" : "md:pl-0 md:pr-0",
+ // `pl-2` matches SidebarNavLink horizontal inset; no right padding so
+ // the collapse control can sit flush against the rail edge (outer
+ // sidebar still provides `px-2`).
+ collapsed ? "md:flex-col md:gap-2 md:px-0" : "pl-2 pr-0",
)}
>
{collapsed ? (
@@ -191,7 +199,12 @@ export function Sidebar() {
showCollapsedExpandButton && "opacity-0",
)}
>
- <OpenHandsLogoButton />
+ <OpenHandsLogoButton
+ logoWidth={SIDEBAR_LOGO_WIDTH}
+ logoHeight={SIDEBAR_LOGO_HEIGHT}
+ logoClassName="max-w-none"
+ className="inline-flex h-10 w-10 items-center justify-center overflow-visible"
+ />
</div>
<button
type="button"
@@ -213,7 +226,12 @@ export function Sidebar() {
</div>
) : (
<>
- <OpenHandsLogoButton />
+ <OpenHandsLogoButton
+ logoWidth={SIDEBAR_LOGO_WIDTH}
+ logoHeight={SIDEBAR_LOGO_HEIGHT}
+ logoClassName="max-w-none"
+ className="inline-flex w-[18px] shrink-0 items-center justify-center overflow-visible"
+ />
{/* Desktop-only collapse toggle. Hidden on mobile (the sidebar
there is the top bar and doesn't collapse). No tooltip —
the chevron direction already conveys what the button does. */}
diff --git a/src/components/shared/buttons/openhands-logo-button.tsx b/src/components/shared/buttons/openhands-logo-button.tsx
index ccfc69b1c7..630f3ede3b 100644
--- a/src/components/shared/buttons/openhands-logo-button.tsx
+++ b/src/components/shared/buttons/openhands-logo-button.tsx
@@ -3,8 +3,25 @@ import OpenHandsLogo from "#/assets/branding/openhands-logo.svg?react";
import { NavigationLink } from "#/components/shared/navigation-link";
import { I18nKey } from "#/i18n/declaration";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
+import { cn } from "#/utils/utils";
-export function OpenHandsLogoButton() {
+const DEFAULT_LOGO_WIDTH = 46;
+const DEFAULT_LOGO_HEIGHT = 30;
+
+export type OpenHandsLogoButtonProps = {
+ className?: string;
+ /** Applied to the root `<svg>` (e.g. `max-w-none` so Tailwind preflight doesn’t clamp wide marks inside a narrow flex slot). */
+ logoClassName?: string;
+ logoWidth?: number;
+ logoHeight?: number;
+};
+
+export function OpenHandsLogoButton({
+ className,
+ logoClassName,
+ logoWidth = DEFAULT_LOGO_WIDTH,
+ logoHeight = DEFAULT_LOGO_HEIGHT,
+}: OpenHandsLogoButtonProps = {}) {
const { t } = useTranslation("openhands");
const tooltipText = t(I18nKey.BRANDING$OPENHANDS);
@@ -12,8 +29,16 @@ export function OpenHandsLogoButton() {
return (
<StyledTooltip content={tooltipText}>
- <NavigationLink to="/conversations" aria-label={ariaLabel}>
- <OpenHandsLogo width={46} height={30} />
+ <NavigationLink
+ to="/conversations"
+ aria-label={ariaLabel}
+ className={cn(className)}
+ >
+ <OpenHandsLogo
+ width={logoWidth}
+ height={logoHeight}
+ className={cn("shrink-0", logoClassName)}
+ />
</NavigationLink>
</StyledTooltip>
);
diff --git a/src/components/ui/resize-handle.tsx b/src/components/ui/resize-handle.tsx
index 3b39b3cbc3..29674a985a 100644
--- a/src/components/ui/resize-handle.tsx
+++ b/src/components/ui/resize-handle.tsx
@@ -1,21 +1,39 @@
+import { useState } from "react";
import { cn } from "#/utils/utils";
interface ResizeHandleProps {
onMouseDown: (e: React.MouseEvent) => void;
className?: string;
+ /** While the parent panel drag is active, keep the grip line highlighted. */
+ isDragging?: boolean;
}
-export function ResizeHandle({ onMouseDown, className }: ResizeHandleProps) {
+export function ResizeHandle({
+ onMouseDown,
+ className,
+ isDragging = false,
+}: ResizeHandleProps) {
+ const [isHovering, setIsHovering] = useState(false);
+ const lineActive = isDragging || isHovering;
+
return (
<div
- className={cn("relative w-1 bg-transparent cursor-ew-resize", className)}
- onMouseDown={onMouseDown}
+ className={cn("relative z-10 w-0 shrink-0 self-stretch", className)}
+ aria-hidden
>
- {/* Visual indicator */}
- <div className="absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2" />
-
- {/* Larger hit area for easier dragging */}
- <div className="absolute inset-y-0 -left-1 -right-1" />
+ <div
+ className="absolute inset-y-0 left-1/2 w-3 min-w-[12px] -translate-x-1/2 cursor-ew-resize"
+ onMouseDown={onMouseDown}
+ onMouseEnter={() => setIsHovering(true)}
+ onMouseLeave={() => setIsHovering(false)}
+ />
+ <div
+ className={cn(
+ "pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 transition-colors",
+ lineActive ? "bg-white" : "bg-transparent",
+ )}
+ aria-hidden
+ />
</div>
);
}
diff --git a/src/hooks/chat/use-grip-resize.ts b/src/hooks/chat/use-grip-resize.ts
index a46d3fbe4f..c3c572c9fb 100644
--- a/src/hooks/chat/use-grip-resize.ts
+++ b/src/hooks/chat/use-grip-resize.ts
@@ -1,3 +1,4 @@
+import type { RefObject, MouseEvent } from "react";
import { useRef, useState, useCallback } from "react";
import { useAutoResize } from "#/hooks/use-auto-resize";
import { CHAT_INPUT } from "#/utils/constants";
@@ -10,34 +11,35 @@ import {
* Hook for managing grip resize functionality
*/
export const useGripResize = (
- chatInputRef: React.RefObject<HTMLDivElement | null>,
+ chatInputRef: RefObject<HTMLDivElement | null>,
messageToSend: IMessageToSend | null,
) => {
const [isGripVisible, setIsGripVisible] = useState(false);
+ const [isGripDragging, setIsGripDragging] = useState(false);
const { setShouldHideSuggestions } = useConversationStore();
const gripRef = useRef<HTMLDivElement | null>(null);
+ /** After a real resize drag, swallow the synthetic click so it doesn't toggle `isGripVisible`. */
+ const suppressNextTopEdgeClickRef = useRef(false);
- // Drag state management callbacks
- const handleDragStart = useCallback(() => {
- // Keep grip visible during drag by adding a CSS class
- if (gripRef.current) {
- gripRef.current.classList.add("opacity-100");
- gripRef.current.classList.remove("opacity-0");
- }
+ const handleGripDragStart = useCallback(() => {
+ setIsGripDragging(true);
}, []);
- const handleDragEnd = useCallback(() => {
- // Restore hover-based visibility
- if (gripRef.current) {
- gripRef.current.classList.remove("opacity-100");
- gripRef.current.classList.add("opacity-0");
- }
+ const handleGripDragEnd = useCallback(() => {
+ setIsGripDragging(false);
+ suppressNextTopEdgeClickRef.current = true;
}, []);
// Handle click on top edge area to toggle grip visibility
- const handleTopEdgeClick = useCallback((e: React.MouseEvent) => {
+ const handleTopEdgeClick = useCallback((e: MouseEvent) => {
+ if (suppressNextTopEdgeClickRef.current) {
+ suppressNextTopEdgeClickRef.current = false;
+ e.preventDefault();
+ e.stopPropagation();
+ return;
+ }
e.stopPropagation();
setIsGripVisible((prev) => !prev);
}, []);
@@ -63,8 +65,8 @@ export const useGripResize = (
minHeight: 20,
maxHeight: 400,
onHeightChange: handleHeightChange,
- onGripDragStart: handleDragStart,
- onGripDragEnd: handleDragEnd,
+ onGripDragStart: handleGripDragStart,
+ onGripDragEnd: handleGripDragEnd,
value: messageToSend ?? undefined,
enableManualResize: true,
});
@@ -72,6 +74,7 @@ export const useGripResize = (
return {
gripRef,
isGripVisible,
+ isGripDragging,
handleTopEdgeClick,
smartResize,
handleGripMouseDown,
diff --git a/src/hooks/use-drag-resize.ts b/src/hooks/use-drag-resize.ts
index 0a75598d0a..d9339c547f 100644
--- a/src/hooks/use-drag-resize.ts
+++ b/src/hooks/use-drag-resize.ts
@@ -1,7 +1,14 @@
-import { RefObject } from "react";
+import type {
+ RefObject,
+ MouseEvent as ReactMouseEvent,
+ TouchEvent as ReactTouchEvent,
+} from "react";
import { EPS } from "#/utils/constants";
import { isMobileDevice } from "#/utils/utils";
+/** Movement required before a pointer gesture is treated as a resize drag. */
+const DRAG_COMMIT_PX = 2;
+
// Drag handling hook
interface UseDragResizeOptions {
elementRef: RefObject<HTMLElement | null>;
@@ -29,11 +36,53 @@ export const useDragResize = ({
return (event as MouseEvent).clientY;
};
- // Create drag move handler
- const createDragMoveHandler = (startY: number, startHeight: number) => {
+ // Setup event listeners for mobile devices
+ const setupMobileEventListeners = (
+ handleDragMove: (event: MouseEvent | TouchEvent) => void,
+ handleDragEnd: () => void,
+ ) => {
+ const resizeGrip = document.getElementById("resize-grip");
+
+ if (!resizeGrip) {
+ return;
+ }
+
+ resizeGrip.addEventListener("touchmove", handleDragMove, {
+ passive: false,
+ capture: true,
+ });
+ resizeGrip.addEventListener("touchend", handleDragEnd, {
+ capture: true,
+ });
+ };
+
+ // Setup event listeners for desktop devices
+ const setupDesktopEventListeners = (
+ handleDragMove: (event: MouseEvent | TouchEvent) => void,
+ handleDragEnd: () => void,
+ ) => {
+ document.addEventListener("mousemove", handleDragMove);
+ document.addEventListener("mouseup", handleDragEnd);
+ };
+
+ // Start drag operation
+ const startDrag = (startY: number) => {
+ const isMobile = isMobileDevice();
+ const startHeight = elementRef.current?.offsetHeight || minHeight;
+ let dragCommitted = false;
+
const handleDragMove = (moveEvent: MouseEvent | TouchEvent) => {
moveEvent.preventDefault();
+ if (!dragCommitted) {
+ const y = getClientY(moveEvent);
+ if (Math.abs(y - startY) < DRAG_COMMIT_PX) {
+ return;
+ }
+ dragCommitted = true;
+ onGripDragStart?.();
+ }
+
const deltaY = getClientY(moveEvent) - startY;
// Invert deltaY so moving up increases height and moving down decreases height
const newHeight = Math.max(
@@ -65,17 +114,11 @@ export const useDragResize = ({
onReachedMinHeight();
}
};
- return handleDragMove;
- };
- // Create drag end handler
- const createDragEndHandler = (
- isMobile: boolean,
- handleDragMove: (event: MouseEvent | TouchEvent) => void,
- ) => {
const handleDragEnd = () => {
- // Call optional drag end callback
- onGripDragEnd?.();
+ if (dragCommitted) {
+ onGripDragEnd?.();
+ }
if (isMobile) {
const resizeGrip = document.getElementById("resize-grip");
@@ -95,49 +138,6 @@ export const useDragResize = ({
document.removeEventListener("touchend", handleDragEnd);
}
};
- return handleDragEnd;
- };
-
- // Setup event listeners for mobile devices
- const setupMobileEventListeners = (
- handleDragMove: (event: MouseEvent | TouchEvent) => void,
- handleDragEnd: () => void,
- ) => {
- const resizeGrip = document.getElementById("resize-grip");
-
- if (!resizeGrip) {
- return;
- }
-
- resizeGrip.addEventListener("touchmove", handleDragMove, {
- passive: false,
- capture: true,
- });
- resizeGrip.addEventListener("touchend", handleDragEnd, {
- capture: true,
- });
- };
-
- // Setup event listeners for desktop devices
- const setupDesktopEventListeners = (
- handleDragMove: (event: MouseEvent | TouchEvent) => void,
- handleDragEnd: () => void,
- ) => {
- document.addEventListener("mousemove", handleDragMove);
- document.addEventListener("mouseup", handleDragEnd);
- };
-
- // Start drag operation
- const startDrag = (startY: number) => {
- // Call optional drag start callback
- onGripDragStart?.();
-
- const isMobile = isMobileDevice();
- const startHeight = elementRef.current?.offsetHeight || minHeight;
-
- // Create event handlers
- const handleDragMove = createDragMoveHandler(startY, startHeight);
- const handleDragEnd = createDragEndHandler(isMobile, handleDragMove);
// Setup event listeners based on device type
if (isMobile) {
@@ -148,13 +148,13 @@ export const useDragResize = ({
};
// Handle mouse down on grip for manual resizing
- const handleGripMouseDown = (e: React.MouseEvent) => {
+ const handleGripMouseDown = (e: ReactMouseEvent) => {
e.preventDefault();
startDrag(e.clientY);
};
// Handle touch start on grip for manual resizing
- const handleGripTouchStart = (e: React.TouchEvent) => {
+ const handleGripTouchStart = (e: ReactTouchEvent) => {
e.preventDefault();
startDrag(e.touches[0].clientY);
};
diff --git a/src/hooks/use-terminal.ts b/src/hooks/use-terminal.ts
index 46f9b604dc..5960dfc471 100644
--- a/src/hooks/use-terminal.ts
+++ b/src/hooks/use-terminal.ts
@@ -70,6 +70,21 @@ const canFitTerminal = (
return true;
};
+function resolveTerminalForeground(host: HTMLElement): string {
+ const probe = host.ownerDocument.createElement("span");
+ probe.style.color = "var(--oh-surface-foreground)";
+ probe.style.position = "absolute";
+ probe.style.visibility = "hidden";
+ probe.style.pointerEvents = "none";
+ host.appendChild(probe);
+ const fromVar = getComputedStyle(probe).color;
+ probe.remove();
+ if (fromVar && fromVar !== "rgba(0, 0, 0, 0)") {
+ return fromVar;
+ }
+ return getComputedStyle(host).color;
+}
+
// Create a persistent reference that survives component unmounts
// This ensures terminal history is preserved when navigating away and back
const persistentLastCommandIndex = { current: 0 };
@@ -82,7 +97,7 @@ export const useTerminal = () => {
const lastCommandIndex = persistentLastCommandIndex; // Use the persistent reference
const isDisposed = React.useRef(false);
- const createTerminal = () =>
+ const createTerminal = (host: HTMLDivElement) =>
new Terminal({
fontFamily: "Menlo, Monaco, 'Courier New', monospace",
fontSize: 14,
@@ -90,8 +105,12 @@ export const useTerminal = () => {
scrollSensitivity: 1,
fastScrollSensitivity: 5,
disableStdin: true, // Make terminal read-only
+ // Canvas fillStyle does not resolve CSS variables; use transparency so
+ // the host / panel background shows through (`allowTransparency` required).
+ allowTransparency: true,
theme: {
- background: "var(--oh-surface)",
+ background: "rgba(0, 0, 0, 0)",
+ foreground: resolveTerminalForeground(host),
},
});
@@ -119,7 +138,12 @@ export const useTerminal = () => {
// Initialize terminal and handle cleanup
React.useEffect(() => {
isDisposed.current = false;
- terminal.current = createTerminal();
+ const host = ref.current;
+ if (!host) {
+ return undefined;
+ }
+
+ terminal.current = createTerminal(host);
fitAddon.current = new FitAddon();
if (ref.current) {
diff --git a/src/mocks/auth-handlers.ts b/src/mocks/auth-handlers.ts
index 39f309c8e2..dbecef0171 100644
--- a/src/mocks/auth-handlers.ts
+++ b/src/mocks/auth-handlers.ts
@@ -2,6 +2,16 @@ import { http, HttpResponse } from "msw";
import { GitUser } from "#/types/git";
export const AUTH_HANDLERS = [
+ // Cloud proxy is not available in mock mode; return a clean 503 so callers
+ // (useAllCloudOrganizations, useBackendsHealth cloud path) fail gracefully
+ // instead of falling through to the real dev server and getting a 502.
+ http.post("*/api/cloud-proxy", () =>
+ HttpResponse.json(
+ { error: "cloud proxy not available in mock mode" },
+ { status: 503 },
+ ),
+ ),
+
http.get("*/api/user/info", () => {
const user: GitUser = {
id: "1",
diff --git a/src/routes/planner-tab.tsx b/src/routes/planner-tab.tsx
index 0cb794498a..4afe6ba091 100644
--- a/src/routes/planner-tab.tsx
+++ b/src/routes/planner-tab.tsx
@@ -2,12 +2,13 @@ import React from "react";
import { useTranslation } from "react-i18next";
import { I18nKey } from "#/i18n/declaration";
import LessonPlanIcon from "#/icons/lesson-plan.svg?react";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import { ConversationTabEmptyState } from "#/components/features/conversation/conversation-tab-empty-state";
import { useConversationStore } from "#/stores/conversation-store";
import { useScrollToBottom } from "#/hooks/use-scroll-to-bottom";
import { MarkdownRenderer } from "#/components/features/markdown/markdown-renderer";
import { planComponents } from "#/components/features/markdown/plan-components";
import { useHandlePlanClick } from "#/hooks/use-handle-plan-click";
-import { cn } from "#/utils/utils";
function PlannerTab() {
const { t } = useTranslation("openhands");
@@ -45,25 +46,22 @@ function PlannerTab() {
}
return (
- <div className="flex flex-col items-center justify-center w-full h-full p-10">
- <LessonPlanIcon width={109} height={109} color="var(--oh-muted)" />
- <span className="text-[var(--oh-text-dim)] text-[19px] font-normal leading-5 pb-9">
- {t(I18nKey.PLANNER$EMPTY_MESSAGE)}
- </span>
- <button
- type="button"
- onClick={handlePlanClick}
- disabled={isPlanMode}
- className={cn(
- "flex w-[164px] h-[40px] p-2 justify-center items-center shrink-0 rounded-lg bg-white overflow-hidden text-black text-ellipsis font-sans text-[16px] not-italic font-normal leading-[20px]",
- isPlanMode
- ? "opacity-50 cursor-not-allowed"
- : "hover:cursor-pointer hover:opacity-80",
- )}
- >
- {t(I18nKey.COMMON$CREATE_A_PLAN)}
- </button>
- </div>
+ <ConversationTabEmptyState
+ icon={<LessonPlanIcon />}
+ action={
+ <BrandButton
+ type="button"
+ variant="secondary"
+ onClick={handlePlanClick}
+ isDisabled={isPlanMode}
+ className="min-w-40 justify-center px-6"
+ >
+ {t(I18nKey.COMMON$CREATE_A_PLAN)}
+ </BrandButton>
+ }
+ >
+ {t(I18nKey.PLANNER$EMPTY_MESSAGE)}
+ </ConversationTabEmptyState>
);
}
diff --git a/src/routes/task-list-tab.tsx b/src/routes/task-list-tab.tsx
index e7f3dd6a2e..bdf96a5993 100644
--- a/src/routes/task-list-tab.tsx
+++ b/src/routes/task-list-tab.tsx
@@ -3,8 +3,8 @@ import { I18nKey } from "#/i18n/declaration";
import CheckCircleIcon from "#/icons/u-check-circle.svg?react";
import { TaskItem } from "#/components/features/chat/task-tracking/task-item";
import { useTaskList } from "#/hooks/use-task-list";
-import { Text } from "#/ui/typography";
import { cn } from "#/utils/utils";
+import { ConversationTabEmptyState } from "#/components/features/conversation/conversation-tab-empty-state";
function TaskListTab() {
const { t } = useTranslation("openhands");
@@ -12,12 +12,9 @@ function TaskListTab() {
if (taskList.length === 0) {
return (
- <div className="flex flex-col items-center justify-center w-full h-full p-10 gap-4">
- <CheckCircleIcon width={109} height={109} color="var(--oh-muted)" />
- <Text className="text-[var(--oh-text-dim)] text-[19px] font-normal leading-5">
- {t(I18nKey.COMMON$NO_TASKS)}
- </Text>
- </div>
+ <ConversationTabEmptyState icon={<CheckCircleIcon />}>
+ {t(I18nKey.COMMON$NO_TASKS)}
+ </ConversationTabEmptyState>
);
}
diff --git a/src/routes/vscode-tab.tsx b/src/routes/vscode-tab.tsx
index 8c89965e1b..4c406a554c 100644
--- a/src/routes/vscode-tab.tsx
+++ b/src/routes/vscode-tab.tsx
@@ -6,6 +6,9 @@ import { useAgentState } from "#/hooks/use-agent-state";
import { RUNTIME_STARTING_STATES } from "#/types/agent-state";
import { VSCODE_IN_NEW_TAB } from "#/utils/feature-flags";
import { WaitingForRuntimeMessage } from "#/components/features/chat/waiting-for-runtime-message";
+import { ConversationTabEmptyState } from "#/components/features/conversation/conversation-tab-empty-state";
+import { BrandButton } from "#/components/features/settings/brand-button";
+import VSCodeIcon from "#/icons/vscode.svg?react";
function VSCodeTab() {
const { t } = useTranslation("openhands");
@@ -65,18 +68,21 @@ function VSCodeTab() {
// If cross-origin, show a button to open in new tab
if (isCrossProtocol) {
return (
- <div className="w-full h-full flex flex-col items-center justify-center gap-4">
- <div className="text-xl text-tertiary-light text-center max-w-md">
- {t("VSCODE$CROSS_ORIGIN_WARNING")}
- </div>
- <button
- type="button"
- onClick={handleOpenInNewTab}
- className="px-4 py-2 bg-primary text-white rounded-sm hover:bg-primary-dark transition-colors"
- >
- {t("VSCODE$OPEN_IN_NEW_TAB")}
- </button>
- </div>
+ <ConversationTabEmptyState
+ icon={<VSCodeIcon />}
+ action={
+ <BrandButton
+ type="button"
+ variant="secondary"
+ onClick={handleOpenInNewTab}
+ className="min-w-40 justify-center px-6"
+ >
+ {t("VSCODE$OPEN_IN_NEW_TAB")}
+ </BrandButton>
+ }
+ >
+ {t("VSCODE$CROSS_ORIGIN_WARNING")}
+ </ConversationTabEmptyState>
);
}