Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: make Skills page responsive on mobile and tablet widths (#710)

Hiep Lec61402e75b17
diff --git a/__tests__/components/features/sidebar/sidebar.test.tsx b/__tests__/components/features/sidebar/sidebar.test.tsx
index 2427024b67..6c31f75b78 100644
--- a/__tests__/components/features/sidebar/sidebar.test.tsx
+++ b/__tests__/components/features/sidebar/sidebar.test.tsx
@@ -1,9 +1,16 @@
-import { render, screen, fireEvent, within, waitFor } from "@testing-library/react";
+import {
+ render,
+ screen,
+ fireEvent,
+ within,
+ waitFor,
+} from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { Sidebar } from "#/components/features/sidebar/sidebar";
import { SidebarMobileNavProvider } from "#/components/features/sidebar/sidebar-mobile-nav-context";
import { SidebarMobileMenuBar } from "#/components/features/sidebar/sidebar-mobile-menu-bar";
+import { useSidebarStore } from "#/stores/sidebar-store";
import {
NavigationProvider,
type NavigationContextValue,
@@ -20,9 +27,9 @@ vi.mock("react-i18next", async () => {
...(actual as object),
useTranslation: () => ({
t: (key: string) => {
- const entry = (
- translations as Record<string, Record<string, string>>
- )[key];
+ const entry = (translations as Record<string, Record<string, string>>)[
+ key
+ ];
return entry?.en ?? key;
},
i18n: { language: "en", exists: () => false },
@@ -215,16 +222,22 @@ function renderSidebar(currentPath: string) {
describe("Sidebar", () => {
beforeEach(() => {
window.localStorage.clear();
+ // Zustand store is a module singleton; reset it so collapsed state from
+ // a prior test doesn't bleed into this one.
+ useSidebarStore.setState({ collapsed: false });
});
afterEach(() => {
window.localStorage.clear();
+ useSidebarStore.setState({ collapsed: false });
});
it("opens and closes the mobile navigation drawer from the menu button", async () => {
renderSidebar("/conversations");
- expect(screen.queryByTestId("sidebar-mobile-drawer")).not.toBeInTheDocument();
+ expect(
+ screen.queryByTestId("sidebar-mobile-drawer"),
+ ).not.toBeInTheDocument();
fireEvent.click(screen.getByTestId("sidebar-mobile-menu-toggle"));
const drawer = screen.getByTestId("sidebar-mobile-drawer");
@@ -235,7 +248,9 @@ describe("Sidebar", () => {
fireEvent.click(within(drawer).getByTestId("sidebar-mobile-drawer-close"));
await waitFor(() => {
- expect(screen.queryByTestId("sidebar-mobile-drawer")).not.toBeInTheDocument();
+ expect(
+ screen.queryByTestId("sidebar-mobile-drawer"),
+ ).not.toBeInTheDocument();
});
});
@@ -258,7 +273,7 @@ describe("Sidebar", () => {
it("expands the sidebar when the toggle is clicked from the collapsed state", () => {
// Arrange: simulate a user whose sidebar was previously collapsed.
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
renderSidebar("/conversations");
// Act
@@ -269,7 +284,7 @@ describe("Sidebar", () => {
});
it("expands the sidebar when collapsed rail empty space is clicked", () => {
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
renderSidebar("/conversations");
const sidebar = getDesktopSidebar(true);
@@ -280,7 +295,7 @@ describe("Sidebar", () => {
});
it("shows collapsed server/settings action icons when sidebar is collapsed", () => {
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
renderSidebar("/conversations");
expect(screen.getByTestId("collapsed-settings-link")).toBeInTheDocument();
@@ -291,7 +306,7 @@ describe("Sidebar", () => {
});
it("navigates to settings when collapsed settings icon is clicked", () => {
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
const { navigate } = renderSidebar("/conversations");
fireEvent.click(screen.getByTestId("collapsed-settings-link"));
@@ -299,7 +314,7 @@ describe("Sidebar", () => {
});
it("opens the backend popover when hovering the collapsed backend icon", async () => {
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
renderSidebar("/conversations");
expect(screen.queryByTestId("backend-selector")).not.toBeInTheDocument();
@@ -314,7 +329,7 @@ describe("Sidebar", () => {
// Bug: clicking a backend <li role='option'> bubbled up to the aside's
// rail-collapse handler (which only bails on a/button/[role=button]),
// so selecting a backend would expand the sidebar mid-switch.
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
renderSidebar("/conversations");
const sidebar = getDesktopSidebar(true);
@@ -338,7 +353,7 @@ describe("Sidebar", () => {
// out of the popover toward the centred modal, mouseLeave closed the
// popover, which unmounted BackendSelector and tore the modal down with
// it. Modal state must live above the popover to survive its unmount.
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
renderSidebar("/conversations");
const trigger = screen.getByTestId("collapsed-backend-selector-link");
@@ -359,7 +374,7 @@ describe("Sidebar", () => {
});
it("keeps the Manage Backends modal open after the popover closes", async () => {
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
renderSidebar("/conversations");
const trigger = screen.getByTestId("collapsed-backend-selector-link");
@@ -387,7 +402,7 @@ describe("Sidebar", () => {
// downshift and was treated as "outside". The fix stops propagation on
// the button so neither event reaches the window listeners that close
// the menu.
- window.localStorage.setItem("openhands-sidebar-collapsed", "true");
+ useSidebarStore.setState({ collapsed: true });
const windowMouseDown = vi.fn();
const windowMouseUp = vi.fn();
window.addEventListener("mousedown", windowMouseDown);
diff --git a/__tests__/components/features/skills/extensions-navigation.test.tsx b/__tests__/components/features/skills/extensions-navigation.test.tsx
index 5066de2acd..1581ab65aa 100644
--- a/__tests__/components/features/skills/extensions-navigation.test.tsx
+++ b/__tests__/components/features/skills/extensions-navigation.test.tsx
@@ -1,9 +1,10 @@
import type { ReactNode } from "react";
import { render, screen, within } from "@testing-library/react";
-import { describe, expect, it, vi } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { MemoryRouter } from "react-router";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ActiveBackendProvider } from "#/contexts/active-backend-context";
+import { useSidebarStore } from "#/stores/sidebar-store";
const useSettingsMock = vi.fn();
vi.mock("#/hooks/query/use-settings", () => ({
@@ -109,4 +110,80 @@ describe("ExtensionsNavigation", () => {
expect(skillsItem).not.toHaveAttribute("aria-disabled");
expect(skillsItem.tagName).toBe("A");
});
+
+ // When the primary Sidebar is expanded, an iPad-portrait viewport
+ // (768–1023px) doesn't have horizontal room for both sidebars plus the
+ // page content, so this nav suppresses itself. The three cases below
+ // pin down the gating logic by varying one input at a time.
+ describe("suppresses itself when the Sidebar is expanded at iPad portrait widths", () => {
+ const originalInnerWidth = window.innerWidth;
+
+ function setViewport(width: number) {
+ Object.defineProperty(window, "innerWidth", {
+ configurable: true,
+ writable: true,
+ value: width,
+ });
+ }
+
+ beforeEach(() => {
+ // Arrange: a non-ACP agent so every nav item is clickable and the
+ // hide rule is the only thing that can suppress the aside.
+ useSettingsMock.mockReturnValue({
+ data: { agent_settings: { agent_kind: "openhands" } },
+ });
+ });
+
+ afterEach(() => {
+ setViewport(originalInnerWidth);
+ // The Zustand sidebar store is a module singleton β€” reset it so
+ // a `collapsed: true` from one case doesn't bleed into the next.
+ useSidebarStore.setState({ collapsed: false });
+ });
+
+ it("hides the aside when the Sidebar is expanded and the viewport is in the iPad portrait range (768–1023)", () => {
+ // Arrange: iPad Air portrait, Sidebar expanded.
+ setViewport(820);
+ useSidebarStore.setState({ collapsed: false });
+
+ // Act
+ renderExtensionsNavigation(<ExtensionsNavigation />);
+
+ // Assert: no aside renders, freeing the row for the page's main
+ // column to take the full width.
+ expect(
+ screen.queryByTestId("extensions-navbar-desktop"),
+ ).not.toBeInTheDocument();
+ });
+
+ it("renders the aside in the iPad portrait range once the Sidebar is collapsed", () => {
+ // Arrange: same viewport as above, but the user has collapsed the
+ // primary Sidebar to the icon rail, so there's room for this nav.
+ setViewport(820);
+ useSidebarStore.setState({ collapsed: true });
+
+ // Act
+ renderExtensionsNavigation(<ExtensionsNavigation />);
+
+ // Assert
+ expect(
+ screen.getByTestId("extensions-navbar-desktop"),
+ ).toBeInTheDocument();
+ });
+
+ it("renders the aside at lg+ viewports even when the Sidebar is expanded", () => {
+ // Arrange: desktop viewport (β‰₯1024). The rule only applies in the
+ // md→<lg band, so an expanded Sidebar here should not suppress us.
+ setViewport(1280);
+ useSidebarStore.setState({ collapsed: false });
+
+ // Act
+ renderExtensionsNavigation(<ExtensionsNavigation />);
+
+ // Assert
+ expect(
+ screen.getByTestId("extensions-navbar-desktop"),
+ ).toBeInTheDocument();
+ });
+ });
});
diff --git a/src/components/features/backends/backend-selector.tsx b/src/components/features/backends/backend-selector.tsx
index e35b67cc28..0318624377 100644
--- a/src/components/features/backends/backend-selector.tsx
+++ b/src/components/features/backends/backend-selector.tsx
@@ -22,7 +22,6 @@ import {
triggerEnvironmentSwitch,
} from "#/components/features/backends/environment-switch-store";
import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";
-import { useSidebarCollapsed } from "#/components/features/sidebar/sidebar-collapse-context";
import { useConversationStore } from "#/stores/conversation-store";
import { AddBackendModal } from "./add-backend-modal";
import { BackendStatusDot } from "./backend-status-dot";
@@ -118,6 +117,12 @@ interface BackendSelectorProps {
onOpenAddBackend?: () => void;
/** Same as onOpenAddBackend but for the Manage Backends modal. */
onOpenManageBackends?: () => void;
+ /**
+ * Whether the surrounding sidebar rail is in its collapsed variant. Passed
+ * down from `SidebarRailBody` so the mobile drawer (which always renders
+ * the expanded rail) can override the persisted desktop value.
+ */
+ sidebarCollapsed?: boolean;
}
export function BackendSelector({
@@ -127,6 +132,7 @@ export function BackendSelector({
onSelectOption,
onOpenAddBackend,
onOpenManageBackends,
+ sidebarCollapsed = false,
}: BackendSelectorProps = {}) {
const { t } = useTranslation("openhands");
const { backends, active, setActive } = useActiveBackendContext();
@@ -167,7 +173,6 @@ export function BackendSelector({
const activeOption = options.find((o) => o.value === activeValue);
const isSettingsActive = Boolean(settingsMatch || settingsSubrouteMatch);
const settingsLabel = t(I18nKey.SIDEBAR$SETTINGS);
- const sidebarCollapsed = useSidebarCollapsed();
const isRightPanelShown = useConversationStore(
(state) => state.isRightPanelShown,
);
diff --git a/src/components/features/sidebar/sidebar-collapse-context.ts b/src/components/features/sidebar/sidebar-collapse-context.ts
deleted file mode 100644
index 56da40cff6..0000000000
--- a/src/components/features/sidebar/sidebar-collapse-context.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import React from "react";
-
-/**
- * Lightweight context exposing the sidebar's collapsed state to descendant
- * components (e.g. the conversation list and the "+ New" button) so they can
- * render a compact icon-only variant when the parent sidebar is collapsed.
- */
-export const SidebarCollapseContext = React.createContext<boolean>(false);
-
-export const useSidebarCollapsed = (): boolean =>
- React.useContext(SidebarCollapseContext);
diff --git a/src/components/features/sidebar/sidebar-conversation-list.tsx b/src/components/features/sidebar/sidebar-conversation-list.tsx
index 2bc91f4729..fffdbcf547 100644
--- a/src/components/features/sidebar/sidebar-conversation-list.tsx
+++ b/src/components/features/sidebar/sidebar-conversation-list.tsx
@@ -1,5 +1,14 @@
import { ConversationPanel } from "#/components/features/conversation-panel/conversation-panel";
-import { useSidebarCollapsed } from "./sidebar-collapse-context";
+
+interface SidebarConversationListProps {
+ /**
+ * Whether the surrounding sidebar rail is rendering in its collapsed icon-
+ * only variant. Passed from `SidebarRailBody` so the mobile drawer (which
+ * renders an expanded rail regardless of the persisted desktop state) can
+ * force this list back on.
+ */
+ collapsed: boolean;
+}
/**
* Conversation list section rendered inside the sidebar nav. The list itself
@@ -11,9 +20,9 @@ import { useSidebarCollapsed } from "./sidebar-collapse-context";
* On desktop the aside uses `pr-0` so this list is full width to the rail;
* nav links above keep their own horizontal padding.
*/
-export function SidebarConversationList() {
- const collapsed = useSidebarCollapsed();
-
+export function SidebarConversationList({
+ collapsed,
+}: SidebarConversationListProps) {
if (collapsed) {
return null;
}
diff --git a/src/components/features/sidebar/sidebar-rail-body.tsx b/src/components/features/sidebar/sidebar-rail-body.tsx
index dea08ee8ab..15cafcd34b 100644
--- a/src/components/features/sidebar/sidebar-rail-body.tsx
+++ b/src/components/features/sidebar/sidebar-rail-body.tsx
@@ -212,7 +212,7 @@ export function SidebarRailBody({
/>
</nav>
- <SidebarConversationList />
+ <SidebarConversationList collapsed={collapsed} />
{collapsed && showCollapseToggle ? (
<nav
@@ -293,6 +293,7 @@ export function SidebarRailBody({
onClick={(event) => event.stopPropagation()}
>
<BackendSelector
+ sidebarCollapsed={collapsed}
hideTrigger
defaultOpen
openUpward
@@ -313,7 +314,7 @@ export function SidebarRailBody({
"-ml-2.5 w-[calc(100%+0.625rem)] border-t border-[var(--oh-border)] pt-2 px-2.5",
)}
>
- <BackendSelector openUpward />
+ <BackendSelector sidebarCollapsed={collapsed} openUpward />
</div>
) : null}
</div>
diff --git a/src/components/features/sidebar/sidebar.tsx b/src/components/features/sidebar/sidebar.tsx
index 7c1d7db326..6a6149df92 100644
--- a/src/components/features/sidebar/sidebar.tsx
+++ b/src/components/features/sidebar/sidebar.tsx
@@ -8,9 +8,8 @@ import { I18nKey } from "#/i18n/declaration";
import { useNavigation } from "#/context/navigation-context";
import { useActiveBackendContext } from "#/contexts/active-backend-context";
import { cn } from "#/utils/utils";
-import { SidebarCollapseContext } from "./sidebar-collapse-context";
import { useSidebarMobileNav } from "./sidebar-mobile-nav-context";
-import { useSidebarCollapsedState } from "#/hooks/use-sidebar-collapsed";
+import { useSidebarStore } from "#/stores/sidebar-store";
import { useClickOutsideElement } from "#/hooks/use-click-outside-element";
import { useBackendsHealth } from "#/hooks/query/use-backends-health";
// The LLM settings modal is only mounted when the settings query 404s and
@@ -50,7 +49,8 @@ export function Sidebar() {
const { backends, active } = useActiveBackendContext();
const healthByBackendId = useBackendsHealth(backends);
const activeBackendHealth = healthByBackendId[active.backend.id];
- const [collapsed, setCollapsed] = useSidebarCollapsedState();
+ const collapsed = useSidebarStore((state) => state.collapsed);
+ const setCollapsed = useSidebarStore((state) => state.setCollapsed);
const [settingsModalIsOpen, setSettingsModalIsOpen] = React.useState(false);
const [collapsedBackendPopoverOpen, setCollapsedBackendPopoverOpen] =
React.useState(false);
@@ -192,7 +192,7 @@ export function Sidebar() {
};
return (
- <SidebarCollapseContext.Provider value={collapsed}>
+ <>
{/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- the aside acts as a hit-area for the collapsed rail; nested controls handle their own keyboard interactions. */}
<aside
aria-label={t(I18nKey.SIDEBAR$NAVIGATION_LABEL)}
@@ -248,15 +248,13 @@ export function Sidebar() {
)}
style={{ transitionDuration: `${MOBILE_DRAWER_TRANSITION_MS}ms` }}
>
- <SidebarCollapseContext.Provider value={false}>
- <SidebarRailBody
- collapsed={false}
- showCollapseToggle={false}
- showMobileCloseButton
- onCloseMobile={closeMobileNav}
- {...railBodyProps}
- />
- </SidebarCollapseContext.Provider>
+ <SidebarRailBody
+ collapsed={false}
+ showCollapseToggle={false}
+ showMobileCloseButton
+ onCloseMobile={closeMobileNav}
+ {...railBodyProps}
+ />
</aside>
</>
) : null}
@@ -281,6 +279,6 @@ export function Sidebar() {
/>
</React.Suspense>
)}
- </SidebarCollapseContext.Provider>
+ </>
);
}
diff --git a/src/components/features/skills/extensions-navigation.tsx b/src/components/features/skills/extensions-navigation.tsx
index d64d9ccf91..b88c911141 100644
--- a/src/components/features/skills/extensions-navigation.tsx
+++ b/src/components/features/skills/extensions-navigation.tsx
@@ -8,6 +8,8 @@ import SkillsIcon from "#/icons/skills.svg?react";
import ServerProcessIcon from "#/icons/server-process.svg?react";
import { BackendSyncedSettingsBadge } from "#/components/features/settings/backend-synced-settings-badge";
import { I18nKey } from "#/i18n/declaration";
+import { useSidebarStore } from "#/stores/sidebar-store";
+import { useBreakpoint } from "#/hooks/use-breakpoint";
interface ExtensionNavItem {
to: string;
@@ -68,6 +70,13 @@ export const EXTENSIONS_NAV_ITEMS: ExtensionNavItem[] = [
export function ExtensionsNavigation() {
const { t } = useTranslation("openhands");
const { data: settings } = useSettings();
+ const sidebarCollapsed = useSidebarStore((state) => state.collapsed);
+ // At iPad portrait widths (md to <lg) an expanded primary Sidebar (300px)
+ // plus this nav (260px) leaves the main content unreadable. Hide ourselves
+ // until the user collapses the Sidebar or the viewport reaches `lg`.
+ const belowLg = useBreakpoint(1023);
+ const belowMd = useBreakpoint(767);
+ const hideForExpandedSidebar = !sidebarCollapsed && belowLg && !belowMd;
const isAcpAgent = settings?.agent_settings?.agent_kind === "acp";
const acpServerKey =
typeof settings?.agent_settings?.acp_server === "string"
@@ -78,10 +87,12 @@ export function ExtensionsNavigation() {
"ACP Agent")
: undefined;
+ if (hideForExpandedSidebar) return null;
+
return (
<aside
data-testid="extensions-navbar-desktop"
- className="hidden md:flex md:w-[260px] md:shrink-0 md:flex-col md:gap-2 md:sticky md:top-8 md:self-start md:pl-8"
+ className="hidden md:flex md:w-[260px] md:shrink-0 md:flex-col md:gap-2 md:sticky md:top-8 md:self-start"
>
<span className="px-2 text-sm font-normal text-white">
{t(I18nKey.NAV$EXTENSIONS)}
diff --git a/src/components/features/skills/skills-toolbar.tsx b/src/components/features/skills/skills-toolbar.tsx
index 94c08adf5a..7e11546d90 100644
--- a/src/components/features/skills/skills-toolbar.tsx
+++ b/src/components/features/skills/skills-toolbar.tsx
@@ -37,7 +37,7 @@ export function SkillsToolbar({
<div data-testid="skills-toolbar" className="flex flex-col gap-6">
<div
className={cn(
- "relative flex items-center w-1/2",
+ "relative flex items-center w-full lg:w-1/2",
"rounded-lg border border-[var(--oh-border)] bg-base-secondary",
"focus-within:border-white/40 focus-within:ring-1 focus-within:ring-white/20",
"transition-colors",
diff --git a/src/hooks/use-sidebar-collapsed.ts b/src/hooks/use-sidebar-collapsed.ts
deleted file mode 100644
index 558e461034..0000000000
--- a/src/hooks/use-sidebar-collapsed.ts
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from "react";
-
-const STORAGE_KEY = "openhands-sidebar-collapsed";
-
-const readPersisted = (): boolean => {
- if (typeof window === "undefined") return false;
- try {
- return window.localStorage.getItem(STORAGE_KEY) === "true";
- } catch {
- return false;
- }
-};
-
-/**
- * Persisted boolean for whether the desktop sidebar is collapsed to the
- * icon-only rail. The value is stored in localStorage so the user's choice
- * survives reloads.
- */
-export function useSidebarCollapsedState(): readonly [
- boolean,
- (next: boolean | ((prev: boolean) => boolean)) => void,
-] {
- const [collapsed, setCollapsed] = React.useState<boolean>(readPersisted);
-
- React.useEffect(() => {
- if (typeof window === "undefined") return;
- try {
- window.localStorage.setItem(STORAGE_KEY, collapsed ? "true" : "false");
- } catch {
- // ignore quota / privacy-mode failures; the in-memory state is still fine
- }
- }, [collapsed]);
-
- return [collapsed, setCollapsed] as const;
-}
diff --git a/src/routes/mcp.tsx b/src/routes/mcp.tsx
index c7019db8bd..0be76a79a9 100644
--- a/src/routes/mcp.tsx
+++ b/src/routes/mcp.tsx
@@ -114,7 +114,10 @@ export default function MCPPage() {
if (isLoading || !settings) {
return (
- <div data-testid="mcp-page" className="flex h-full gap-10">
+ <div
+ data-testid="mcp-page"
+ className="flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10"
+ >
<ExtensionsNavigation />
<div className="flex h-full flex-1 items-center justify-center px-4 md:px-0">
<div className="h-8 w-8 rounded-full border-2 border-[var(--oh-border)] border-t-white animate-spin" />
@@ -124,7 +127,10 @@ export default function MCPPage() {
}
return (
- <div data-testid="mcp-page" className="flex h-full gap-10">
+ <div
+ data-testid="mcp-page"
+ className="flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10"
+ >
<ExtensionsNavigation />
<main className={settingsLikeMainScrollClassName}>
<div className="mx-auto flex w-full min-w-0 max-w-[800px] flex-col gap-6">
diff --git a/src/routes/skills-plugins.tsx b/src/routes/skills-plugins.tsx
index c769401c21..f37f2d2e6c 100644
--- a/src/routes/skills-plugins.tsx
+++ b/src/routes/skills-plugins.tsx
@@ -7,7 +7,10 @@ export default function SkillsPluginsScreen() {
const { t } = useTranslation("openhands");
return (
- <div data-testid="skills-plugins-screen" className="flex h-full gap-10">
+ <div
+ data-testid="skills-plugins-screen"
+ className="flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10"
+ >
<ExtensionsNavigation />
<main className={settingsLikeMainScrollClassName}>
<div className="mx-auto w-full min-w-0 max-w-[800px]">
diff --git a/src/routes/skills-settings.tsx b/src/routes/skills-settings.tsx
index dfddddae53..0475a5c760 100644
--- a/src/routes/skills-settings.tsx
+++ b/src/routes/skills-settings.tsx
@@ -87,7 +87,10 @@ function SkillsSettingsScreen() {
}, [skills, typeFilter, searchQuery]);
return (
- <div data-testid="skills-settings-screen" className="flex h-full gap-10">
+ <div
+ data-testid="skills-settings-screen"
+ className="flex h-full gap-4 md:gap-6 md:pl-8 lg:gap-10 lg:pl-10"
+ >
<ExtensionsNavigation />
<main className={cn(settingsLikeMainScrollClassName, "h-full")}>
<div className="mx-auto flex w-full min-w-0 max-w-[800px] flex-col gap-6">
@@ -139,7 +142,7 @@ function SkillsSettingsScreen() {
</p>
) : (
<section className="flex flex-col gap-3">
- <div className="grid grid-cols-2 gap-3">
+ <div className="grid grid-cols-1 gap-3 xl:grid-cols-2">
{filteredSkills.map((skill) => (
<SkillCard
key={skill.name}
diff --git a/src/stores/sidebar-store.ts b/src/stores/sidebar-store.ts
new file mode 100644
index 0000000000..cfc4954817
--- /dev/null
+++ b/src/stores/sidebar-store.ts
@@ -0,0 +1,53 @@
+import { create } from "zustand";
+import { createJSONStorage, persist } from "zustand/middleware";
+
+interface SidebarState {
+ collapsed: boolean;
+}
+
+interface SidebarActions {
+ setCollapsed: (next: boolean | ((prev: boolean) => boolean)) => void;
+ toggleCollapsed: () => void;
+}
+
+type SidebarStore = SidebarState & SidebarActions;
+
+const STORAGE_KEY = "openhands-sidebar";
+const LEGACY_STORAGE_KEY = "openhands-sidebar-collapsed";
+
+export const useSidebarStore = create<SidebarStore>()(
+ persist(
+ (set) => ({
+ collapsed: false,
+ setCollapsed: (next) =>
+ set((state) => ({
+ collapsed: typeof next === "function" ? next(state.collapsed) : next,
+ })),
+ toggleCollapsed: () => set((state) => ({ collapsed: !state.collapsed })),
+ }),
+ {
+ name: STORAGE_KEY,
+ storage: createJSONStorage(() => localStorage),
+ partialize: (state): SidebarState => ({ collapsed: state.collapsed }),
+ },
+ ),
+);
+
+// One-shot migration from the previous raw-string format
+// (`openhands-sidebar-collapsed` = `"true"`/`"false"`). Runs once at import
+// time; only seeds the store when the new key is absent so it never clobbers
+// a user choice made after the upgrade.
+if (typeof window !== "undefined") {
+ try {
+ const legacy = window.localStorage.getItem(LEGACY_STORAGE_KEY);
+ const upgraded = window.localStorage.getItem(STORAGE_KEY) !== null;
+ if (!upgraded && (legacy === "true" || legacy === "false")) {
+ useSidebarStore.setState({ collapsed: legacy === "true" });
+ }
+ if (legacy !== null) {
+ window.localStorage.removeItem(LEGACY_STORAGE_KEY);
+ }
+ } catch {
+ /* localStorage unavailable; the in-memory default is fine */
+ }
+}