Skip to content

Commit cfae0db

Browse files
committed
Refactor: Extract dialog state from DualPaneExplorer
- Move 10 dialog $state vars + handlers into dialog-state.svelte.ts factory - DualPaneExplorer drops from 2,289 to 2,124 lines - Same createXxx factory pattern as rename-flow.svelte.ts - DialogManager now imports shared type interfaces instead of inlining them
1 parent 9b6d057 commit cfae0db

5 files changed

Lines changed: 375 additions & 265 deletions

File tree

apps/desktop/coverage-allowlist.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@
177177
},
178178
"file-explorer/navigation/VolumeBreadcrumb.svelte": {
179179
"reason": "UI component, depends on Tauri APIs and MTP store"
180+
},
181+
"file-explorer/pane/dialog-state.svelte.ts": {
182+
"reason": "Reactive Svelte state, depends on FilePane refs and Tauri commands"
180183
}
181184
}
182185
}

apps/desktop/src/lib/file-explorer/CLAUDE.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ Core explorer UI components:
118118
- **selection-state.svelte.ts** — Reactive selection set (indices) with range/toggle helpers
119119
- **sorting-handlers.ts** / **transfer-operations.ts** / **tab-operations.ts** — Pure logic extracted from
120120
DualPaneExplorer
121+
- **dialog-state.svelte.ts** — Dialog state and handlers (transfer, new folder, alert, error) extracted from
122+
DualPaneExplorer via factory pattern
121123
- **rename-flow.svelte.ts** — Rename flow logic (validation, conflict/extension dialogs) extracted from FilePane
122124

123125
## Tabs (`tabs/`)

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

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66
import AlertDialog from '$lib/ui/AlertDialog.svelte'
77
import type { TransferDialogPropsData } from './transfer-operations'
88
import type {
9-
TransferOperationType,
10-
SortColumn,
11-
SortOrder,
12-
VolumeInfo,
13-
ConflictResolution,
14-
WriteOperationError,
15-
} from '../types'
9+
TransferProgressPropsData,
10+
NewFolderDialogPropsData,
11+
AlertDialogPropsData,
12+
TransferErrorPropsData,
13+
} from './dialog-state.svelte'
14+
import type { VolumeInfo, ConflictResolution, TransferOperationType, WriteOperationError } from '../types'
1615
1716
const {
1817
showTransferDialog,
@@ -40,31 +39,13 @@
4039
transferDialogProps: TransferDialogPropsData | null
4140
volumes: VolumeInfo[]
4241
showTransferProgressDialog: boolean
43-
transferProgressProps: {
44-
operationType: TransferOperationType
45-
sourcePaths: string[]
46-
sourceFolderPath: string
47-
destinationPath: string
48-
direction: 'left' | 'right'
49-
sortColumn: SortColumn
50-
sortOrder: SortOrder
51-
previewId: string | null
52-
sourceVolumeId: string
53-
destVolumeId: string
54-
conflictResolution: ConflictResolution
55-
} | null
42+
transferProgressProps: TransferProgressPropsData | null
5643
showNewFolderDialog: boolean
57-
newFolderDialogProps: {
58-
currentPath: string
59-
listingId: string
60-
showHiddenFiles: boolean
61-
initialName: string
62-
volumeId: string
63-
} | null
44+
newFolderDialogProps: NewFolderDialogPropsData | null
6445
showAlertDialog: boolean
65-
alertDialogProps: { title: string; message: string } | null
46+
alertDialogProps: AlertDialogPropsData | null
6647
showTransferErrorDialog: boolean
67-
transferErrorProps: { operationType: TransferOperationType; error: WriteOperationError } | null
48+
transferErrorProps: TransferErrorPropsData | null
6849
onTransferConfirm: (
6950
destination: string,
7051
volumeId: string,

0 commit comments

Comments
 (0)