mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
feat: enhance FileBrowserDialog and PathInput with search functionality
- Added Kbd and KbdGroup components for keyboard shortcuts in FileBrowserDialog. - Implemented search functionality in PathInput, allowing users to search files and directories. - Updated PathInput to handle file system entries and selection from search results. - Improved UI/UX with better focus management and search input handling.
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
} from '@/components/ui/dialog';
|
||||
import { Button } from '@/components/ui/button';
|
||||
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';
|
||||
|
||||
@@ -232,7 +233,7 @@ export function FileBrowserDialog({
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogContent className="bg-popover border-border max-w-3xl max-h-[85vh] overflow-hidden flex flex-col p-4">
|
||||
<DialogContent className="bg-popover border-border max-w-3xl max-h-[85vh] overflow-hidden flex flex-col p-4 focus:outline-none focus-visible:outline-none">
|
||||
<DialogHeader className="pb-1">
|
||||
<DialogTitle className="flex items-center gap-2 text-base">
|
||||
<FolderOpen className="w-4 h-4 text-brand-500" />
|
||||
@@ -252,6 +253,12 @@ export function FileBrowserDialog({
|
||||
error={!!error}
|
||||
onNavigate={handleNavigate}
|
||||
onHome={handleGoHome}
|
||||
entries={directories.map((dir) => ({ ...dir, isDirectory: true }))}
|
||||
onSelectEntry={(entry) => {
|
||||
if (entry.isDirectory) {
|
||||
handleSelectDirectory(entry);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
{/* Recent folders */}
|
||||
@@ -366,12 +373,14 @@ export function FileBrowserDialog({
|
||||
>
|
||||
<FolderOpen className="w-3.5 h-3.5 mr-1.5" />
|
||||
Select Current Folder
|
||||
<kbd className="ml-2 px-1.5 py-0.5 text-[10px] bg-background/50 rounded border border-border">
|
||||
{typeof navigator !== 'undefined' && navigator.platform?.includes('Mac')
|
||||
? '⌘'
|
||||
: 'Ctrl'}
|
||||
+↵
|
||||
</kbd>
|
||||
<KbdGroup className="ml-1">
|
||||
<Kbd>
|
||||
{typeof navigator !== 'undefined' && navigator.platform?.includes('Mac')
|
||||
? '⌘'
|
||||
: 'Ctrl'}
|
||||
</Kbd>
|
||||
<Kbd>↵</Kbd>
|
||||
</KbdGroup>
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
|
||||
Reference in New Issue
Block a user