@samitouri / QOSami-HFS / commits / de12e664

detailed file size in file-menu

Massimo Melina committed Jul 1, 2023 at 14:14 UTC de12e6643dfa36083af475da6a6ca23e8a53e266
1 file changed +3 -2
frontend/src/fileMenu.ts
+3 -2
@@ -18,7 +18,7 @@ interface FileMenuEntry {
18 }
19
20 export function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (FileMenuEntry | 'open' | 'delete' | 'show')[]) {
21 - const { uri, isFolder } = entry
21 + const { uri, isFolder, s } = entry
22 const fullUri = uri[0] === '/' ? uri : location.pathname + uri
23 const cantDownload = entry.cantOpen || isFolder && entry.p?.includes('r') // folders needs both list and read
24 const menu = [
@@ -48,7 +48,8 @@ export function openFileMenu(entry: DirEntry, ev: MouseEvent, addToMenu: (FileMe
48 ]
49 const props = [
50 [t`Name`, entry.name],
51 - typeof entry.s === 'number' && [t`Size`, formatBytes(entry.s)],
51 + typeof s === 'number' && [t`Size`, h(Fragment, {},
52 + formatBytes(s), h('small', {}, prefix(' (', s > 1024 && s.toLocaleString(), ')')) ) ],
53 entry.t && [t`Timestamp`, entry.t.toLocaleString()],
54 ]
55 const res = hfsEvent('fileMenu', { entry, menu, props })