diff --git a/packages/browseros-agent/apps/agent/components/sidebar/SettingsSidebar.tsx b/packages/browseros-agent/apps/agent/components/sidebar/SettingsSidebar.tsx deleted file mode 100644 index 3668d0680b..0000000000 --- a/packages/browseros-agent/apps/agent/components/sidebar/SettingsSidebar.tsx +++ /dev/null @@ -1,182 +0,0 @@ -import { - ArrowLeft, - BookOpen, - Bot, - Compass, - GitBranch, - MessageSquare, - Palette, - RotateCcw, - Search, - Server, -} from 'lucide-react' -import type { FC } from 'react' -import { NavLink } from 'react-router' -import { ThemeToggle } from '@/components/elements/theme-toggle' -import { Feature } from '@/lib/browseros/capabilities' -import { useCapabilities } from '@/lib/browseros/useCapabilities' -import { cn } from '@/lib/utils' - -type BaseNavItem = { - name: string - icon: typeof Bot - feature?: Feature -} - -type InternalNavItem = BaseNavItem & { - href?: never - to: string -} - -type ExternalNavItem = BaseNavItem & { - href: string - to?: never -} - -type NavItem = InternalNavItem | ExternalNavItem - -type NavSection = { - label: string - items: NavItem[] -} - -function isExternalNavItem(item: NavItem): item is ExternalNavItem { - return 'href' in item -} - -const getNavLinkClassName = (isActive: boolean) => - cn( - 'flex h-9 items-center gap-2 overflow-hidden whitespace-nowrap rounded-md px-3 font-medium text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground', - isActive && 'bg-sidebar-accent text-sidebar-accent-foreground', - ) - -const getSectionClassName = (index: number) => - cn(index > 0 && 'mt-3 border-t pt-3') - -const sectionLabelClassName = - 'mb-2 px-3 font-semibold text-[10px] text-muted-foreground uppercase tracking-[0.18em]' - -const primarySettingsSections: NavSection[] = [ - { - label: 'Provider Settings', - items: [ - { name: 'BrowserOS AI', to: '/settings/ai', icon: Bot }, - { - name: 'Chat & Council Provider', - to: '/settings/chat', - icon: MessageSquare, - }, - { name: 'Search Provider', to: '/settings/search', icon: Search }, - ], - }, - { - label: 'Other', - items: [ - { - name: 'Customize BrowserOS', - to: '/settings/customization', - icon: Palette, - feature: Feature.CUSTOMIZATION_SUPPORT, - }, - { name: 'BrowserOS as MCP', to: '/settings/mcp', icon: Server }, - { - name: 'Workflows', - to: '/workflows', - icon: GitBranch, - feature: Feature.WORKFLOW_SUPPORT, - }, - ], - }, -] - -const helpItems: NavItem[] = [ - { name: 'Docs', href: 'https://docs.browseros.com/', icon: BookOpen }, - { name: 'Features', to: '/onboarding/features', icon: Compass }, - { name: 'Revisit Onboarding', to: '/onboarding', icon: RotateCcw }, -] - -export const SettingsSidebar: FC = () => { - const { supports } = useCapabilities() - - const filteredSections = primarySettingsSections - .map((section) => ({ - ...section, - items: section.items.filter( - (item) => !item.feature || supports(item.feature), - ), - })) - .filter((section) => section.items.length > 0) - - const filteredHelpItems = helpItems.filter( - (item) => !item.feature || supports(item.feature), - ) - - const renderNavItem = (item: NavItem) => { - const Icon = item.icon - - if (isExternalNavItem(item)) { - return ( - - - {item.name} - - ) - } - - return ( - getNavLinkClassName(isActive)} - > - - {item.name} - - ) - } - - const renderSection = (section: NavSection, index: number) => ( -
-
{section.label}
- -
- ) - - return ( -
-
- - - Back - - -
- -
-
- Settings -
-
{filteredSections.map(renderSection)}
-
-
Help
- -
-
-
- ) -} diff --git a/packages/browseros-agent/apps/agent/components/sidebar/SidebarNavigation.tsx b/packages/browseros-agent/apps/agent/components/sidebar/SidebarNavigation.tsx index 969154fed0..ab65bc803e 100644 --- a/packages/browseros-agent/apps/agent/components/sidebar/SidebarNavigation.tsx +++ b/packages/browseros-agent/apps/agent/components/sidebar/SidebarNavigation.tsx @@ -1,6 +1,7 @@ import { Brain, CalendarClock, + GitBranch, Home, PlugZap, Settings, @@ -17,6 +18,7 @@ import { } from '@/components/ui/tooltip' import { Feature } from '@/lib/browseros/capabilities' import { useCapabilities } from '@/lib/browseros/useCapabilities' +import { useOpenSettings } from '@/lib/settings/useOpenSettings' import { cn } from '@/lib/utils' interface SidebarNavigationProps { @@ -25,9 +27,10 @@ interface SidebarNavigationProps { type NavItem = { name: string - to: string + to?: string icon: typeof Home feature?: Feature + action?: 'settings' } const primaryNavItems: NavItem[] = [ @@ -39,6 +42,12 @@ const primaryNavItems: NavItem[] = [ feature: Feature.MANAGED_MCP_SUPPORT, }, { name: 'Scheduled Tasks', to: '/scheduled', icon: CalendarClock }, + { + name: 'Workflows', + to: '/workflows', + icon: GitBranch, + feature: Feature.WORKFLOW_SUPPORT, + }, { name: 'Skills', to: '/home/skills', @@ -57,14 +66,19 @@ const primaryNavItems: NavItem[] = [ icon: Sparkles, feature: Feature.SOUL_SUPPORT, }, - { name: 'Settings', to: '/settings/ai', icon: Settings }, + { name: 'Settings', icon: Settings, action: 'settings' }, ] +const navItemClassName = + 'flex h-9 items-center gap-2 overflow-hidden whitespace-nowrap rounded-md px-3 font-medium text-sm transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground' + export const SidebarNavigation: FC = ({ expanded = true, }) => { const location = useLocation() + const openSettings = useOpenSettings() const { supports } = useCapabilities() + const isSettingsActive = location.pathname.startsWith('/settings') const filteredItems = primaryNavItems.filter( (item) => !item.feature || supports(item.feature), @@ -76,16 +90,52 @@ export const SidebarNavigation: FC = ({