From 91a0a49264c31ac53458197777012d4334199cdc Mon Sep 17 00:00:00 2001 From: Waleed Date: Mon, 23 Mar 2026 08:57:36 -0700 Subject: [PATCH] feat(sidebar): add right-click context menu to settings nav item (#3715) * feat(sidebar): add right-click context menu to settings nav item * fix(sidebar): revert settings active highlight * fix(sidebar): allow modifier-key clicks to open in new tab, make InfisicalIcon black * update icons --- apps/docs/components/icons.tsx | 2 +- .../w/components/sidebar/sidebar.tsx | 48 ++++++++++++------- apps/sim/components/icons.tsx | 2 +- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/apps/docs/components/icons.tsx b/apps/docs/components/icons.tsx index 19f650044c..ca2a9b1635 100644 --- a/apps/docs/components/icons.tsx +++ b/apps/docs/components/icons.tsx @@ -4143,7 +4143,7 @@ export function InfisicalIcon(props: SVGProps) { ) diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx index 2fe2a5e27b..8e4a7a2c65 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx @@ -199,27 +199,41 @@ const SidebarNavItem = memo(function SidebarNavItem({ 'group flex h-[30px] items-center gap-[8px] rounded-[8px] mx-[2px] px-[8px] text-[14px] hover:bg-[var(--surface-active)]' const activeClasses = active ? 'bg-[var(--surface-active)]' : '' - const element = item.onClick ? ( + const content = ( + <> + + {item.label} + + ) + + const element = item.href ? ( + { + if (e.ctrlKey || e.metaKey || e.shiftKey) return + e.preventDefault() + item.onClick!() + } + : undefined + } + onContextMenu={onContextMenu ? (e) => onContextMenu(e, item.href!) : undefined} + > + {content} + + ) : item.onClick ? ( - ) : ( - onContextMenu(e, item.href!) : undefined} - > - - {item.label} - - ) + ) : null return ( @@ -263,7 +277,7 @@ export const Sidebar = memo(function Sidebar() { const { data: sessionData, isPending: sessionLoading } = useSession() const { canEdit } = useUserPermissionsContext() const { config: permissionConfig, filterBlocks } = usePermissionConfig() - const { navigateToSettings } = useSettingsNavigation() + const { navigateToSettings, getSettingsHref } = useSettingsNavigation() const initializeSearchData = useSearchModalStore((state) => state.initializeData) useEffect(() => { @@ -592,6 +606,7 @@ export const Sidebar = memo(function Sidebar() { id: 'settings', label: 'Settings', icon: Settings, + href: getSettingsHref(), onClick: () => { if (!isCollapsed) { setSidebarWidth(SIDEBAR_WIDTH.MIN) @@ -600,7 +615,7 @@ export const Sidebar = memo(function Sidebar() { }, }, ], - [workspaceId, navigateToSettings, isCollapsed, setSidebarWidth] + [workspaceId, navigateToSettings, getSettingsHref, isCollapsed, setSidebarWidth] ) const { data: fetchedTasks = [], isLoading: tasksLoading } = useTasks(workspaceId) @@ -1381,6 +1396,7 @@ export const Sidebar = memo(function Sidebar() { item={item} active={false} showCollapsedContent={showCollapsedContent} + onContextMenu={item.href ? handleNavItemContextMenu : undefined} /> ))} diff --git a/apps/sim/components/icons.tsx b/apps/sim/components/icons.tsx index 19f650044c..ca2a9b1635 100644 --- a/apps/sim/components/icons.tsx +++ b/apps/sim/components/icons.tsx @@ -4143,7 +4143,7 @@ export function InfisicalIcon(props: SVGProps) { )