From a4214276d7d90bb9ab254920de23309b79cd6ef2 Mon Sep 17 00:00:00 2001 From: Stefan de Vogelaere Date: Fri, 23 Jan 2026 01:58:15 +0100 Subject: [PATCH] fix(ui): address PR review comments and fix E2E tests for unified sidebar - Add try/catch for getElectronAPI() in sidebar-footer with window.open fallback - Use formatShortcut() for OS-aware hotkey display in sidebar-header - Remove unnecessary optional chaining on project.icon - Remove redundant ternary in sidebar-navigation className - Update E2E tests to use new project-dropdown-trigger data-testid Co-Authored-By: Claude Opus 4.5 --- .../layout/sidebar/components/sidebar-footer.tsx | 9 +++++++-- .../layout/sidebar/components/sidebar-header.tsx | 11 ++++++++--- .../layout/sidebar/components/sidebar-navigation.tsx | 8 +------- .../tests/features/feature-manual-review-flow.spec.ts | 9 ++++----- apps/ui/tests/projects/new-project-creation.spec.ts | 9 ++++----- apps/ui/tests/projects/open-existing-project.spec.ts | 9 ++++----- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/apps/ui/src/components/layout/sidebar/components/sidebar-footer.tsx b/apps/ui/src/components/layout/sidebar/components/sidebar-footer.tsx index b407e365..49f4eccf 100644 --- a/apps/ui/src/components/layout/sidebar/components/sidebar-footer.tsx +++ b/apps/ui/src/components/layout/sidebar/components/sidebar-footer.tsx @@ -51,8 +51,13 @@ export function SidebarFooter({ }, [navigate]); const handleFeedbackClick = useCallback(() => { - const api = getElectronAPI(); - api.openExternalLink('https://github.com/AutoMaker-Org/automaker/issues'); + try { + const api = getElectronAPI(); + api.openExternalLink('https://github.com/AutoMaker-Org/automaker/issues'); + } catch { + // Fallback for non-Electron environments (SSR, web browser) + window.open('https://github.com/AutoMaker-Org/automaker/issues', '_blank'); + } }, []); // Collapsed state diff --git a/apps/ui/src/components/layout/sidebar/components/sidebar-header.tsx b/apps/ui/src/components/layout/sidebar/components/sidebar-header.tsx index db4835dd..afca3e9c 100644 --- a/apps/ui/src/components/layout/sidebar/components/sidebar-header.tsx +++ b/apps/ui/src/components/layout/sidebar/components/sidebar-header.tsx @@ -4,6 +4,7 @@ import { ChevronsUpDown, Folder, Plus, FolderOpen } from 'lucide-react'; import * as LucideIcons from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; import { cn, isMac } from '@/lib/utils'; +import { formatShortcut } from '@/store/app-store'; import { isElectron, type Project } from '@/lib/electron'; import { getAuthenticatedImageUrl } from '@/lib/api-fetch'; import { useAppStore } from '@/store/app-store'; @@ -49,7 +50,7 @@ export function SidebarHeader({ ); const getIconComponent = (project: Project): LucideIcon => { - if (project?.icon && project.icon in LucideIcons) { + if (project.icon && project.icon in LucideIcons) { return (LucideIcons as unknown as Record)[project.icon]; } return Folder; @@ -200,7 +201,9 @@ export function SidebarHeader({ {project.name} {hotkeyLabel && ( - ⌘{hotkeyLabel} + + {formatShortcut(`Cmd+${hotkeyLabel}`, true)} + )} ); @@ -342,7 +345,9 @@ export function SidebarHeader({ {project.name} {hotkeyLabel && ( - ⌘{hotkeyLabel} + + {formatShortcut(`Cmd+${hotkeyLabel}`, true)} + )} ); diff --git a/apps/ui/src/components/layout/sidebar/components/sidebar-navigation.tsx b/apps/ui/src/components/layout/sidebar/components/sidebar-navigation.tsx index f303ad44..4a1ab1fc 100644 --- a/apps/ui/src/components/layout/sidebar/components/sidebar-navigation.tsx +++ b/apps/ui/src/components/layout/sidebar/components/sidebar-navigation.tsx @@ -97,13 +97,7 @@ export function SidebarNavigation({ }); return ( -