upload: clickable destination element

Massimo Melina committed Feb 1, 2023 at 19:20 UTC fb78d399f4a8b43436c49f7722aebc4a2a027105
3 files changed +8 -6
frontend/src/App.ts
+2 -2
@@ -16,9 +16,9 @@ function App() {
16 h(BrowserRouter, {},
17 h(Routes, {},
18 h(Route, { path:'*', element: h(BrowseFiles) })
19 - )
19 + ),
20 + h(Dialogs),
21 ),
21 - h(Dialogs)
22 )
23 }
24
frontend/src/upload.ts
+4 -3
@@ -9,6 +9,7 @@ import { alertDialog, confirmDialog } from './dialog'
9 import { reloadList } from './useFetchList'
10 import { getNotification } from './api'
11 import { useSnapState } from './state'
12 +import { Link } from 'react-router-dom'
13
14 export const uploadState = proxy<{
15 done: number
@@ -61,7 +62,7 @@ export function showUpload() {
62 done: 0,
63 doneByte: 0,
64 })
64 - newDialog({
65 + const close = newDialog({
66 dialogProps: { style: { minWidth: 'min(20em, 100vw - 1em)' } },
67 title: "Upload",
68 icon: () => hIcon('upload'),
@@ -97,7 +98,7 @@ export function showUpload() {
98 setFiles(files.filter(x => x !== f))
99 }
100 }),
100 - h('div', {}, [done && `${done} finished (${formatBytes(doneByte)})`, errors && `${errors} failed`].filter(Boolean).join(' – ')),
101 + [done && `${done} finished (${formatBytes(doneByte)})`, errors && `${errors} failed`].filter(Boolean).join(' – '),
102 qs.length > 0 && h('div', {},
103 h(Flex, { alignItems: 'center', justifyContent: 'center', borderTop: '1px dashed', padding: '.5em' },
104 `${_.sumBy(qs, q => q.files.length)} in queue${prefix(', ', etaStr)}`,
@@ -111,7 +112,7 @@ export function showUpload() {
112 ),
113 qs.map((q,idx) =>
114 h('div', { key: q.to },
114 - h('div', {}, "Destination ", decodeURI(q.to)),
115 + h(Link, { to: q.to, onClick: close }, "Destination ", decodeURI(q.to)),
116 h(FilesList, {
117 files: Array.from(q.files),
118 remove(f) {
todo.md
+2 -1
@@ -1,5 +1,6 @@
1 # To do
2 -- admin/fs: check if source exist when set
2 +- config: favicon https://github.com/rejetto/hfs/discussions/94
3 +- admin/fs: check if source exists when set
4 - plugins: after installing, switch to installed (and perhaps highlight new one)
5 - plugins' log, accessible in admin
6 - fix: cannot switch off https and switch on http at the same time