Skip to content

Commit 3decce0

Browse files
authored
fix(disk-usage): revert disk icons (#219)
1 parent 14f614e commit 3decce0

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

src/pages/manage/tasks/Task.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ export const Task = (props: TaskAttribute & TasksProps & TaskLocalSetter) => {
143143
let speedText = "-"
144144
const parseSpeedText = (timeDelta: number, lengthDelta: number) => {
145145
let delta = lengthDelta / timeDelta
146-
const units = ["B/s", "KB/s", "MB/s", "GB/s", "TB/s"]
147-
const k = 1000
146+
const units = ["B/s", "KiB/s", "MiB/s", "GiB/s", "TiB/s"]
147+
const k = 1024
148148
let unit_i = 0
149149
while (unit_i < units.length - 1 && delta >= k) {
150150
delta /= k

src/utils/icon.ts

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import {
1212
BsWindows,
1313
BsFileEarmarkZipFill,
1414
BsMarkdownFill,
15-
BsDeviceHddFill,
1615
} from "solid-icons/bs"
1716
import {
1817
FaSolidDatabase,
@@ -21,7 +20,7 @@ import {
2120
FaSolidLink,
2221
} from "solid-icons/fa"
2322
import { IoFolder } from "solid-icons/io"
24-
import { ImAndroid, ImGoogleDrive, ImOnedrive } from "solid-icons/im"
23+
import { ImAndroid } from "solid-icons/im"
2524
import { Obj, ObjType } from "~/types"
2625
import { ext } from "./path"
2726
import {
@@ -30,8 +29,6 @@ import {
3029
} from "~/components"
3130
import { SiAsciinema } from "solid-icons/si"
3231
import { isArchive } from "~/store/archive"
33-
import { AiFillGithub } from "solid-icons/ai"
34-
import { RiLogosNeteaseCloudMusicFill } from "solid-icons/ri"
3532

3633
const iconMap = {
3734
"dmg,ipa,plist,tipa": BsApple,
@@ -92,31 +89,6 @@ export const getIconByTypeAndName = (type: number, name: string) => {
9289
}
9390
}
9491

95-
export const getIconByDriver = (driverName: string) => {
96-
switch (driverName) {
97-
case "Local":
98-
return BsDeviceHddFill
99-
case "GitHub API":
100-
case "GitHub Releases":
101-
return AiFillGithub
102-
case "GoogleDrive":
103-
return ImGoogleDrive
104-
case "NeteaseMusic":
105-
return RiLogosNeteaseCloudMusicFill
106-
case "Onedrive":
107-
case "OnedriveApp":
108-
case "Onedrive Sharelink":
109-
return ImOnedrive
110-
default:
111-
return IoFolder
112-
}
113-
}
114-
115-
export const getIconByObj = (
116-
obj: Pick<Obj, "type" | "name" | "mount_details">,
117-
) => {
118-
if (obj.mount_details) {
119-
return getIconByDriver(obj.mount_details.driver_name)
120-
}
92+
export const getIconByObj = (obj: Pick<Obj, "type" | "name">) => {
12193
return getIconByTypeAndName(obj.type, obj.name)
12294
}

src/utils/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export const showDiskUsage = (details: MountDetails | undefined) => {
1313
export const toReadableUsage = (details: MountDetails) => {
1414
let total = details.total_space!
1515
let used = total - details.free_space!
16-
const units = ["B", "KB", "MB", "GB", "TB", "PB"]
17-
const k = 1000
16+
const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"]
17+
const k = 1024
1818
let unit_i = 0
1919
while (unit_i < units.length - 1 && (used >= k || total >= k)) {
2020
used /= k

0 commit comments

Comments
 (0)