Skip to content

Commit f01af35

Browse files
committed
Bugfix: transient error dialog was see-through
- `TransferErrorDialog`'s `transient` branch used `--color-warning-bg` (rgba with 0.1/0.15 alpha) as the full dialog background, so the file pane bled through the modal. - New `--color-warning-bg-solid` token (opaque, `color-mix(warning, bg-secondary)`) for full-surface uses; the translucent `--color-warning-bg` keeps its existing inline-banner role. - Debug window: new "Transfer error dialog (modal)" section with one button per category (transient/needs-action/serious) to open the modal directly. Wires a `debug-trigger-transfer-error` event through `+page.svelte` → `DualPaneExplorer.triggerTransferError` → the same `dialogs.handleTransferError` path the live flow uses.
1 parent 13b486a commit f01af35

6 files changed

Lines changed: 64 additions & 1 deletion

File tree

apps/desktop/src/app.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@
7171
--color-error-text: #b91c1c;
7272
--color-warning: #e65100;
7373
--color-warning-bg: rgba(230, 81, 0, 0.1);
74+
/* Opaque sibling for full-surface uses (modal dialogs) where the translucent
75+
`--color-warning-bg` would let the layer beneath bleed through. Matches the
76+
visual of the translucent tint when composited over `--color-bg-secondary`. */
77+
--color-warning-bg-solid: color-mix(in srgb, var(--color-warning) 10%, var(--color-bg-secondary));
7478
/* Same reasoning as `--color-error-text`: the brand `--color-warning` at `#e65100`
7579
clocks ~3.3:1 on the warning tint; this darker variant meets AA. */
7680
--color-warning-text: #9a3412;
@@ -319,6 +323,8 @@
319323
--color-error-text: #fca5a5;
320324
--color-warning: #f5a623;
321325
--color-warning-bg: rgba(245, 166, 35, 0.15);
326+
/* Opaque sibling for full-surface uses; see light-mode comment. */
327+
--color-warning-bg-solid: color-mix(in srgb, var(--color-warning) 15%, var(--color-bg-secondary));
322328
--color-warning-text: #fdba74;
323329

324330
/* Disk usage bar: solid colors, same mixing strategy as light mode */

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2226,6 +2226,16 @@
22262226
}
22272227
}
22282228
2229+
/** Debug only: open the TransferErrorDialog with a synthetic error carrying the given FriendlyError. */
2230+
export function triggerTransferError(friendly: FriendlyError) {
2231+
const error: WriteOperationError = {
2232+
type: 'io_error',
2233+
path: '/debug/preview',
2234+
message: friendly.title,
2235+
}
2236+
dialogs.handleTransferError(error, friendly)
2237+
}
2238+
22292239
/** Refresh network hosts in the focused pane (used by ⌘R shortcut). */
22302240
export function refreshNetworkHosts() {
22312241
const paneRef = getPaneRef(focusedPane)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
category === 'serious'
3737
? 'width: 420px; max-width: 90vw; background: var(--color-error-bg); border-color: var(--color-error-border)'
3838
: category === 'transient'
39-
? 'width: 420px; max-width: 90vw; background: var(--color-warning-bg); border-color: var(--color-border-strong)'
39+
? 'width: 420px; max-width: 90vw; background: var(--color-warning-bg-solid); border-color: var(--color-border-strong)'
4040
: 'width: 420px; max-width: 90vw; background: var(--color-bg-secondary); border-color: var(--color-border-strong)',
4141
)
4242

apps/desktop/src/routes/(main)/+page.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@
294294
const { pane } = event.payload as { pane: 'left' | 'right' | 'both' }
295295
explorerRef?.resetError(pane)
296296
})
297+
await listenTauri('debug-trigger-transfer-error', (event) => {
298+
const { friendly } = event.payload as { friendly: FriendlyError }
299+
explorerRef?.triggerTransferError(friendly)
300+
})
297301
}
298302
}
299303

apps/desktop/src/routes/(main)/explorer-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface ExplorerAPI {
5353
refreshNetworkHosts: () => void
5454
injectError: (pane: 'left' | 'right', friendly: FriendlyError) => void
5555
resetError: (pane: 'left' | 'right' | 'both') => void
56+
triggerTransferError: (friendly: FriendlyError) => void
5657
newTab: () => boolean
5758
closeActiveTab: () => 'closed' | 'last-tab'
5859
closeActiveTabWithConfirmation: () => Promise<'closed' | 'last-tab' | 'cancelled'>

apps/desktop/src/routes/debug/DebugErrorPreviewPanel.svelte

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,29 @@
140140
// Not in Tauri environment
141141
}
142142
}
143+
144+
/** Opens the modal TransferErrorDialog in the main window, using the same FriendlyError shape the live error path produces. */
145+
async function triggerTransferErrorDialog(state: ErrorState) {
146+
try {
147+
const { invoke } = await import('@tauri-apps/api/core')
148+
const friendly = await invoke<FriendlyError>('preview_friendly_error', {
149+
errorCode: state.code ?? null,
150+
variant: state.code === undefined ? state.name : null,
151+
providerPath: null,
152+
})
153+
const { emitTo } = await import('@tauri-apps/api/event')
154+
await emitTo('main', 'debug-trigger-transfer-error', { friendly })
155+
} catch (error) {
156+
// eslint-disable-next-line no-console -- Debug window is dev-only
157+
console.error('triggerTransferErrorDialog failed:', error)
158+
}
159+
}
160+
161+
const dialogPreviewSamples: ErrorState[] = [
162+
{ code: 60, name: 'ETIMEDOUT', category: 'transient', title: 'Connection timed out' },
163+
{ code: 13, name: 'EACCES', category: 'needs_action', title: 'No permission' },
164+
{ code: 5, name: 'EIO', category: 'serious', title: 'Disk read problem' },
165+
]
143166
</script>
144167

145168
<section class="debug-section">
@@ -250,3 +273,22 @@
250273
</div>
251274
</div>
252275
</section>
276+
277+
<section class="debug-section">
278+
<h2>Transfer error dialog (modal)</h2>
279+
<div class="error-preview-panel">
280+
<div class="error-group-header">
281+
Opens the modal TransferErrorDialog. Categories drive the container tint (serious = error, transient =
282+
warning, needs action = neutral).
283+
</div>
284+
{#each dialogPreviewSamples as state (state.name)}
285+
<div class="error-row">
286+
<span class="error-label">
287+
{state.category}
288+
<span class="error-title">{state.title} ({state.name})</span>
289+
</span>
290+
<button class="error-trigger-btn" onclick={() => void triggerTransferErrorDialog(state)}>Open</button>
291+
</div>
292+
{/each}
293+
</div>
294+
</section>

0 commit comments

Comments
 (0)