message on empty folder
Massimo Melina committed
Dec 15, 2021 at 20:16 UTC
01ab8dd605ee1ea356f1d342aacf5fe30c071ea2
2 files changed
+5
-4
frontend/src/BrowseFiles.ts
+4
-3
@@ -21,9 +21,10 @@ interface DirEntry { n:string, s?:number, m?:string, c?:string }
21
export type DirList = DirEntry[]
22
23
function FilesList({ list }:{ list:DirList }) {
24
- return h('ul', { className:'dir' },
25
- list.map((entry:DirEntry) =>
26
- h(File, { key: entry.n, ...entry }) ))
24
+ return h('ul', { className: 'dir' },
25
+ !list.length ? 'Nothing here'
26
+ : list.map((entry: DirEntry) =>
27
+ h(File, { key: entry.n, ...entry })))
28
}
29
30
function File({ n, m, c, s }: DirEntry) {
frontend/src/Head.ts
+1
-1
@@ -31,7 +31,7 @@ function FolderStats({ list }:{ list:DirList }) {
31
[
32
prefix('', stats.files,' file(s)'),
33
prefix('', stats.folders, ' folder(s)'),
34
- formatBytes(stats.size),
34
+ stats.size ? formatBytes(stats.size) : '',
35
].filter(Boolean).join(', ')
36
)
37
}