Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Rearrange conversation right panel: tabs inside flush panel (#269)

Robert Brennan3384aed45493
diff --git a/AGENTS.md b/AGENTS.md
index e573e4ab91..c1e693ab97 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -179,4 +179,6 @@
- Manage Backends modal: `src/components/features/backends/manage-backends-modal.tsx` lets users edit (host/name/api-key/kind) and remove existing backends, plus add new ones inline via a "+ Add Backend" footer button that opens a `BackendFormModal`. Both the dropdown footer's "Add backend" and the manage modal's "+ Add Backend" reuse `BackendFormModal` (see `backend-form-modal.tsx`), with `mode="add"` or `mode="edit"`; `AddBackendModal` is now a thin compatibility wrapper for `BackendFormModal mode="add"`. The modal is also auto-rendered (with a no-op `onClose`) by `src/root.tsx` when the active backend is unreachable, replacing the old full-screen `MissingAgentServerNotice` onboarding screen.
+- Conversation right-panel regression note: `ConversationTabs` now owns the moved refresh/build buttons, so `__tests__/components/features/conversation/conversation-tabs.test.tsx` should cover that behavior directly. In those tests, seed both the persisted conversation-state key and the Zustand store (`selectedTab`, `isRightPanelShown`, `hasRightPanelToggled`) β€” the component sync effect currently restores `hasRightPanelToggled` from localStorage, not `isRightPanelShown`, so localStorage alone will not make a tab read as active.
+
- Onboarding modal: `src/components/features/onboarding/onboarding-modal.tsx` is a 4-step welcome flow rendered by `<OnboardingHost />` (mounted on the home route) and gated by the `openhands-onboarded` localStorage flag (`use-onboarding-completion.ts`). The four steps live under `steps/`: choose-agent (Step 0 – OpenHands selectable, Claude Code & Codex disabled with a "coming soon" note), check-backend (embeds the new `BackendForm` extracted from `backend-form-modal.tsx` plus a colored connection banner driven by `useBackendsHealth`), setup-llm (renders `<LlmSettingsScreen onSaveSuccess={onNext} />` so the existing settings UI keeps owning validation), and say-hello (text input pre-filled from `ONBOARDING$HELLO_DEFAULT_MESSAGE`, launches a no-workspace conversation via `useCreateConversation` and closes the modal). Animation: all four panels are mounted as siblings inside a horizontal rail; advancing/retreating just sets `currentStep`, which translates the rail by `-(step * 100)%` for the slide effect. Progress is rendered by `OnboardingProgressBar` with `data-state` per segment (`completed` | `current` | `upcoming`). When extending, refactor `BackendFormModal` carefully β€” the inner `BackendForm` is the public surface used both by the modal and by `CheckBackendStep`; the modal version still owns dirty/save tracking so it keeps "Save"/"Cancel" footer behavior.
diff --git a/__tests__/components/conversation-tab-title.test.tsx b/__tests__/components/conversation-tab-title.test.tsx
deleted file mode 100644
index 3b30c4f3a8..0000000000
--- a/__tests__/components/conversation-tab-title.test.tsx
+++ /dev/null
@@ -1,278 +0,0 @@
-import { render, screen, waitFor } from "@testing-library/react";
-import userEvent from "@testing-library/user-event";
-import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
-import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import { ConversationTabTitle } from "#/components/features/conversation/conversation-tabs/conversation-tab-title";
-import { useConversationStore } from "#/stores/conversation-store";
-import { useAgentStore } from "#/stores/agent-store";
-import { useOptimisticUserMessageStore } from "#/stores/optimistic-user-message-store";
-import { AgentState } from "#/types/agent-state";
-import { createChatMessage } from "#/services/chat-service";
-
-// Mock the hook that provides git changes functionality
-vi.mock("#/hooks/query/use-unified-get-git-changes", () => ({
- useUnifiedGetGitChanges: vi.fn(() => ({
- refetch: vi.fn(),
- isFetching: false,
- data: [],
- })),
-}));
-
-// Mock i18n
-vi.mock("react-i18next", async (importOriginal) => {
- const actual = await importOriginal<typeof import("react-i18next")>();
- return {
- ...actual,
- useTranslation: () => ({
- t: (key: string) => key,
- }),
- };
-});
-
-// Mock services for Build button
-const mockSend = vi.fn();
-
-vi.mock("#/hooks/use-send-message", () => ({
- useSendMessage: vi.fn(() => ({
- send: mockSend,
- })),
-}));
-
-vi.mock("#/services/chat-service", () => ({
- createChatMessage: vi.fn((content, imageUrls, fileUrls, timestamp) => ({
- action: "message",
- args: { content, image_urls: imageUrls, file_urls: fileUrls, timestamp },
- })),
-}));
-
-// Mock the hooks that useUnifiedGetGitChanges depends on
-vi.mock("#/hooks/use-conversation-id", () => ({
- useConversationId: () => ({
- conversationId: "test-conversation-id",
- }),
-}));
-
-vi.mock("#/hooks/query/use-active-conversation", () => ({
- useActiveConversation: () => ({
- data: {
- conversation_version: "V0",
- url: null,
- session_api_key: null,
- selected_repository: null,
- },
- }),
-}));
-
-vi.mock("#/hooks/use-runtime-is-ready", () => ({
- useRuntimeIsReady: () => true,
-}));
-
-vi.mock("#/hooks/use-agent-state", () => ({
- useAgentState: vi.fn(() => ({
- curAgentState: AgentState.AWAITING_USER_INPUT,
- })),
-}));
-
-vi.mock("#/utils/get-git-path", () => ({
- getGitPath: () => "/workspace",
-}));
-
-describe("ConversationTabTitle", () => {
- let queryClient: QueryClient;
-
- beforeEach(() => {
- queryClient = new QueryClient({
- defaultOptions: {
- queries: {
- retry: false,
- },
- },
- });
-
- // Reset stores for Build button tests
- useConversationStore.setState({
- planContent: null,
- conversationMode: "plan",
- });
- useAgentStore.setState({
- curAgentState: AgentState.AWAITING_USER_INPUT,
- });
- useOptimisticUserMessageStore.setState({
- optimisticUserMessage: null,
- });
- });
-
- afterEach(() => {
- vi.clearAllMocks();
- queryClient.clear();
- localStorage.clear();
- });
-
- const renderWithProviders = (ui: React.ReactElement) => {
- return render(
- <QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>,
- );
- };
-
- describe("Rendering", () => {
- it("should render the title", () => {
- // Arrange
- const title = "Test Title";
-
- // Act
- renderWithProviders(
- <ConversationTabTitle title={title} conversationKey="browser" />,
- );
-
- // Assert
- expect(screen.getByText(title)).toBeInTheDocument();
- });
-
- it("should show refresh button when conversationKey is 'editor'", () => {
- // Arrange
- const title = "Changes";
-
- // Act
- renderWithProviders(
- <ConversationTabTitle title={title} conversationKey="editor" />,
- );
-
- // Assert
- const refreshButton = screen.getByRole("button");
- expect(refreshButton).toBeInTheDocument();
- });
-
- it("should not show refresh button when conversationKey is not 'editor'", () => {
- // Arrange
- const title = "Browser";
-
- // Act
- renderWithProviders(
- <ConversationTabTitle title={title} conversationKey="browser" />,
- );
-
- // Assert
- expect(screen.queryByRole("button")).not.toBeInTheDocument();
- });
- });
-
- describe("User Interactions", () => {
- it("should call refetch when refresh button is clicked", async () => {
- // Arrange
- const user = userEvent.setup();
- const title = "Changes";
- const mockRefetch = vi.fn();
-
- // Import the hook mock to get a reference to it
- const { useUnifiedGetGitChanges } = await import(
- "#/hooks/query/use-unified-get-git-changes"
- );
- vi.mocked(useUnifiedGetGitChanges).mockReturnValue({
- refetch: mockRefetch,
- isFetching: false,
- isError: false,
- isLoading: false,
- isSuccess: true,
- data: [],
- error: null,
- });
-
- renderWithProviders(
- <ConversationTabTitle title={title} conversationKey="editor" />,
- );
-
- const refreshButton = screen.getByRole("button");
-
- // Act
- await user.click(refreshButton);
-
- // Assert - refetch should be called
- expect(mockRefetch).toHaveBeenCalledTimes(1);
- });
- });
-
- describe("Build Button", () => {
- it("should show Build button when conversationKey is 'planner' and planContent exists", () => {
- // Arrange
- useConversationStore.setState({ planContent: "# Plan content" });
-
- // Act
- renderWithProviders(
- <ConversationTabTitle title="Planner" conversationKey="planner" />,
- );
-
- // Assert
- const buildButton = screen.getByTestId("planner-tab-build-button");
- expect(buildButton).toBeInTheDocument();
- });
-
- it("should not show Build button when conversationKey is not 'planner'", () => {
- // Arrange
- useConversationStore.setState({ planContent: "# Plan content" });
-
- // Act
- renderWithProviders(
- <ConversationTabTitle title="Browser" conversationKey="browser" />,
- );
-
- // Assert
- expect(
- screen.queryByTestId("planner-tab-build-button"),
- ).not.toBeInTheDocument();
- });
-
- it("should disable Build button when no planContent exists", () => {
- // Arrange
- useConversationStore.setState({ planContent: null });
- useAgentStore.setState({ curAgentState: AgentState.AWAITING_USER_INPUT });
-
- // Act
- renderWithProviders(
- <ConversationTabTitle title="Planner" conversationKey="planner" />,
- );
-
- // Assert
- const buildButton = screen.getByTestId("planner-tab-build-button");
- expect(buildButton).toBeDisabled();
- });
-
- it("should disable Build button when agent is running", () => {
- // Note: This test is now covered by the useHandleBuildPlanClick hook tests
- // because the component now uses useAgentState hook which is mocked to always
- // return AWAITING_USER_INPUT in this test file
- // Arrange
- useConversationStore.setState({ planContent: null });
- useAgentStore.setState({ curAgentState: AgentState.RUNNING });
-
- // Act
- renderWithProviders(
- <ConversationTabTitle title="Planner" conversationKey="planner" />,
- );
-
- // Assert - with null planContent, button should be disabled regardless of agent state
- const buildButton = screen.getByTestId("planner-tab-build-button");
- expect(buildButton).toBeDisabled();
- });
-
- it("should switch to code mode and send message when Build button is clicked", async () => {
- // Arrange
- const user = userEvent.setup();
- useConversationStore.setState({
- planContent: "# Plan content",
- conversationMode: "plan",
- });
- useAgentStore.setState({ curAgentState: AgentState.AWAITING_USER_INPUT });
-
- renderWithProviders(
- <ConversationTabTitle title="Planner" conversationKey="planner" />,
- );
-
- const buildButton = screen.getByTestId("planner-tab-build-button");
-
- // Act & Assert - button should be clickable
- // The actual behavior is tested in useHandleBuildPlanClick tests
- await user.click(buildButton);
- expect(buildButton).toBeEnabled();
- });
- });
-});
diff --git a/__tests__/components/features/conversation/conversation-tab-content.test.tsx b/__tests__/components/features/conversation/conversation-tab-content.test.tsx
index 5b6ae64368..56327a938b 100644
--- a/__tests__/components/features/conversation/conversation-tab-content.test.tsx
+++ b/__tests__/components/features/conversation/conversation-tab-content.test.tsx
@@ -16,14 +16,7 @@ vi.mock("#/hooks/use-conversation-id", () => ({
}),
}));
-// Mock useUnifiedGetGitChanges hook (used by ConversationTabTitle)
-vi.mock("#/hooks/query/use-unified-get-git-changes", () => ({
- useUnifiedGetGitChanges: () => ({
- refetch: vi.fn(),
- data: [],
- isLoading: false,
- }),
-}));
+
// Mock lazy-loaded components
vi.mock("#/routes/changes-tab", () => ({
@@ -107,15 +100,6 @@ describe("ConversationTabContent", () => {
});
describe("Rendering", () => {
- it("should render the container with correct structure", async () => {
- render(<ConversationTabContent />, { wrapper: createWrapper() });
-
- // Should show the title for the default tab (editor -> COMMON$CHANGES)
- await waitFor(() => {
- expect(screen.getByText("COMMON$CHANGES")).toBeInTheDocument();
- });
- });
-
it("should render editor tab content by default", async () => {
setSelectedTab("editor");
@@ -124,8 +108,6 @@ describe("ConversationTabContent", () => {
await waitFor(() => {
expect(screen.getByTestId("editor-tab-content")).toBeInTheDocument();
});
-
- expect(screen.getByText("COMMON$CHANGES")).toBeInTheDocument();
});
it("should render editor tab when selectedTab is null", async () => {
@@ -136,8 +118,6 @@ describe("ConversationTabContent", () => {
await waitFor(() => {
expect(screen.getByTestId("editor-tab-content")).toBeInTheDocument();
});
-
- expect(screen.getByText("COMMON$CHANGES")).toBeInTheDocument();
});
});
@@ -150,8 +130,6 @@ describe("ConversationTabContent", () => {
await waitFor(() => {
expect(screen.getByTestId("browser-tab-content")).toBeInTheDocument();
});
-
- expect(screen.getByText("COMMON$BROWSER")).toBeInTheDocument();
});
it("should render served tab when selected", async () => {
@@ -162,8 +140,6 @@ describe("ConversationTabContent", () => {
await waitFor(() => {
expect(screen.getByTestId("served-tab-content")).toBeInTheDocument();
});
-
- expect(screen.getByText("COMMON$APP")).toBeInTheDocument();
});
it("should render vscode tab when selected", async () => {
@@ -174,8 +150,6 @@ describe("ConversationTabContent", () => {
await waitFor(() => {
expect(screen.getByTestId("vscode-tab-content")).toBeInTheDocument();
});
-
- expect(screen.getByText("COMMON$CODE")).toBeInTheDocument();
});
it("should render terminal tab when selected", async () => {
@@ -186,8 +160,6 @@ describe("ConversationTabContent", () => {
await waitFor(() => {
expect(screen.getByTestId("terminal-tab-content")).toBeInTheDocument();
});
-
- expect(screen.getByText("COMMON$TERMINAL")).toBeInTheDocument();
});
it("should render planner tab when selected", async () => {
@@ -198,34 +170,6 @@ describe("ConversationTabContent", () => {
await waitFor(() => {
expect(screen.getByTestId("planner-tab-content")).toBeInTheDocument();
});
-
- expect(screen.getByText("COMMON$PLANNER")).toBeInTheDocument();
- });
- });
-
- describe("Title display", () => {
- const tabTitleMapping: Array<{
- tab: ConversationTab;
- expectedTitle: string;
- }> = [
- { tab: "editor", expectedTitle: "COMMON$CHANGES" },
- { tab: "browser", expectedTitle: "COMMON$BROWSER" },
- { tab: "served", expectedTitle: "COMMON$APP" },
- { tab: "vscode", expectedTitle: "COMMON$CODE" },
- { tab: "terminal", expectedTitle: "COMMON$TERMINAL" },
- { tab: "planner", expectedTitle: "COMMON$PLANNER" },
- ];
-
- tabTitleMapping.forEach(({ tab, expectedTitle }) => {
- it(`should display "${expectedTitle}" title for "${tab}" tab`, async () => {
- setSelectedTab(tab);
-
- render(<ConversationTabContent />, { wrapper: createWrapper() });
-
- await waitFor(() => {
- expect(screen.getByText(expectedTitle)).toBeInTheDocument();
- });
- });
});
});
diff --git a/__tests__/components/features/conversation/conversation-tabs.test.tsx b/__tests__/components/features/conversation/conversation-tabs.test.tsx
index 03df18d2e0..fc4f8f503e 100644
--- a/__tests__/components/features/conversation/conversation-tabs.test.tsx
+++ b/__tests__/components/features/conversation/conversation-tabs.test.tsx
@@ -5,6 +5,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { MemoryRouter } from "react-router";
import { ConversationTabs } from "#/components/features/conversation/conversation-tabs/conversation-tabs";
import { useConversationStore } from "#/stores/conversation-store";
+import { AgentState } from "#/types/agent-state";
const TASK_CONVERSATION_ID = "task-ec03fb2ab8604517b24af632b058c2fd";
const REAL_CONVERSATION_ID = "conv-abc123";
@@ -23,6 +24,28 @@ vi.mock("#/hooks/use-task-list", () => ({
}),
}));
+const mockRefetchGitChanges = vi.fn();
+let mockIsFetchingGitChanges = false;
+vi.mock("#/hooks/query/use-unified-get-git-changes", () => ({
+ useUnifiedGetGitChanges: () => ({
+ refetch: mockRefetchGitChanges,
+ isFetching: mockIsFetchingGitChanges,
+ data: [],
+ }),
+}));
+
+const mockHandleBuildPlanClick = vi.fn();
+vi.mock("#/hooks/use-handle-build-plan-click", () => ({
+ useHandleBuildPlanClick: () => ({
+ handleBuildPlanClick: mockHandleBuildPlanClick,
+ }),
+}));
+
+let mockCurAgentState = AgentState.AWAITING_USER_INPUT;
+vi.mock("#/hooks/use-agent-state", () => ({
+ useAgentState: () => ({ curAgentState: mockCurAgentState }),
+}));
+
const createWrapper = (conversationId: string) => {
return ({ children }: { children: React.ReactNode }) => (
<MemoryRouter initialEntries={[`/conversations/${conversationId}`]}>
@@ -33,16 +56,51 @@ const createWrapper = (conversationId: string) => {
);
};
+const seedConversationState = (
+ conversationId: string,
+ overrides: Record<string, unknown> = {},
+) => {
+ localStorage.setItem(
+ `conversation-state-${conversationId}`,
+ JSON.stringify({
+ selectedTab: "editor",
+ rightPanelShown: true,
+ unpinnedTabs: [],
+ conversationMode: "code",
+ subConversationTaskId: null,
+ draftMessage: null,
+ ...overrides,
+ }),
+ );
+};
+
+const setActiveTabState = (tab: "editor" | "planner") => {
+ seedConversationState(REAL_CONVERSATION_ID, {
+ selectedTab: tab,
+ rightPanelShown: true,
+ });
+ useConversationStore.setState({
+ selectedTab: tab,
+ isRightPanelShown: true,
+ hasRightPanelToggled: true,
+ });
+};
+
describe("ConversationTabs localStorage behavior", () => {
beforeEach(() => {
localStorage.clear();
vi.resetAllMocks();
+ mockRefetchGitChanges.mockReset();
+ mockHandleBuildPlanClick.mockReset();
mockConversationId = TASK_CONVERSATION_ID;
mockHasTaskList = false;
+ mockIsFetchingGitChanges = false;
+ mockCurAgentState = AgentState.AWAITING_USER_INPUT;
useConversationStore.setState({
selectedTab: null,
isRightPanelShown: false,
hasRightPanelToggled: false,
+ planContent: null,
});
});
@@ -173,6 +231,108 @@ describe("ConversationTabs localStorage behavior", () => {
});
});
+ describe("tab action buttons", () => {
+ beforeEach(() => {
+ mockConversationId = REAL_CONVERSATION_ID;
+ });
+
+ it("shows the refresh button for the active editor tab and refetches changes", async () => {
+ const user = userEvent.setup();
+ setActiveTabState("editor");
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ const refreshButton = document.querySelector(
+ 'button[aria-label="COMMON$CHANGES"]',
+ );
+ expect(refreshButton).toBeInTheDocument();
+ if (!refreshButton) {
+ throw new Error("Expected refresh button to be rendered");
+ }
+
+ await user.click(refreshButton);
+
+ expect(mockRefetchGitChanges).toHaveBeenCalledTimes(1);
+ });
+
+ it("does not show the build button when the planner tab is inactive", () => {
+ setActiveTabState("editor");
+ useConversationStore.setState({
+ planContent: "# Plan content",
+ });
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ expect(
+ screen.queryByTestId("planner-tab-build-button"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("shows the build button when the planner tab is active", async () => {
+ setActiveTabState("planner");
+ useConversationStore.setState({
+ planContent: "# Plan content",
+ });
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ expect(
+ await screen.findByTestId("planner-tab-build-button"),
+ ).toBeInTheDocument();
+ });
+
+ it("disables the build button when there is no plan content", async () => {
+ setActiveTabState("planner");
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ expect(
+ await screen.findByTestId("planner-tab-build-button"),
+ ).toBeDisabled();
+ });
+
+ it("disables the build button when the agent is running", async () => {
+ mockCurAgentState = AgentState.RUNNING;
+ setActiveTabState("planner");
+ useConversationStore.setState({
+ planContent: "# Plan content",
+ });
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ expect(
+ await screen.findByTestId("planner-tab-build-button"),
+ ).toBeDisabled();
+ });
+
+ it("calls the build handler when the build button is clicked", async () => {
+ const user = userEvent.setup();
+ setActiveTabState("planner");
+ useConversationStore.setState({
+ planContent: "# Plan content",
+ });
+
+ render(<ConversationTabs />, {
+ wrapper: createWrapper(REAL_CONVERSATION_ID),
+ });
+
+ await user.click(await screen.findByTestId("planner-tab-build-button"));
+
+ expect(mockHandleBuildPlanClick).toHaveBeenCalledTimes(1);
+ });
+ });
+
+
describe("tasklist tab", () => {
beforeEach(() => {
mockConversationId = REAL_CONVERSATION_ID;
diff --git a/src/components/features/conversation/conversation-main/conversation-main.tsx b/src/components/features/conversation/conversation-main/conversation-main.tsx
index 5cb11d6d8f..0e69d233cd 100644
--- a/src/components/features/conversation/conversation-main/conversation-main.tsx
+++ b/src/components/features/conversation/conversation-main/conversation-main.tsx
@@ -35,7 +35,7 @@ export function ConversationMain() {
className={cn(
isMobile
? "relative flex-1 flex flex-col"
- : "h-full flex flex-col overflow-hidden md:pt-3",
+ : "h-full flex flex-col overflow-hidden",
)}
>
<div
@@ -58,7 +58,7 @@ export function ConversationMain() {
"flex flex-col bg-base overflow-hidden",
isMobile
? getMobileChatPanelClass(isRightPanelShown)
- : "transition-all duration-300 ease-in-out md:pb-3",
+ : "transition-all duration-300 ease-in-out md:pt-3 md:pb-3",
)}
style={
!isMobile
@@ -114,18 +114,20 @@ export function ConversationMain() {
<div
className={cn(
isMobile
- ? "h-full flex flex-col gap-3 pb-2 md:pb-0 pt-2"
- : "flex flex-col gap-3 h-full w-full",
+ ? "h-full flex flex-col pb-2 md:pb-0 pt-2"
+ : "flex flex-col h-full w-full",
)}
>
- <div
- data-testid="tabs-pane-header"
- className="flex items-center min-h-9"
- >
- <ConversationTabs />
- </div>
- <div className="flex-1 min-h-0 flex flex-col">
- <ConversationTabContent />
+ <div className="flex flex-col flex-1 min-h-0 bg-[#25272D] border border-[#525252] overflow-hidden">
+ <div
+ data-testid="tabs-pane-header"
+ className="flex items-center min-h-9 px-3 py-1.5 border-b border-[#474A54]"
+ >
+ <ConversationTabs />
+ </div>
+ <div className="flex-1 min-h-0 flex flex-col">
+ <ConversationTabContent />
+ </div>
</div>
</div>
</div>
diff --git a/src/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.tsx b/src/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.tsx
index dad2dce2d5..993cd8d77a 100644
--- a/src/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.tsx
+++ b/src/components/features/conversation/conversation-tabs/conversation-tab-content/conversation-tab-content.tsx
@@ -1,11 +1,8 @@
import { lazy, useMemo, Suspense } from "react";
-import { useTranslation } from "react-i18next";
import { ConversationLoading } from "../../conversation-loading";
-import { I18nKey } from "#/i18n/declaration";
import { TabWrapper } from "./tab-wrapper";
import { TabContainer } from "./tab-container";
import { TabContentArea } from "./tab-content-area";
-import { ConversationTabTitle } from "../conversation-tab-title";
import { useConversationStore } from "#/stores/conversation-store";
import { useConversationId } from "#/hooks/use-conversation-id";
@@ -21,40 +18,18 @@ const TaskListTab = lazy(() => import("#/routes/task-list-tab"));
const Terminal = lazy(() => import("#/components/features/terminal/terminal"));
const TAB_CONFIG = {
- tasklist: {
- component: TaskListTab,
- titleKey: I18nKey.COMMON$TASK_LIST,
- },
- editor: {
- component: EditorTab,
- titleKey: I18nKey.COMMON$CHANGES,
- },
- browser: {
- component: BrowserTab,
- titleKey: I18nKey.COMMON$BROWSER,
- },
- served: {
- component: ServedTab,
- titleKey: I18nKey.COMMON$APP,
- },
- vscode: {
- component: VSCodeTab,
- titleKey: I18nKey.COMMON$CODE,
- },
- terminal: {
- component: Terminal,
- titleKey: I18nKey.COMMON$TERMINAL,
- },
- planner: {
- component: PlannerTab,
- titleKey: I18nKey.COMMON$PLANNER,
- },
+ tasklist: { component: TaskListTab },
+ editor: { component: EditorTab },
+ browser: { component: BrowserTab },
+ served: { component: ServedTab },
+ vscode: { component: VSCodeTab },
+ terminal: { component: Terminal },
+ planner: { component: PlannerTab },
};
export function ConversationTabContent() {
const { selectedTab, shouldShownAgentLoading } = useConversationStore();
const { conversationId } = useConversationId();
- const { t } = useTranslation("openhands");
const activeTab = useMemo(
() => TAB_CONFIG[selectedTab ?? "editor"],
@@ -62,7 +37,6 @@ export function ConversationTabContent() {
);
const ActiveComponent = activeTab.component;
- const conversationTabTitle = t(activeTab.titleKey);
if (shouldShownAgentLoading) {
return <ConversationLoading />;
@@ -70,10 +44,6 @@ export function ConversationTabContent() {
return (
<TabContainer>
- <ConversationTabTitle
- title={conversationTabTitle}
- conversationKey={selectedTab ?? "editor"}
- />
<Suspense fallback={<ConversationLoading />}>
<TabContentArea>
<TabWrapper
diff --git a/src/components/features/conversation/conversation-tabs/conversation-tab-content/tab-container.tsx b/src/components/features/conversation/conversation-tabs/conversation-tab-content/tab-container.tsx
index 8ccab18d40..b6333eb69f 100644
--- a/src/components/features/conversation/conversation-tabs/conversation-tab-content/tab-container.tsx
+++ b/src/components/features/conversation/conversation-tabs/conversation-tab-content/tab-container.tsx
@@ -5,9 +5,5 @@ interface TabContainerProps {
}
export function TabContainer({ children }: TabContainerProps) {
- return (
- <div className="bg-[#25272D] border border-[#525252] flex flex-col h-full w-full">
- {children}
- </div>
- );
+ return <div className="flex flex-col h-full w-full">{children}</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 2457928852..96c9a91a9e 100644
--- a/src/components/features/conversation/conversation-tabs/conversation-tab-nav.tsx
+++ b/src/components/features/conversation/conversation-tabs/conversation-tab-nav.tsx
@@ -28,11 +28,11 @@ export function ConversationTabNav({
className={cn(
"flex items-center gap-2 rounded-md cursor-pointer",
"pl-1.5 pr-2 py-1 lg:py-1.5",
- "text-[#9299AA] bg-[#0D0F11]",
- isActive && "bg-[#25272D] text-white",
+ "text-[#9299AA] bg-transparent",
+ isActive && "bg-[#0D0F11] text-white",
isActive
- ? "hover:text-white hover:bg-tertiary"
- : "hover:text-white hover:bg-[#0D0F11]",
+ ? "hover:text-white hover:bg-[#0D0F11]"
+ : "hover:text-white hover:bg-white/5",
isActive ? "focus-within:text-white" : "focus-within:text-[#9299AA]",
className,
)}
diff --git a/src/components/features/conversation/conversation-tabs/conversation-tab-title.tsx b/src/components/features/conversation/conversation-tabs/conversation-tab-title.tsx
deleted file mode 100644
index 92da927918..0000000000
--- a/src/components/features/conversation/conversation-tabs/conversation-tab-title.tsx
+++ /dev/null
@@ -1,76 +0,0 @@
-import { useTranslation } from "react-i18next";
-import RefreshIcon from "#/icons/u-refresh.svg?react";
-import { useUnifiedGetGitChanges } from "#/hooks/query/use-unified-get-git-changes";
-import { useHandleBuildPlanClick } from "#/hooks/use-handle-build-plan-click";
-import { useAgentState } from "#/hooks/use-agent-state";
-import { useConversationStore } from "#/stores/conversation-store";
-import { AgentState } from "#/types/agent-state";
-import { I18nKey } from "#/i18n/declaration";
-import { cn } from "#/utils/utils";
-import { Typography } from "#/ui/typography";
-
-type ConversationTabTitleProps = {
- title: string;
- conversationKey: string;
-};
-
-/* eslint-disable i18next/no-literal-string */
-export function ConversationTabTitle({
- title,
- conversationKey,
-}: ConversationTabTitleProps) {
- const { t } = useTranslation("openhands");
- const { refetch, isFetching } = useUnifiedGetGitChanges();
- const { handleBuildPlanClick } = useHandleBuildPlanClick();
- const { curAgentState } = useAgentState();
- const { planContent } = useConversationStore();
-
- const handleRefresh = () => {
- refetch();
- };
-
- // Determine if Build button should be disabled
- const isAgentRunning =
- curAgentState === AgentState.RUNNING ||
- curAgentState === AgentState.LOADING;
- const isBuildDisabled = isAgentRunning || !planContent;
-
- return (
- <div className="flex flex-row items-center justify-between border-b border-[#474A54] py-2 px-3">
- <span className="text-xs font-medium text-white">{title}</span>
- {conversationKey === "editor" && (
- <button
- type="button"
- className="flex w-[26px] py-1 justify-center items-center gap-[10px] rounded-[7px] hover:enabled:bg-[#474A54] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed"
- onClick={handleRefresh}
- disabled={isFetching}
- >
- <RefreshIcon
- width={12.75}
- height={15}
- color="#ffffff"
- className={isFetching ? "animate-spin" : ""}
- />
- </button>
- )}
- {conversationKey === "planner" && (
- <button
- type="button"
- onClick={handleBuildPlanClick}
- disabled={isBuildDisabled}
- 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",
- )}
- data-testid="planner-tab-build-button"
- >
- <Typography.Text className="text-black text-[11px] font-medium leading-5">
- {t(I18nKey.COMMON$BUILD)} βŒ˜β†©
- </Typography.Text>
- </button>
- )}
- </div>
- );
-}
diff --git a/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx b/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx
index 685563241d..ce79948d65 100644
--- a/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx
+++ b/src/components/features/conversation/conversation-tabs/conversation-tabs.tsx
@@ -8,6 +8,7 @@ import VSCodeIcon from "#/icons/vscode.svg?react";
import ThreeDotsVerticalIcon from "#/icons/three-dots-vertical.svg?react";
import LessonPlanIcon from "#/icons/lesson-plan.svg?react";
import DoubleCheckIcon from "#/icons/double-check.svg?react";
+import RefreshIcon from "#/icons/u-refresh.svg?react";
import { cn } from "#/utils/utils";
import { useConversationLocalStorageState } from "#/utils/conversation-local-storage";
import { ConversationTabNav } from "./conversation-tab-nav";
@@ -19,10 +20,16 @@ import { ConversationTabsContextMenu } from "./conversation-tabs-context-menu";
import { useConversationId } from "#/hooks/use-conversation-id";
import { useSelectConversationTab } from "#/hooks/use-select-conversation-tab";
import { useTaskList } from "#/hooks/use-task-list";
+import { useUnifiedGetGitChanges } from "#/hooks/query/use-unified-get-git-changes";
+import { useHandleBuildPlanClick } from "#/hooks/use-handle-build-plan-click";
+import { useAgentState } from "#/hooks/use-agent-state";
+import { AgentState } from "#/types/agent-state";
+import { Typography } from "#/ui/typography";
export function ConversationTabs() {
const { conversationId } = useConversationId();
- const { setHasRightPanelToggled, setSelectedTab } = useConversationStore();
+ const { setHasRightPanelToggled, setSelectedTab, planContent } =
+ useConversationStore();
const [isMenuOpen, setIsMenuOpen] = useState(false);
@@ -31,6 +38,11 @@ export function ConversationTabs() {
const { hasTaskList } = useTaskList();
+ const { refetch: refetchGitChanges, isFetching: isFetchingGitChanges } =
+ useUnifiedGetGitChanges();
+ const { handleBuildPlanClick } = useHandleBuildPlanClick();
+ const { curAgentState } = useAgentState();
+
const {
selectTab,
isTabActive,
@@ -141,6 +153,11 @@ export function ConversationTabs() {
(tab) => !persistedState.unpinnedTabs.includes(tab.tabValue),
);
+ const isAgentRunning =
+ curAgentState === AgentState.RUNNING ||
+ curAgentState === AgentState.LOADING;
+ const isBuildDisabled = isAgentRunning || !planContent;
+
return (
<div
className={cn(
@@ -178,13 +195,48 @@ export function ConversationTabs() {
</ChatActionTooltip>
),
)}
+ {isTabActive("editor") && (
+ <button
+ type="button"
+ className="flex w-[26px] py-1 justify-center items-center gap-[10px] rounded-[7px] hover:enabled:bg-[#474A54] cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed"
+ onClick={() => refetchGitChanges()}
+ disabled={isFetchingGitChanges}
+ aria-label={t(I18nKey.COMMON$CHANGES)}
+ >
+ <RefreshIcon
+ width={12.75}
+ height={15}
+ color="#ffffff"
+ className={isFetchingGitChanges ? "animate-spin" : ""}
+ />
+ </button>
+ )}
+ {isTabActive("planner") && (
+ <button
+ type="button"
+ onClick={handleBuildPlanClick}
+ disabled={isBuildDisabled}
+ 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",
+ )}
+ 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>
+ )}
<div className="relative">
<button
type="button"
onClick={() => setIsMenuOpen(!isMenuOpen)}
className={cn(
"p-1 pl-0 rounded-md cursor-pointer",
- "text-[#9299AA] bg-[#0D0F11]",
+ "text-[#9299AA] bg-transparent hover:text-white",
)}
aria-label={t(I18nKey.COMMON$MORE_OPTIONS)}
>