mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
feat: add OS detection hook and integrate into FileBrowserDialog for improved keyboard shortcut handling
- Introduced useOSDetection hook to determine the user's operating system. - Updated FileBrowserDialog to utilize the OS detection for displaying the correct keyboard shortcut (⌘ or Ctrl) based on the detected OS.
This commit is contained in:
@@ -13,6 +13,7 @@ import { PathInput } from '@/components/ui/path-input';
|
||||
import { Kbd, KbdGroup } from '@/components/ui/kbd';
|
||||
import { getJSON, setJSON } from '@/lib/storage';
|
||||
import { getDefaultWorkspaceDirectory, saveLastProjectDirectory } from '@/lib/workspace-config';
|
||||
import { useOSDetection } from '@/hooks';
|
||||
|
||||
interface DirectoryEntry {
|
||||
name: string;
|
||||
@@ -68,6 +69,7 @@ export function FileBrowserDialog({
|
||||
description = 'Navigate to your project folder or paste a path directly',
|
||||
initialPath,
|
||||
}: FileBrowserDialogProps) {
|
||||
const { isMac } = useOSDetection();
|
||||
const [currentPath, setCurrentPath] = useState<string>('');
|
||||
const [parentPath, setParentPath] = useState<string | null>(null);
|
||||
const [directories, setDirectories] = useState<DirectoryEntry[]>([]);
|
||||
@@ -374,11 +376,7 @@ export function FileBrowserDialog({
|
||||
<FolderOpen className="w-3.5 h-3.5 mr-1.5" />
|
||||
Select Current Folder
|
||||
<KbdGroup className="ml-1">
|
||||
<Kbd>
|
||||
{typeof navigator !== 'undefined' && navigator.platform?.includes('Mac')
|
||||
? '⌘'
|
||||
: 'Ctrl'}
|
||||
</Kbd>
|
||||
<Kbd>{isMac ? '⌘' : 'Ctrl'}</Kbd>
|
||||
<Kbd>↵</Kbd>
|
||||
</KbdGroup>
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user