From abc0a41d9ecf9a27a023202a729311d748c63310 Mon Sep 17 00:00:00 2001 From: Fred KISSIE Date: Sat, 13 Jun 2026 00:27:39 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20reorganize=20command=20bar?= =?UTF-8?q?=20items?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- messages/en-US.json | 36 ++ src/app/navigation.tsx | 328 +++++++++--------- src/components/Layout.tsx | 7 +- .../command-palette/CommandPalette.tsx | 27 +- .../useCommandPaletteNavigation.ts | 6 +- src/components/ui/command.tsx | 6 +- 6 files changed, 223 insertions(+), 187 deletions(-) diff --git a/messages/en-US.json b/messages/en-US.json index e18385159..e6567cc08 100644 --- a/messages/en-US.json +++ b/messages/en-US.json @@ -1590,6 +1590,42 @@ "sidebarManagement": "Management", "sidebarBillingAndLicenses": "Billing & Licenses", "sidebarLogsAnalytics": "Analytics", + "commandSites": "Sites", + "commandActionModeInfo": "Type \">\" to open action mode", + "commandResources": "Resources", + "commandProxyResources": "Public Resources", + "commandClientResources": "Private Resources", + "commandClients": "Clients", + "commandUserDevices": "User Devices", + "commandMachineClients": "Machine Clients", + "commandDomains": "Domains", + "commandRemoteExitNodes": "Remote Nodes", + "commandTeam": "Team", + "commandUsers": "Users", + "commandRoles": "Roles", + "commandInvitations": "Invitations", + "commandPolicies": "Shared Policies", + "commandResourcePolicies": "Public Resources Policies", + "commandIdentityProviders": "Identity Providers", + "commandApprovals": "Approval Requests", + "commandShareableLinks": "Shareable Links", + "commandOrganization": "Organization", + "commandLogsAndAnalytics": "Logs & Analytics", + "commandLogsAnalytics": "Analytics", + "commandLogsRequest": "HTTP Request Logs", + "commandLogsAccess": "Authentication Logs", + "commandLogsAction": "Admin Action Logs", + "commandLogsConnection": "Network Logs", + "commandLogsStreaming": "Event Streaming", + "commandManagement": "Management", + "commandAlerting": "Alerting", + "commandProvisioning": "Provisioning", + "commandBluePrints": "Blueprints", + "commandApiKeys": "API Keys", + "commandBillingAndLicenses": "Billing & Licenses", + "commandBilling": "Billing", + "commandEnterpriseLicenses": "Licenses", + "commandSettings": "Settings", "alertingTitle": "Alerting", "alertingDescription": "Define sources, triggers, and actions for notifications", "alertingRules": "Alert rules", diff --git a/src/app/navigation.tsx b/src/app/navigation.tsx index e0ada4c1c..b3eab82ed 100644 --- a/src/app/navigation.tsx +++ b/src/app/navigation.tsx @@ -341,59 +341,56 @@ export const adminNavSections = (env?: Env): SidebarNavSection[] => [ } ]; +export type CommandBarNavSection = { + // Added from 'dev' branch + heading: string; + items: CommandBarNavItem[]; +}; + +export type CommandBarNavItem = { + href?: string; + title: string; + icon?: React.ReactNode; + showEE?: boolean; + isBeta?: boolean; +}; + export const commandBarNavSections = ( env?: Env, options?: OrgNavSectionsOptions -): SidebarNavSection[] => [ +): CommandBarNavSection[] => [ { heading: "network", items: [ { - title: "sidebarSites", + title: "commandSites", href: "/{orgId}/settings/sites", icon: }, { - title: "sidebarResources", - icon: , - items: [ - { - title: "sidebarProxyResources", - href: "/{orgId}/settings/resources/public", - icon: - }, - { - title: "sidebarClientResources", - href: "/{orgId}/settings/resources/private", - icon: - } - ] - }, - { - title: "sidebarClients", - icon: , - items: [ - { - href: "/{orgId}/settings/clients/user", - title: "sidebarUserDevices", - icon: - }, - { - href: "/{orgId}/settings/clients/machine", - title: "sidebarMachineClients", - icon: - } - ] - }, - { - title: "sidebarDomains", - href: "/{orgId}/settings/domains", + title: "commandProxyResources", + href: "/{orgId}/settings/resources/public", icon: }, + { + title: "commandClientResources", + href: "/{orgId}/settings/resources/private", + icon: + }, + { + href: "/{orgId}/settings/clients/user", + title: "commandUserDevices", + icon: + }, + { + href: "/{orgId}/settings/clients/machine", + title: "commandMachineClients", + icon: + }, ...(build === "saas" ? [ { - title: "sidebarRemoteExitNodes", + title: "commandRemoteExitNodes", href: "/{orgId}/settings/remote-exit-nodes", icon: } @@ -402,44 +399,34 @@ export const commandBarNavSections = ( ] }, { - heading: "accessControl", + heading: "commandTeam", items: [ { - title: "sidebarTeam", - icon: , - items: [ - { - title: "sidebarUsers", - href: "/{orgId}/settings/access/users", - icon: - }, - { - title: "sidebarRoles", - href: "/{orgId}/settings/access/roles", - icon: - }, - { - title: "sidebarInvitations", - href: "/{orgId}/settings/access/invitations", - icon: - } - ] + title: "commandUsers", + href: "/{orgId}/settings/access/users", + icon: }, + { + title: "commandRoles", + href: "/{orgId}/settings/access/roles", + icon: + }, + { + title: "commandInvitations", + href: "/{orgId}/settings/access/invitations", + icon: + } + ] + }, + { + heading: "accessControl", + items: [ ...(!env?.flags.disableEnterpriseFeatures ? [ { - title: "sidebarPolicies", - - icon: , - items: [ - { - title: "sidebarResourcePolicies", - href: "/{orgId}/settings/policies/resources/public", - icon: ( - - ) - } - ] + title: "commandResourcePolicies", + href: "/{orgId}/settings/policies/resources/public", + icon: } ] : []), @@ -450,7 +437,7 @@ export const commandBarNavSections = ( (env?.app.identityProviderMode === undefined && build !== "oss") ? [ { - title: "sidebarIdentityProviders", + title: "commandIdentityProviders", href: "/{orgId}/settings/idp", icon: } @@ -459,134 +446,129 @@ export const commandBarNavSections = ( ...(!env?.flags.disableEnterpriseFeatures ? [ { - title: "sidebarApprovals", + title: "commandApprovals", href: "/{orgId}/settings/access/approvals", icon: } ] : []), { - title: "sidebarShareableLinks", + title: "commandShareableLinks", href: "/{orgId}/settings/share-links", icon: } ] }, { - heading: "sidebarOrganization", + heading: "commandLogsAndAnalytics", items: [ { - title: "sidebarLogsAndAnalytics", - icon: , - items: [ - { - title: "sidebarLogsAnalytics", - href: "/{orgId}/settings/logs/analytics", - icon: - }, - { - title: "sidebarLogsRequest", - href: "/{orgId}/settings/logs/request", - icon: ( - - ) - }, - ...(!env?.flags.disableEnterpriseFeatures - ? [ - { - title: "sidebarLogsAccess", - href: "/{orgId}/settings/logs/access", - icon: - }, - { - title: "sidebarLogsAction", - href: "/{orgId}/settings/logs/action", - icon: - }, - { - title: "sidebarLogsConnection", - href: "/{orgId}/settings/logs/connection", - icon: - }, - { - title: "sidebarLogsStreaming", - href: "/{orgId}/settings/logs/streaming", - icon: - } - ] - : []) - ] + title: "commandLogsAnalytics", + href: "/{orgId}/settings/logs/analytics", + icon: }, { - title: "sidebarManagement", - icon: , - items: [ - ...(!env?.flags.disableEnterpriseFeatures - ? [ - { - title: "sidebarAlerting", - href: "/{orgId}/settings/alerting", - icon: ( - - ) - }, - { - title: "sidebarProvisioning", - href: "/{orgId}/settings/provisioning", - icon: - } - ] - : []), - { - title: "sidebarBluePrints", - href: "/{orgId}/settings/blueprints", - icon: - }, - { - title: "sidebarApiKeys", - href: "/{orgId}/settings/api-keys", - icon: - }, - ...(!env?.flags.disableEnterpriseFeatures - ? [ - { - title: "labels", - href: "/{orgId}/settings/labels", - icon: - } - ] - : []) - ] + title: "commandLogsRequest", + href: "/{orgId}/settings/logs/request", + icon: }, - ...(build === "saas" && options?.isPrimaryOrg + ...(!env?.flags.disableEnterpriseFeatures ? [ { - title: "sidebarBillingAndLicenses", - icon: , - items: [ - { - title: "sidebarBilling", - href: "/{orgId}/settings/billing", - icon: ( - - ) - }, - { - title: "sidebarEnterpriseLicenses", - href: "/{orgId}/settings/license", - icon: ( - - ) - } - ] + title: "commandLogsAccess", + href: "/{orgId}/settings/logs/access", + icon: + }, + { + title: "commandLogsAction", + href: "/{orgId}/settings/logs/action", + icon: + }, + { + title: "commandLogsConnection", + href: "/{orgId}/settings/logs/connection", + icon: + }, + { + title: "commandLogsStreaming", + href: "/{orgId}/settings/logs/streaming", + icon: + } + ] + : []) + ] + }, + { + heading: "commandManagement", + items: [ + ...(!env?.flags.disableEnterpriseFeatures + ? [ + { + title: "commandAlerting", + href: "/{orgId}/settings/alerting", + icon: + }, + { + title: "commandProvisioning", + href: "/{orgId}/settings/provisioning", + icon: } ] : []), { - title: "sidebarSettings", + title: "commandBluePrints", + href: "/{orgId}/settings/blueprints", + icon: + }, + { + title: "commandApiKeys", + href: "/{orgId}/settings/api-keys", + icon: + }, + ...(!env?.flags.disableEnterpriseFeatures + ? [ + { + title: "labels", + href: "/{orgId}/settings/labels", + icon: + } + ] + : []) + ] + }, + + { + heading: "commandOrganization", + items: [ + { + title: "commandSettings", href: "/{orgId}/settings/general", icon: + }, + { + title: "commandDomains", + href: "/{orgId}/settings/domains", + icon: } ] - } + }, + ...(build === "saas" && options?.isPrimaryOrg + ? [ + { + heading: "commandBillingAndLicenses", + items: [ + { + title: "commandBilling", + href: "/{orgId}/settings/billing", + icon: + }, + { + title: "commandEnterpriseLicenses", + href: "/{orgId}/settings/license", + icon: + } + ] + } + ] + : []) ]; diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 8dc95968f..991c489a7 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -1,7 +1,10 @@ import React from "react"; import { cn } from "@app/lib/cn"; import { ListUserOrgsResponse } from "@server/routers/org"; -import type { SidebarNavSection } from "@app/app/navigation"; +import type { + CommandBarNavSection, + SidebarNavSection +} from "@app/app/navigation"; import { LayoutSidebar } from "@app/components/LayoutSidebar"; import { LayoutHeader } from "@app/components/LayoutHeader"; import { LayoutMobileMenu } from "@app/components/LayoutMobileMenu"; @@ -13,7 +16,7 @@ interface LayoutProps { orgId?: string; orgs?: ListUserOrgsResponse["orgs"]; navItems?: SidebarNavSection[]; - commandNavItems?: SidebarNavSection[]; + commandNavItems?: CommandBarNavSection[]; showSidebar?: boolean; showHeader?: boolean; showTopBar?: boolean; diff --git a/src/components/command-palette/CommandPalette.tsx b/src/components/command-palette/CommandPalette.tsx index b0536d8a9..bbf5b9187 100644 --- a/src/components/command-palette/CommandPalette.tsx +++ b/src/components/command-palette/CommandPalette.tsx @@ -9,7 +9,10 @@ import { CommandList, CommandSeparator } from "@app/components/ui/command"; -import type { SidebarNavSection } from "@app/app/navigation"; +import type { + CommandBarNavSection, + SidebarNavSection +} from "@app/app/navigation"; import { Badge } from "@app/components/ui/badge"; import { ListUserOrgsResponse } from "@server/routers/org"; import { Loader2 } from "lucide-react"; @@ -28,11 +31,12 @@ import { useCommandPaletteNavigation } from "./useCommandPaletteNavigation"; import { useCommandPaletteOrganizations } from "./useCommandPaletteOrganizations"; import { useCommandPaletteSearch } from "./useCommandPaletteSearch"; import { useUserContext } from "@app/hooks/useUserContext"; +import { cn } from "@app/lib/cn"; type CommandPaletteProps = { orgId?: string; orgs?: ListUserOrgsResponse["orgs"]; - navItems: SidebarNavSection[]; + navItems: CommandBarNavSection[]; }; /** @@ -89,28 +93,35 @@ export function CommandPalette({ orgId, orgs, navItems }: CommandPaletteProps) { title={t("commandPaletteTitle")} description={t("commandPaletteDescription")} className="max-w-2xl **:data-[slot=command-input-wrapper]:h-15" + commandProps={{ + loop: true + }} > - + {t("commandPaletteNoResults")} - {navigationGroups.map((group, idx) => ( + {navigationGroups.map((group, groupIndex) => ( - {idx > 0 && } + {groupIndex > 0 && } 0 && + "[&_[cmdk-group-heading]]:pt-3" + )} > - {group.items.map((item) => ( + {group.items.map((item, itemIndex) => ( ; }) { return ( @@ -49,7 +50,10 @@ function CommandDialog({ {description} - + {children}