diff --git a/apps/ui/src/components/layout/sidebar/components/automaker-logo.tsx b/apps/ui/src/components/layout/sidebar/components/automaker-logo.tsx index 5f498449..2a7363f2 100644 --- a/apps/ui/src/components/layout/sidebar/components/automaker-logo.tsx +++ b/apps/ui/src/components/layout/sidebar/components/automaker-logo.tsx @@ -1,13 +1,30 @@ import type { NavigateOptions } from '@tanstack/react-router'; import { cn } from '@/lib/utils'; +import { useOSDetection } from '@/hooks/use-os-detection'; interface AutomakerLogoProps { sidebarOpen: boolean; navigate: (opts: NavigateOptions) => void; } +function getOSAbbreviation(os: string): string { + switch (os) { + case 'mac': + return 'M'; + case 'windows': + return 'W'; + case 'linux': + return 'L'; + default: + return '?'; + } +} + export function AutomakerLogo({ sidebarOpen, navigate }: AutomakerLogoProps) { const appVersion = typeof __APP_VERSION__ !== 'undefined' ? __APP_VERSION__ : '0.0.0'; + const { os } = useOSDetection(); + const appMode = import.meta.env.VITE_APP_MODE || '?'; + const versionSuffix = `${getOSAbbreviation(os)}${appMode}`; return (
- v{appVersion} + v{appVersion} {versionSuffix}
@@ -125,7 +142,7 @@ export function AutomakerLogo({ sidebarOpen, navigate }: AutomakerLogoProps) { - v{appVersion} + v{appVersion} {versionSuffix} )} diff --git a/apps/ui/src/hooks/use-os-detection.ts b/apps/ui/src/hooks/use-os-detection.ts index a7bcf68b..7f0282a7 100644 --- a/apps/ui/src/hooks/use-os-detection.ts +++ b/apps/ui/src/hooks/use-os-detection.ts @@ -10,11 +10,12 @@ export interface OSDetectionResult { } function detectOS(): OperatingSystem { - // Check Electron's process.platform first (most reliable in Electron apps) - if (typeof process !== 'undefined' && process.platform) { - if (process.platform === 'darwin') return 'mac'; - if (process.platform === 'win32') return 'windows'; - if (process.platform === 'linux') return 'linux'; + // Check Electron's exposed platform first (via preload contextBridge) + if (typeof window !== 'undefined' && window.electronAPI?.platform) { + const platform = window.electronAPI.platform; + if (platform === 'darwin') return 'mac'; + if (platform === 'win32') return 'windows'; + if (platform === 'linux') return 'linux'; } if (typeof navigator === 'undefined') { diff --git a/apps/ui/src/types/electron.d.ts b/apps/ui/src/types/electron.d.ts index 6388e7a5..fc64f375 100644 --- a/apps/ui/src/types/electron.d.ts +++ b/apps/ui/src/types/electron.d.ts @@ -466,6 +466,10 @@ export interface AutoModeAPI { } export interface ElectronAPI { + // Platform info (exposed from preload) + platform?: 'darwin' | 'win32' | 'linux'; + isElectron?: boolean; + ping: () => Promise; getApiKey?: () => Promise; quit?: () => Promise; diff --git a/apps/ui/src/vite-env.d.ts b/apps/ui/src/vite-env.d.ts index 04745bb1..2ed837a0 100644 --- a/apps/ui/src/vite-env.d.ts +++ b/apps/ui/src/vite-env.d.ts @@ -2,7 +2,7 @@ interface ImportMetaEnv { readonly VITE_SERVER_URL?: string; - // Add other VITE_ prefixed env vars here as needed + readonly VITE_APP_MODE?: '1' | '2' | '3' | '4'; } // Extend ImportMeta to include env property diff --git a/dev.mjs b/dev.mjs index 289090c6..6d137d23 100644 --- a/dev.mjs +++ b/dev.mjs @@ -133,6 +133,7 @@ async function main() { env: { TEST_PORT: String(webPort), VITE_SERVER_URL: `http://localhost:${serverPort}`, + VITE_APP_MODE: '1', }, }, __dirname @@ -159,6 +160,7 @@ async function main() { PORT: String(serverPort), VITE_SERVER_URL: `http://localhost:${serverPort}`, CORS_ORIGIN: corsOriginEnv, + VITE_APP_MODE: '2', }, }, __dirname diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index c3098e8b..28ef08da 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -103,6 +103,7 @@ services: - VITE_SERVER_URL=http://localhost:3008 - TEST_PORT=3007 - VITE_SKIP_ELECTRON=true + - VITE_APP_MODE=3 volumes: # Mount source code for live reload - .:/app:cached diff --git a/scripts/launcher-utils.mjs b/scripts/launcher-utils.mjs index 69aa036f..1dcdab7f 100644 --- a/scripts/launcher-utils.mjs +++ b/scripts/launcher-utils.mjs @@ -986,6 +986,7 @@ export async function launchDockerDevServerContainer({ baseDir, processes }) { SKIP_EMBEDDED_SERVER: 'true', PORT: '3008', VITE_SERVER_URL: 'http://localhost:3008', + VITE_APP_MODE: '4', }, });