diff --git a/src/pages/home/folder/ListItem.tsx b/src/pages/home/folder/ListItem.tsx index 5d31296e1..4893a598d 100644 --- a/src/pages/home/folder/ListItem.tsx +++ b/src/pages/home/folder/ListItem.tsx @@ -14,6 +14,7 @@ import { usePath, useRouter, useUtil } from "~/hooks" import { checkboxOpen, getMainColor, + getSettingBool, local, OrderBy, selectIndex, @@ -173,24 +174,37 @@ export const ListItem = (props: { obj: StoreObj; index: number }) => { } when={showDiskUsage(props.obj.mount_details)} > - + {toReadableUsage(props.obj.mount_details!)} + + } + when={!getSettingBool("show_disk_usage_in_plain_text")} > - - - {toReadableUsage(props.obj.mount_details!)} - - + + + + {toReadableUsage(props.obj.mount_details!)} + + + { let speedText = "-" const parseSpeedText = (timeDelta: number, lengthDelta: number) => { let delta = lengthDelta / timeDelta - const units = ["B/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s"] + const units = ["B/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s", "PiB/s", "EiB/s"] const k = 1024 let unit_i = 0 while (unit_i < units.length - 1 && delta >= k) { diff --git a/src/utils/storage.ts b/src/utils/storage.ts index 1c690c90f..e80400c6d 100644 --- a/src/utils/storage.ts +++ b/src/utils/storage.ts @@ -13,7 +13,7 @@ export const showDiskUsage = (details: MountDetails | undefined) => { export const toReadableUsage = (details: MountDetails) => { let total = details.total_space! let used = total - details.free_space! - const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"] + const units = ["B", "K", "M", "G", "T", "P", "E"] const k = 1024 let unit_i = 0 while (unit_i < units.length - 1 && (used >= k || total >= k)) {