From 7fb0d0f2ca51bba971644481abe9ad7c25aacd76 Mon Sep 17 00:00:00 2001 From: Shirone Date: Sat, 31 Jan 2026 12:54:36 +0100 Subject: [PATCH] refactor(ui): Integrate macOS Electron padding logic into ProjectSwitcher Updated the ProjectSwitcher component to conditionally apply top padding based on the operating system and Electron environment. This change utilizes the newly created MACOS_ELECTRON_TOP_PADDING_CLASS for improved maintainability and consistency across the UI. --- .../layout/project-switcher/project-switcher.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/ui/src/components/layout/project-switcher/project-switcher.tsx b/apps/ui/src/components/layout/project-switcher/project-switcher.tsx index 541fa83c..a8aa521f 100644 --- a/apps/ui/src/components/layout/project-switcher/project-switcher.tsx +++ b/apps/ui/src/components/layout/project-switcher/project-switcher.tsx @@ -1,7 +1,7 @@ import { useState, useCallback, useEffect } from 'react'; import { Plus, Bug, FolderOpen, BookOpen } from 'lucide-react'; import { useNavigate, useLocation } from '@tanstack/react-router'; -import { cn } from '@/lib/utils'; +import { cn, isMac } from '@/lib/utils'; import { useAppStore } from '@/store/app-store'; import { useOSDetection } from '@/hooks/use-os-detection'; import { ProjectSwitcherItem } from './components/project-switcher-item'; @@ -11,9 +11,12 @@ import { NotificationBell } from './components/notification-bell'; import { NewProjectModal } from '@/components/dialogs/new-project-modal'; import { OnboardingDialog } from '@/components/layout/sidebar/dialogs'; import { useProjectCreation } from '@/components/layout/sidebar/hooks'; -import { SIDEBAR_FEATURE_FLAGS } from '@/components/layout/sidebar/constants'; +import { + MACOS_ELECTRON_TOP_PADDING_CLASS, + SIDEBAR_FEATURE_FLAGS, +} from '@/components/layout/sidebar/constants'; import type { Project } from '@/lib/electron'; -import { getElectronAPI } from '@/lib/electron'; +import { getElectronAPI, isElectron } from '@/lib/electron'; import { initializeProject, hasAppSpec, hasAutomakerDir } from '@/lib/project-init'; import { toast } from 'sonner'; import { CreateSpecDialog } from '@/components/views/spec-view/dialogs'; @@ -279,7 +282,12 @@ export function ProjectSwitcher() { data-testid="project-switcher" > {/* Automaker Logo and Version */} -
+