mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
refactor: remove pretty bytes
This commit is contained in:
parent
f1bdec484e
commit
28d1aec413
8 changed files with 700 additions and 448 deletions
|
@ -1,5 +1,4 @@
|
|||
import { format } from "date-fns";
|
||||
import prettyBytes from "pretty-bytes";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
|
@ -12,6 +11,7 @@ import { NoEntryIcon, PlusCircleIcon } from "@primer/octicons-react";
|
|||
import { BinaryNotFoundModal } from "../shared-modals/binary-not-found-modal";
|
||||
import * as styles from "./hero-panel.css";
|
||||
import { useDate } from "@renderer/hooks/use-date";
|
||||
import { byteFormat } from "@renderer/utils";
|
||||
|
||||
export interface HeroPanelProps {
|
||||
game: Game | null;
|
||||
|
@ -120,10 +120,10 @@ export function HeroPanel({
|
|||
|
||||
const finalDownloadSize = useMemo(() => {
|
||||
if (!game) return "N/A";
|
||||
if (game.fileSize) return prettyBytes(game.fileSize);
|
||||
if (game.fileSize) return byteFormat(game.fileSize);
|
||||
|
||||
if (gameDownloading?.fileSize && isGameDownloading)
|
||||
return prettyBytes(gameDownloading.fileSize);
|
||||
return byteFormat(gameDownloading.fileSize);
|
||||
|
||||
return game.repack?.fileSize ?? "N/A";
|
||||
}, [game, isGameDownloading, gameDownloading]);
|
||||
|
@ -170,7 +170,7 @@ export function HeroPanel({
|
|||
</>
|
||||
) : (
|
||||
<p className={styles.downloadDetailsRow}>
|
||||
{prettyBytes(gameDownloading?.bytesDownloaded)} /{" "}
|
||||
{byteFormat(gameDownloading?.bytesDownloaded)} /{" "}
|
||||
{finalDownloadSize}
|
||||
<small>
|
||||
{numPeers} peers / {numSeeds} seeds
|
||||
|
@ -190,7 +190,7 @@ export function HeroPanel({
|
|||
})}
|
||||
</p>
|
||||
<p>
|
||||
{prettyBytes(game.bytesDownloaded)} / {finalDownloadSize}
|
||||
{byteFormat(game.bytesDownloaded)} / {finalDownloadSize}
|
||||
</p>
|
||||
</>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue