Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Add Documentation link to profile context menu (#11583)

John-Mason P. Shackelford6e9e7547e50f
diff --git a/frontend/__tests__/components/context-menu/account-settings-context-menu.test.tsx b/frontend/__tests__/components/context-menu/account-settings-context-menu.test.tsx
index 1cfc1b8fb7..5eeafbc51d 100644
--- a/frontend/__tests__/components/context-menu/account-settings-context-menu.test.tsx
+++ b/frontend/__tests__/components/context-menu/account-settings-context-menu.test.tsx
@@ -33,9 +33,24 @@ describe("AccountSettingsContextMenu", () => {
expect(
screen.getByTestId("account-settings-context-menu"),
).toBeInTheDocument();
+ expect(screen.getByText("SIDEBAR$DOCS")).toBeInTheDocument();
expect(screen.getByText("ACCOUNT_SETTINGS$LOGOUT")).toBeInTheDocument();
});
+ it("should render Documentation link with correct attributes", () => {
+ renderWithRouter(
+ <AccountSettingsContextMenu
+ onLogout={onLogoutMock}
+ onClose={onCloseMock}
+ />,
+ );
+
+ const documentationLink = screen.getByText("SIDEBAR$DOCS").closest("a");
+ expect(documentationLink).toHaveAttribute("href", "https://docs.openhands.dev");
+ expect(documentationLink).toHaveAttribute("target", "_blank");
+ expect(documentationLink).toHaveAttribute("rel", "noopener noreferrer");
+ });
+
it("should call onLogout when the logout option is clicked", async () => {
renderWithRouter(
<AccountSettingsContextMenu
diff --git a/frontend/src/components/features/context-menu/account-settings-context-menu.tsx b/frontend/src/components/features/context-menu/account-settings-context-menu.tsx
index 8c212dd5fc..c09920e614 100644
--- a/frontend/src/components/features/context-menu/account-settings-context-menu.tsx
+++ b/frontend/src/components/features/context-menu/account-settings-context-menu.tsx
@@ -8,6 +8,7 @@ import { useClickOutsideElement } from "#/hooks/use-click-outside-element";
import { useConfig } from "#/hooks/query/use-config";
import { I18nKey } from "#/i18n/declaration";
import LogOutIcon from "#/icons/log-out.svg?react";
+import DocumentIcon from "#/icons/document.svg?react";
import { SAAS_NAV_ITEMS, OSS_NAV_ITEMS } from "#/constants/settings-nav";
interface AccountSettingsContextMenuProps {
@@ -58,6 +59,21 @@ export function AccountSettingsContextMenu({
<Divider />
+ <a
+ href="https://docs.openhands.dev"
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-decoration-none"
+ >
+ <ContextMenuListItem
+ onClick={onClose}
+ className="flex items-center gap-2 p-2 hover:bg-[#5C5D62] rounded h-[30px]"
+ >
+ <DocumentIcon width={16} height={16} />
+ <span className="text-white text-sm">{t(I18nKey.SIDEBAR$DOCS)}</span>
+ </ContextMenuListItem>
+ </a>
+
<ContextMenuListItem
onClick={onLogout}
className="flex items-center gap-2 p-2 hover:bg-[#5C5D62] rounded h-[30px]"