π OpenHands: AI-Driven Development
fix: hide in-page settings navigation on desktop (#266)
Hiep Le18f7f985e81e
diff --git a/__tests__/components/features/settings/settings-navigation.test.tsx b/__tests__/components/features/settings/settings-navigation.test.tsxindex 00fe0eaac0..c58eaebb2f 100644--- a/__tests__/components/features/settings/settings-navigation.test.tsx+++ b/__tests__/components/features/settings/settings-navigation.test.tsx@@ -1,4 +1,5 @@import { render, screen } from "@testing-library/react";+import userEvent from "@testing-library/user-event";import { describe, expect, it, vi } from "vitest";import { MemoryRouter } from "react-router";import { SettingsNavigation } from "#/components/features/settings/settings-navigation";@@ -29,4 +30,40 @@ describe("SettingsNavigation", () => {expect(screen.getByText("SETTINGS$NAV_LLM")).toBeInTheDocument();expect(screen.getByText("SETTINGS$NAV_CONDENSER")).toBeInTheDocument();});++ it("closes the mobile drawer when the close button is clicked", async () => {+ const onCloseMobileMenu = vi.fn();+ render(+ <MemoryRouter>+ <SettingsNavigation+ isMobileMenuOpen+ onCloseMobileMenu={onCloseMobileMenu}+ navigationItems={baseItems}+ />+ </MemoryRouter>,+ );++ await userEvent.click(+ screen.getByRole("button", { name: /close navigation menu/i }),+ );++ expect(onCloseMobileMenu).toHaveBeenCalledTimes(1);+ });++ it("closes the mobile drawer after a navigation item is selected", async () => {+ const onCloseMobileMenu = vi.fn();+ render(+ <MemoryRouter>+ <SettingsNavigation+ isMobileMenuOpen+ onCloseMobileMenu={onCloseMobileMenu}+ navigationItems={baseItems}+ />+ </MemoryRouter>,+ );++ await userEvent.click(screen.getByText("SETTINGS$NAV_LLM"));++ expect(onCloseMobileMenu).toHaveBeenCalledTimes(1);+ });});diff --git a/src/components/features/settings/settings-navigation.tsx b/src/components/features/settings/settings-navigation.tsxindex 3d05bed5af..887eb3cfc3 100644--- a/src/components/features/settings/settings-navigation.tsx+++ b/src/components/features/settings/settings-navigation.tsx@@ -34,9 +34,8 @@ export function SettingsNavigation({data-testid="settings-navbar"className={cn("flex flex-col gap-6 transition-transform duration-300 ease-in-out",- "fixed inset-0 z-50 w-full bg-[#050505] p-4 transform md:transform-none",+ "fixed inset-0 z-50 w-full bg-[#050505] p-4 transform md:hidden",isMobileMenuOpen ? "translate-x-0" : "-translate-x-full",- "md:relative md:translate-x-0 md:w-64 md:p-0 md:bg-transparent",)}><div className="flex items-center justify-between">