Skip to content

Commit 450363e

Browse files
committed
Transfer dialog: Always show Copy/Move toggle
Previously the segmented Copy/Move toggle only appeared when the dialog was opened via drag-and-drop (`allowOperationToggle: true`). It's now unconditional, so users can flip the operation regardless of how the dialog was triggered (F5/F6, command palette, or drop). Removed the prop from `TransferDialog`, `TransferDialogPropsData`, the `DialogManager` pass-through, and the drag-and-drop call site, and dropped the now-redundant a11y test for the toggle state.
1 parent 474f741 commit 450363e

5 files changed

Lines changed: 21 additions & 56 deletions

File tree

apps/desktop/src/lib/file-explorer/pane/DialogManager.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@
9898
sortOrder={transferDialogProps.sortOrder}
9999
sourceVolumeId={transferDialogProps.sourceVolumeId}
100100
destVolumeId={transferDialogProps.destVolumeId}
101-
allowOperationToggle={transferDialogProps.allowOperationToggle}
102101
autoConfirm={transferDialogProps.autoConfirm}
103102
autoConfirmOnConflict={transferDialogProps.autoConfirmOnConflict}
104103
onConfirm={onTransferConfirm}

apps/desktop/src/lib/file-explorer/pane/DualPaneExplorer.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -776,10 +776,9 @@
776776
const destPath = targetFolderPath ?? getPanePath(targetPane)
777777
const destVolId = getPaneVolumeId(targetPane)
778778
779-
dialogs.showTransfer({
780-
...buildTransferPropsFromDroppedPaths(operation, paths, destPath, targetPane, destVolId, sortBy, sortOrder),
781-
allowOperationToggle: true,
782-
})
779+
dialogs.showTransfer(
780+
buildTransferPropsFromDroppedPaths(operation, paths, destPath, targetPane, destVolId, sortBy, sortOrder),
781+
)
783782
}
784783
785784
/** Extracts the last path component as a display name. */

apps/desktop/src/lib/file-explorer/pane/transfer-operations.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ export interface TransferDialogPropsData {
2626
sortOrder: SortOrder
2727
sourceVolumeId: string
2828
destVolumeId: string
29-
/** When true, shows a copy/move toggle in the transfer dialog (used for drag-and-drop). */
30-
allowOperationToggle?: boolean
3129
/** When true, dialog auto-confirms without user interaction (MCP auto-confirm). */
3230
autoConfirm?: boolean
3331
/** Conflict resolution policy for auto-confirm (MCP). Maps to ConflictResolution. */

apps/desktop/src/lib/file-operations/transfer/TransferDialog.a11y.test.ts

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
* Tier 3 a11y tests for `TransferDialog.svelte`.
33
*
44
* Copy/move destination picker. Volume store, Tauri IPC, and settings
5-
* are stubbed. Tests cover copy, move, and drag-drop (with toggle)
6-
* states. The dialog mounts lots of event-listener boilerplate, so
7-
* events return no-op unsubscribers.
5+
* are stubbed. Tests cover the copy and move initial states; the
6+
* copy/move toggle is always present, so both tests exercise it. The
7+
* dialog mounts lots of event-listener boilerplate, so events return
8+
* no-op unsubscribers.
89
*/
910

1011
import { describe, it, vi } from 'vitest'
@@ -42,7 +43,7 @@ vi.mock('$lib/stores/volume-store.svelte', () => ({
4243
}))
4344

4445
describe('TransferDialog a11y', () => {
45-
it('copy dialog (no toggle) has no a11y violations', async () => {
46+
it('copy dialog has no a11y violations', async () => {
4647
const target = document.createElement('div')
4748
document.body.appendChild(target)
4849
mount(TransferDialog, {
@@ -93,31 +94,4 @@ describe('TransferDialog a11y', () => {
9394
await tick()
9495
await expectNoA11yViolations(target)
9596
})
96-
97-
it('drag-drop with copy/move toggle has no a11y violations', async () => {
98-
const target = document.createElement('div')
99-
document.body.appendChild(target)
100-
mount(TransferDialog, {
101-
target,
102-
props: {
103-
operationType: 'copy',
104-
sourcePaths: ['/Users/test/file.txt'],
105-
destinationPath: '/Users/test/dest',
106-
direction: 'left',
107-
currentVolumeId: 'root',
108-
fileCount: 1,
109-
folderCount: 0,
110-
sourceFolderPath: '/Users/test',
111-
sortColumn: 'name',
112-
sortOrder: 'ascending',
113-
sourceVolumeId: 'root',
114-
destVolumeId: 'root',
115-
allowOperationToggle: true,
116-
onConfirm: () => {},
117-
onCancel: () => {},
118-
},
119-
})
120-
await tick()
121-
await expectNoA11yViolations(target)
122-
})
12397
})

apps/desktop/src/lib/file-operations/transfer/TransferDialog.svelte

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@
5151
sourceVolumeId: string
5252
/** Destination volume ID */
5353
destVolumeId: string
54-
/** When true, shows a copy/move segmented control (for drag-and-drop). */
55-
allowOperationToggle?: boolean
5654
/** When true, dialog auto-confirms without user interaction (MCP). */
5755
autoConfirm?: boolean
5856
/** Conflict resolution policy for auto-confirm (MCP). */
@@ -84,7 +82,6 @@
8482
sourceVolumeId,
8583
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- Part of Props interface, used by parent
8684
destVolumeId,
87-
allowOperationToggle = false,
8885
autoConfirm = false,
8986
autoConfirmOnConflict,
9087
onConfirm,
@@ -402,21 +399,19 @@
402399
>
403400
{#snippet title()}{dialogTitle}{/snippet}
404401

405-
<!-- Copy/Move toggle (shown for drag-and-drop, where the user hasn't chosen yet) -->
406-
{#if allowOperationToggle}
407-
<div class="operation-toggle">
408-
<button
409-
class="toggle-option"
410-
class:active={activeOperationType === 'copy'}
411-
onclick={() => (activeOperationType = 'copy')}>Copy</button
412-
>
413-
<button
414-
class="toggle-option"
415-
class:active={activeOperationType === 'move'}
416-
onclick={() => (activeOperationType = 'move')}>Move</button
417-
>
418-
</div>
419-
{/if}
402+
<!-- Copy/Move toggle -->
403+
<div class="operation-toggle">
404+
<button
405+
class="toggle-option"
406+
class:active={activeOperationType === 'copy'}
407+
onclick={() => (activeOperationType = 'copy')}>Copy</button
408+
>
409+
<button
410+
class="toggle-option"
411+
class:active={activeOperationType === 'move'}
412+
onclick={() => (activeOperationType = 'move')}>Move</button
413+
>
414+
</div>
420415

421416
<!-- Direction indicator -->
422417
<DirectionIndicator sourcePath={sourceFolderPath} {destinationPath} {direction} />

0 commit comments

Comments
 (0)