Skip to content

Commit 04dc3de

Browse files
committed
Refactor: split up DualPaneExplorer.svelte
A bit nicer now.
1 parent 1061fad commit 04dc3de

9 files changed

Lines changed: 1062 additions & 901 deletions

apps/desktop/coverage-allowlist.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"benchmark.ts": { "reason": "Dev tooling, not critical path" },
88
"drag-drop.ts": { "reason": "Needs integration testing with Tauri" },
99
"file-explorer/BriefList.svelte": { "reason": "Logic tested in brief-list-utils.ts, component mounting heavy" },
10+
"file-explorer/DialogManager.svelte": { "reason": "Pure rendering component, dialog state tested via parent" },
1011
"file-explorer/DualPaneExplorer.svelte": { "reason": "Tested in integration.test.ts, complex component" },
12+
"file-explorer/new-folder-operations.ts": { "reason": "Depends on FilePane refs and Tauri listen API" },
13+
"file-explorer/sorting-handlers.ts": { "reason": "getNewSortOrder tested, rest depends on FilePane refs" },
1114
"file-explorer/FileIcon.svelte": { "reason": "Simple UI component, display only" },
1215
"file-explorer/FilePane.svelte": { "reason": "Tested in integration.test.ts, complex component" },
1316
"file-explorer/FullList.svelte": { "reason": "Logic tested in full-list-utils.ts, component mounting heavy" },
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<script lang="ts">
2+
import CopyDialog from '../write-operations/CopyDialog.svelte'
3+
import CopyProgressDialog from '../write-operations/CopyProgressDialog.svelte'
4+
import CopyErrorDialog from '../write-operations/CopyErrorDialog.svelte'
5+
import NewFolderDialog from './NewFolderDialog.svelte'
6+
import AlertDialog from '$lib/AlertDialog.svelte'
7+
import type { CopyDialogPropsData } from './copy-operations'
8+
import type { SortColumn, SortOrder, VolumeInfo, ConflictResolution, WriteOperationError } from './types'
9+
10+
const {
11+
showCopyDialog,
12+
copyDialogProps,
13+
volumes,
14+
showCopyProgressDialog,
15+
copyProgressProps,
16+
showNewFolderDialog,
17+
newFolderDialogProps,
18+
showAlertDialog,
19+
alertDialogProps,
20+
showCopyErrorDialog,
21+
copyErrorProps,
22+
onCopyConfirm,
23+
onCopyCancel,
24+
onCopyComplete,
25+
onCopyCancelled,
26+
onCopyError,
27+
onCopyErrorClose,
28+
onNewFolderCreated,
29+
onNewFolderCancel,
30+
onAlertClose,
31+
}: {
32+
showCopyDialog: boolean
33+
copyDialogProps: CopyDialogPropsData | null
34+
volumes: VolumeInfo[]
35+
showCopyProgressDialog: boolean
36+
copyProgressProps: {
37+
sourcePaths: string[]
38+
sourceFolderPath: string
39+
destinationPath: string
40+
direction: 'left' | 'right'
41+
sortColumn: SortColumn
42+
sortOrder: SortOrder
43+
previewId: string | null
44+
sourceVolumeId: string
45+
destVolumeId: string
46+
conflictResolution: ConflictResolution
47+
} | null
48+
showNewFolderDialog: boolean
49+
newFolderDialogProps: {
50+
currentPath: string
51+
listingId: string
52+
showHiddenFiles: boolean
53+
initialName: string
54+
volumeId: string
55+
} | null
56+
showAlertDialog: boolean
57+
alertDialogProps: { title: string; message: string } | null
58+
showCopyErrorDialog: boolean
59+
copyErrorProps: { error: WriteOperationError } | null
60+
onCopyConfirm: (
61+
destination: string,
62+
volumeId: string,
63+
previewId: string | null,
64+
conflictResolution: ConflictResolution,
65+
) => void
66+
onCopyCancel: () => void
67+
onCopyComplete: (filesProcessed: number, bytesProcessed: number) => void
68+
onCopyCancelled: (filesProcessed: number) => void
69+
onCopyError: (error: WriteOperationError) => void
70+
onCopyErrorClose: () => void
71+
onNewFolderCreated: (folderName: string) => void
72+
onNewFolderCancel: () => void
73+
onAlertClose: () => void
74+
} = $props()
75+
</script>
76+
77+
{#if showCopyDialog && copyDialogProps}
78+
<CopyDialog
79+
sourcePaths={copyDialogProps.sourcePaths}
80+
destinationPath={copyDialogProps.destinationPath}
81+
direction={copyDialogProps.direction}
82+
{volumes}
83+
currentVolumeId={copyDialogProps.currentVolumeId}
84+
fileCount={copyDialogProps.fileCount}
85+
folderCount={copyDialogProps.folderCount}
86+
sourceFolderPath={copyDialogProps.sourceFolderPath}
87+
sortColumn={copyDialogProps.sortColumn}
88+
sortOrder={copyDialogProps.sortOrder}
89+
sourceVolumeId={copyDialogProps.sourceVolumeId}
90+
destVolumeId={copyDialogProps.destVolumeId}
91+
onConfirm={onCopyConfirm}
92+
onCancel={onCopyCancel}
93+
/>
94+
{/if}
95+
96+
{#if showCopyProgressDialog && copyProgressProps}
97+
<CopyProgressDialog
98+
sourcePaths={copyProgressProps.sourcePaths}
99+
sourceFolderPath={copyProgressProps.sourceFolderPath}
100+
destinationPath={copyProgressProps.destinationPath}
101+
direction={copyProgressProps.direction}
102+
sortColumn={copyProgressProps.sortColumn}
103+
sortOrder={copyProgressProps.sortOrder}
104+
previewId={copyProgressProps.previewId}
105+
sourceVolumeId={copyProgressProps.sourceVolumeId}
106+
destVolumeId={copyProgressProps.destVolumeId}
107+
conflictResolution={copyProgressProps.conflictResolution}
108+
onComplete={onCopyComplete}
109+
onCancelled={onCopyCancelled}
110+
onError={onCopyError}
111+
/>
112+
{/if}
113+
114+
{#if showNewFolderDialog && newFolderDialogProps}
115+
<NewFolderDialog
116+
currentPath={newFolderDialogProps.currentPath}
117+
listingId={newFolderDialogProps.listingId}
118+
showHiddenFiles={newFolderDialogProps.showHiddenFiles}
119+
initialName={newFolderDialogProps.initialName}
120+
volumeId={newFolderDialogProps.volumeId}
121+
onCreated={onNewFolderCreated}
122+
onCancel={onNewFolderCancel}
123+
/>
124+
{/if}
125+
126+
{#if showAlertDialog && alertDialogProps}
127+
<AlertDialog title={alertDialogProps.title} message={alertDialogProps.message} onClose={onAlertClose} />
128+
{/if}
129+
130+
{#if showCopyErrorDialog && copyErrorProps}
131+
<CopyErrorDialog error={copyErrorProps.error} onClose={onCopyErrorClose} />
132+
{/if}

0 commit comments

Comments
 (0)