π OpenHands: AI-Driven Development
fix(frontend): render Settings icon as a link so it supports Open in new tab (#802)
Hiep Le15356ebbf94b
diff --git a/__tests__/components/features/sidebar/sidebar.test.tsx b/__tests__/components/features/sidebar/sidebar.test.tsxindex 6c31f75b78..aec17c989f 100644--- a/__tests__/components/features/sidebar/sidebar.test.tsx+++ b/__tests__/components/features/sidebar/sidebar.test.tsx@@ -310,7 +310,7 @@ describe("Sidebar", () => {const { navigate } = renderSidebar("/conversations");fireEvent.click(screen.getByTestId("collapsed-settings-link"));- expect(navigate).toHaveBeenCalledWith("/settings");+ expect(navigate).toHaveBeenCalledWith("/settings", { replace: false });});it("opens the backend popover when hovering the collapsed backend icon", async () => {diff --git a/src/components/features/backends/backend-selector.tsx b/src/components/features/backends/backend-selector.tsxindex c6b7537dc2..01504a29e0 100644--- a/src/components/features/backends/backend-selector.tsx+++ b/src/components/features/backends/backend-selector.tsx@@ -21,6 +21,7 @@ import {ENVIRONMENT_SWITCH_SETACTIVE_DELAY_MS,triggerEnvironmentSwitch,} from "#/components/features/backends/environment-switch-store";+import { NavigationLink } from "#/components/shared/navigation-link";import { StyledTooltip } from "#/components/shared/buttons/styled-tooltip";import { useConversationStore } from "#/stores/conversation-store";import { AddBackendModal } from "./add-backend-modal";@@ -336,12 +337,11 @@ export function BackendSelector({placement={settingsTooltipPlacement}offset={10}>- <button- type="button"+ <NavigationLink+ to="/settings"data-testid="backend-selector-settings-link"data-active={isSettingsActive}aria-label={settingsLabel}- onClick={() => navigate("/settings")}className={isSettingsActive? cn(@@ -355,7 +355,7 @@ export function BackendSelector({}><Settings width={16} height={16} />- </button>+ </NavigationLink></StyledTooltip>) : null}</div>diff --git a/src/components/features/sidebar/sidebar-rail-body.tsx b/src/components/features/sidebar/sidebar-rail-body.tsxindex 611fb9912c..c2f60b71eb 100644--- a/src/components/features/sidebar/sidebar-rail-body.tsx+++ b/src/components/features/sidebar/sidebar-rail-body.tsx@@ -8,6 +8,7 @@ import {Settings,} from "lucide-react";import { OpenHandsLogoButton } from "#/components/shared/buttons/openhands-logo-button";+import { NavigationLink } from "#/components/shared/navigation-link";import { SidebarCollapsedIconSlot } from "./sidebar-collapsed-icon-slot";import { SidebarNavLink } from "./sidebar-nav-link";import { I18nKey } from "#/i18n/declaration";@@ -44,7 +45,6 @@ export interface SidebarRailBodyProps {showCollapsedExpandButton: boolean;isExtensionsActive: boolean;currentPath: string;- navigate: (path: string) => void;activeBackendHealth: { isConnected: boolean | null } | undefined;collapsedBackendPopoverOpen: boolean;setCollapsedBackendPopoverOpen: (open: boolean) => void;@@ -68,7 +68,6 @@ export function SidebarRailBody({showCollapsedExpandButton,isExtensionsActive,currentPath,- navigate,activeBackendHealth,collapsedBackendPopoverOpen,setCollapsedBackendPopoverOpen,@@ -224,11 +223,10 @@ export function SidebarRailBody({content={t(I18nKey.SIDEBAR$SETTINGS)}placement="right">- <button- type="button"+ <NavigationLink+ to="/settings"data-testid="collapsed-settings-link"aria-label={t(I18nKey.SIDEBAR$SETTINGS)}- onClick={() => navigate("/settings")}className={sidebarNavRowClassName({ collapsed: true })}><SidebarCollapsedIconSlot@@ -239,7 +237,7 @@ export function SidebarRailBody({<span className={sidebarNavLabelClassName(true)}>{t(I18nKey.SIDEBAR$SETTINGS)}</span>- </button>+ </NavigationLink></StyledTooltip><divclassName="relative"diff --git a/src/components/features/sidebar/sidebar.tsx b/src/components/features/sidebar/sidebar.tsxindex 59fa294f02..677830ef83 100644--- a/src/components/features/sidebar/sidebar.tsx+++ b/src/components/features/sidebar/sidebar.tsx@@ -38,7 +38,7 @@ const MOBILE_DRAWER_TRANSITION_MS = 250;export function Sidebar() {const { t } = useTranslation("openhands");- const { currentPath, navigate } = useNavigation();+ const { currentPath } = useNavigation();const { data: config } = useConfig();const {data: settings,@@ -194,7 +194,6 @@ export function Sidebar() {showCollapsedExpandButton,isExtensionsActive,currentPath,- navigate,activeBackendHealth,collapsedBackendPopoverOpen,setCollapsedBackendPopoverOpen,