successful upload will show toast instead of dialog
Massimo Melina committed
Feb 28, 2024 at 23:51 UTC
d95da3c1fe381ae8a455952247bec2f070930863
1 file changed
+4
-8
frontend/src/upload.ts
+4
-8
@@ -6,7 +6,7 @@ import { basename, closeDialog, formatBytes, formatPerc, hIcon, isMobile, newDia
6
HTTP_CONFLICT, HTTP_PAYLOAD_TOO_LARGE, formatSpeed, dirname, getHFS, onlyTruthy, with_ } from './misc'
7
import _ from 'lodash'
8
import { proxy, ref, subscribe, useSnapshot } from 'valtio'
9
-import { alertDialog, confirmDialog, promptDialog } from './dialog'
9
+import { alertDialog, confirmDialog, promptDialog, toast } from './dialog'
10
import { reloadList } from './useFetchList'
11
import { apiCall, getNotification } from '@hfs/shared/api'
12
import { state, useSnapState } from './state'
@@ -399,14 +399,10 @@ async function startUpload(toUpload: ToUpload, to: string, resume=0) {
399
if (qs.length) return
400
setTimeout(reloadList, 500) // workaround: reloading too quickly can meet the new file still with its temp name
401
reloadOnClose = false
402
+ const msg = h('div', {}, t(['upload_concluded', "Upload terminated"], "Upload concluded:"), h(UploadStatus) )
403
if (!uploadDialogIsOpen)
403
- alertDialog(
404
- h('div', {},
405
- t(['upload_concluded', "Upload terminated"], "Upload concluded:"),
406
- h(UploadStatus)
407
- ),
408
- 'info'
409
- ).finally(resetCounters)
404
+ (uploadState.errors || uploadState.skipped ? alertDialog(msg, 'info') : toast(msg, 'success').closed)
405
+ .finally(resetCounters)
406
}
407
}
408