handle allowMultiple properlu

This commit is contained in:
FTCHD
2026-05-11 11:55:34 +03:00
parent 5cc7cea353
commit 9e0e522352
+28 -10
View File
@@ -86,6 +86,8 @@ export default function PathSelector({
[buttons.BackButton, buttons.RefreshButton],
[
buttons.SearchInput,
...(allowMultiple
? [
<Dropdown
key="select-dropdown"
shadow={platform() === 'windows' ? 'none' : undefined}
@@ -102,9 +104,15 @@ export default function PathSelector({
</Button>
</DropdownTrigger>
<DropdownMenu color="primary">
<DropdownItem key="select-current" onPress={handleSelectCurrentFolder}>
<DropdownItem
key="select-current"
onPress={handleSelectCurrentFolder}
>
Current Folder (
{currentPath.split(RE_PATH_SEPARATOR).pop() || currentRemote || 'root'})
{currentPath.split(RE_PATH_SEPARATOR).pop() ||
currentRemote ||
'root'}
)
</DropdownItem>
<DropdownItem
key="select-files"
@@ -133,19 +141,22 @@ export default function PathSelector({
</DropdownItem>
</DropdownMenu>
</Dropdown>,
]
: []),
<Tooltip
key="dismiss-tooltip"
content="Close this window"
content="Close this window (Esc)"
placement="top"
size="lg"
color="foreground"
>
<Button color="danger" size="sm" radius="full" variant="flat" onPress={onClose}>
<Button color="danger" size="sm" radius="full" onPress={onClose}>
DISMISS
</Button>
</Tooltip>,
],
[
allowMultiple ? (
<Tooltip
key="pick-tooltip"
content={selectedCount === 0 ? 'Tap on the checkbox to select items' : ''}
@@ -162,14 +173,21 @@ export default function PathSelector({
onPress={handleConfirm}
isDisabled={selectedCount === 0}
>
{selectedCount === 0
? '0 SELECTED'
: allowMultiple
? `PICK (${selectedCount})`
: 'PICK'}
{selectedCount === 0 ? '0 SELECTED' : `PICK (${selectedCount})`}
</Button>
</div>
</Tooltip>,
</Tooltip>
) : (
<Button
key="pick-button"
size="sm"
color="primary"
radius="full"
onPress={selectedCount === 0 ? handleSelectCurrentFolder : handleConfirm}
>
{selectedCount === 0 ? 'PICK CURRENT FOLDER' : 'PICK'}
</Button>
),
],
],
[