mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
add more robust util fn
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
import type { NavigateOptions } from '@tanstack/react-router';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { cn, isMac } from '@/lib/utils';
|
||||
import { AutomakerLogo } from './automaker-logo';
|
||||
import { BugReportButton } from './bug-report-button';
|
||||
|
||||
// Detect if running on macOS for traffic light button spacing
|
||||
const isMac = typeof navigator !== 'undefined' && /Mac/.test(navigator.userAgent);
|
||||
|
||||
interface SidebarHeaderProps {
|
||||
sidebarOpen: boolean;
|
||||
navigate: (opts: NavigateOptions) => void;
|
||||
|
||||
@@ -52,3 +52,13 @@ export function pathsEqual(p1: string | undefined | null, p2: string | undefined
|
||||
if (!p1 || !p2) return p1 === p2;
|
||||
return normalizePath(p1) === normalizePath(p2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if running on macOS.
|
||||
* Checks Electron process.platform first, then falls back to navigator APIs.
|
||||
*/
|
||||
export const isMac =
|
||||
typeof process !== 'undefined' && process.platform === 'darwin'
|
||||
? true
|
||||
: typeof navigator !== 'undefined' &&
|
||||
(/Mac/.test(navigator.userAgent) || navigator.platform?.toLowerCase().includes('mac'));
|
||||
|
||||
Reference in New Issue
Block a user