Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 31 additions & 17 deletions src/pages/home/folder/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { usePath, useRouter, useUtil } from "~/hooks"
import {
checkboxOpen,
getMainColor,
getSettingBool,
local,
OrderBy,
selectIndex,
Expand Down Expand Up @@ -173,24 +174,37 @@ export const ListItem = (props: { obj: StoreObj; index: number }) => {
}
when={showDiskUsage(props.obj.mount_details)}
>
<Progress
w={cols[1].w}
class="disk-usage-percentage"
trackColor="$info3"
rounded="$full"
size="md"
value={usedPercentage(props.obj.mount_details!)}
<Show
fallback={
<Text
class="size"
w={cols[1].w}
textAlign={cols[1].textAlign as any}
>
{toReadableUsage(props.obj.mount_details!)}
</Text>
}
when={!getSettingBool("show_disk_usage_in_plain_text")}
>
<ProgressIndicator
color={
nearlyFull(props.obj.mount_details!) ? "$danger6" : "$info6"
}
rounded="$md"
/>
<ProgressLabel class="disk-usage-text">
{toReadableUsage(props.obj.mount_details!)}
</ProgressLabel>
</Progress>
<Progress
w={cols[1].w}
class="disk-usage-percentage"
trackColor="$info3"
rounded="$full"
size="md"
value={usedPercentage(props.obj.mount_details!)}
>
<ProgressIndicator
color={
nearlyFull(props.obj.mount_details!) ? "$danger6" : "$info6"
}
rounded="$md"
/>
<ProgressLabel class="disk-usage-text">
{toReadableUsage(props.obj.mount_details!)}
</ProgressLabel>
</Progress>
</Show>
</Show>
<Text
class="modified"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/manage/tasks/Task.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const Task = (props: TaskAttribute & TasksProps & TaskLocalSetter) => {
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) {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down