fix(ui): allow entering already-added directories in the add-project picker
This commit is contained in:
@@ -359,7 +359,7 @@ export const DirectoryExplorerDialog: React.FC<DirectoryExplorerDialogProps> = (
|
|||||||
const canSubmitClone = canAddProject && cloneRemoteUrl.trim().length > 0;
|
const canSubmitClone = canAddProject && cloneRemoteUrl.trim().length > 0;
|
||||||
const highlightedRow = rows[highlightedIndex] ?? null;
|
const highlightedRow = rows[highlightedIndex] ?? null;
|
||||||
const hasHighlightedBrowseItem = Boolean(
|
const hasHighlightedBrowseItem = Boolean(
|
||||||
highlightedRow && (highlightedRow.type === 'up' || (highlightedRow.type === 'directory' && !highlightedRow.disabled))
|
highlightedRow && (highlightedRow.type === 'up' || highlightedRow.type === 'directory')
|
||||||
);
|
);
|
||||||
const submitModifierLabel = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform)
|
const submitModifierLabel = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform)
|
||||||
? '⌘'
|
? '⌘'
|
||||||
@@ -486,7 +486,6 @@ export const DirectoryExplorerDialog: React.FC<DirectoryExplorerDialogProps> = (
|
|||||||
if (row.path) browseToDisplayPath(row.path);
|
if (row.path) browseToDisplayPath(row.path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (row.disabled) return;
|
|
||||||
browseToEntry(row);
|
browseToEntry(row);
|
||||||
}, [browseToDisplayPath, browseToEntry]);
|
}, [browseToDisplayPath, browseToEntry]);
|
||||||
|
|
||||||
@@ -665,7 +664,6 @@ export const DirectoryExplorerDialog: React.FC<DirectoryExplorerDialogProps> = (
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
disabled={row.type === 'directory' && row.disabled}
|
|
||||||
onMouseEnter={() => setHighlightedIndex(index)}
|
onMouseEnter={() => setHighlightedIndex(index)}
|
||||||
onMouseDown={(event) => event.preventDefault()}
|
onMouseDown={(event) => event.preventDefault()}
|
||||||
onClick={() => executeRow(row)}
|
onClick={() => executeRow(row)}
|
||||||
@@ -673,7 +671,7 @@ export const DirectoryExplorerDialog: React.FC<DirectoryExplorerDialogProps> = (
|
|||||||
'flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50',
|
'flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50',
|
||||||
isActive && 'bg-interactive-selection text-interactive-selection-foreground',
|
isActive && 'bg-interactive-selection text-interactive-selection-foreground',
|
||||||
!isActive && 'hover:bg-interactive-hover/50',
|
!isActive && 'hover:bg-interactive-hover/50',
|
||||||
row.type === 'directory' && row.disabled && 'cursor-not-allowed opacity-45 hover:bg-transparent'
|
row.type === 'directory' && row.disabled && 'opacity-45'
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{row.type === 'up' ? (
|
{row.type === 'up' ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user