diff --git a/apps/ui/src/components/layout/sidebar.tsx b/apps/ui/src/components/layout/sidebar.tsx index 0fa7ce54..2b8c1e8a 100644 --- a/apps/ui/src/components/layout/sidebar.tsx +++ b/apps/ui/src/components/layout/sidebar.tsx @@ -3,13 +3,9 @@ import { useNavigate, useLocation } from '@tanstack/react-router'; import { cn } from '@/lib/utils'; import { useAppStore, formatShortcut, type ThemeMode } from '@/store/app-store'; import { - FolderOpen, - Plus, Settings, Folder, X, - PanelLeft, - PanelLeftClose, ChevronDown, Redo2, Check, @@ -21,9 +17,7 @@ import { Palette, Monitor, Search, - Bug, Activity, - Recycle, Sparkles, Loader2, Rocket, @@ -75,6 +69,9 @@ import { ThemeMenuItem, BugReportButton, CollapseToggleButton, + SidebarHeader, + ProjectActions, + SidebarNavigation, } from './sidebar/components'; import { PROJECT_DARK_THEMES, @@ -678,204 +675,21 @@ export function Sidebar() { />
- {/* Logo */} -
-
navigate({ to: '/' })} - data-testid="logo-button" - > - {!sidebarOpen ? ( -
- - - - - - - - - - - - - - - - - -
- ) : ( -
- - - - - - - - - - - - - - - - - - - automaker. - -
- )} -
- {/* Bug Report Button - Inside logo container when expanded */} - {sidebarOpen && } -
- - {/* Bug Report Button - Collapsed sidebar version */} - {!sidebarOpen && ( -
- -
- )} + {/* Project Actions - Moved above project selector */} {sidebarOpen && ( -
- - - -
+ )} {/* Project Selector with Cycle Buttons */} @@ -1163,123 +977,13 @@ export function Sidebar() {
)} - {/* Nav Items - Scrollable */} - + {/* Bottom Section - Running Agents / Bug Report / Settings */} diff --git a/apps/ui/src/components/layout/sidebar/components/automaker-logo.tsx b/apps/ui/src/components/layout/sidebar/components/automaker-logo.tsx new file mode 100644 index 00000000..66345b92 --- /dev/null +++ b/apps/ui/src/components/layout/sidebar/components/automaker-logo.tsx @@ -0,0 +1,117 @@ +import type { NavigateOptions } from '@tanstack/react-router'; +import { cn } from '@/lib/utils'; + +interface AutomakerLogoProps { + sidebarOpen: boolean; + navigate: (opts: NavigateOptions) => void; +} + +export function AutomakerLogo({ sidebarOpen, navigate }: AutomakerLogoProps) { + return ( +
navigate({ to: '/' })} + data-testid="logo-button" + > + {!sidebarOpen ? ( +
+ + + + + + + + + + + + + + + + + +
+ ) : ( +
+ + + + + + + + + + + + + + + + + + + automaker. + +
+ )} +
+ ); +} diff --git a/apps/ui/src/components/layout/sidebar/components/index.ts b/apps/ui/src/components/layout/sidebar/components/index.ts index 0e320be9..31ecd852 100644 --- a/apps/ui/src/components/layout/sidebar/components/index.ts +++ b/apps/ui/src/components/layout/sidebar/components/index.ts @@ -2,3 +2,7 @@ export { SortableProjectItem } from './sortable-project-item'; export { ThemeMenuItem } from './theme-menu-item'; export { BugReportButton } from './bug-report-button'; export { CollapseToggleButton } from './collapse-toggle-button'; +export { AutomakerLogo } from './automaker-logo'; +export { SidebarHeader } from './sidebar-header'; +export { ProjectActions } from './project-actions'; +export { SidebarNavigation } from './sidebar-navigation'; diff --git a/apps/ui/src/components/layout/sidebar/components/project-actions.tsx b/apps/ui/src/components/layout/sidebar/components/project-actions.tsx new file mode 100644 index 00000000..3730afe7 --- /dev/null +++ b/apps/ui/src/components/layout/sidebar/components/project-actions.tsx @@ -0,0 +1,91 @@ +import { Plus, FolderOpen, Recycle } from 'lucide-react'; +import { cn } from '@/lib/utils'; +import { formatShortcut } from '@/store/app-store'; +import type { TrashedProject } from '@/lib/electron'; + +interface ProjectActionsProps { + setShowNewProjectModal: (show: boolean) => void; + handleOpenFolder: () => void; + setShowTrashDialog: (show: boolean) => void; + trashedProjects: TrashedProject[]; + shortcuts: { + openProject: string; + }; +} + +export function ProjectActions({ + setShowNewProjectModal, + handleOpenFolder, + setShowTrashDialog, + trashedProjects, + shortcuts, +}: ProjectActionsProps) { + return ( +
+ + + +
+ ); +} diff --git a/apps/ui/src/components/layout/sidebar/components/sidebar-header.tsx b/apps/ui/src/components/layout/sidebar/components/sidebar-header.tsx new file mode 100644 index 00000000..89352f15 --- /dev/null +++ b/apps/ui/src/components/layout/sidebar/components/sidebar-header.tsx @@ -0,0 +1,40 @@ +import type { NavigateOptions } from '@tanstack/react-router'; +import { cn } from '@/lib/utils'; +import { AutomakerLogo } from './automaker-logo'; +import { BugReportButton } from './bug-report-button'; + +interface SidebarHeaderProps { + sidebarOpen: boolean; + navigate: (opts: NavigateOptions) => void; + handleBugReportClick: () => void; +} + +export function SidebarHeader({ sidebarOpen, navigate, handleBugReportClick }: SidebarHeaderProps) { + return ( + <> + {/* Logo */} +
+ + {/* Bug Report Button - Inside logo container when expanded */} + {sidebarOpen && } +
+ + {/* Bug Report Button - Collapsed sidebar version */} + {!sidebarOpen && ( +
+ +
+ )} + + ); +} diff --git a/apps/ui/src/components/layout/sidebar/components/sidebar-navigation.tsx b/apps/ui/src/components/layout/sidebar/components/sidebar-navigation.tsx new file mode 100644 index 00000000..4e0f7cf1 --- /dev/null +++ b/apps/ui/src/components/layout/sidebar/components/sidebar-navigation.tsx @@ -0,0 +1,140 @@ +import type { NavigateOptions } from '@tanstack/react-router'; +import { cn } from '@/lib/utils'; +import { formatShortcut } from '@/store/app-store'; +import type { NavSection } from '../types'; +import type { Project } from '@/lib/electron'; + +interface SidebarNavigationProps { + currentProject: Project | null; + sidebarOpen: boolean; + navSections: NavSection[]; + isActiveRoute: (id: string) => boolean; + navigate: (opts: NavigateOptions) => void; +} + +export function SidebarNavigation({ + currentProject, + sidebarOpen, + navSections, + isActiveRoute, + navigate, +}: SidebarNavigationProps) { + return ( + + ); +}