mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 15:35:55 +01:00
Use humanFileSize
This commit is contained in:
@@ -19,6 +19,7 @@ import { useConfig } from '../../../tools/state';
|
|||||||
import { AddItemShelfButton } from '../../AppShelf/AddAppShelfItem';
|
import { AddItemShelfButton } from '../../AppShelf/AddAppShelfItem';
|
||||||
import { useSetSafeInterval } from '../../../tools/hooks/useSetSafeInterval';
|
import { useSetSafeInterval } from '../../../tools/hooks/useSetSafeInterval';
|
||||||
import { useViewportSize } from '@mantine/hooks';
|
import { useViewportSize } from '@mantine/hooks';
|
||||||
|
import { humanFileSize } from '../../../tools/humanFileSize';
|
||||||
|
|
||||||
export const DownloadsModule: IModule = {
|
export const DownloadsModule: IModule = {
|
||||||
title: 'Torrent',
|
title: 'Torrent',
|
||||||
@@ -100,7 +101,7 @@ export default function DownloadComponent() {
|
|||||||
.map((torrent) => {
|
.map((torrent) => {
|
||||||
const downloadSpeed = torrent.downloadSpeed / 1024 / 1024;
|
const downloadSpeed = torrent.downloadSpeed / 1024 / 1024;
|
||||||
const uploadSpeed = torrent.uploadSpeed / 1024 / 1024;
|
const uploadSpeed = torrent.uploadSpeed / 1024 / 1024;
|
||||||
const size = torrent.totalSelected / (1024 * 1024);
|
const size = torrent.totalSelected;
|
||||||
// Convert Seconds to readable format.
|
// Convert Seconds to readable format.
|
||||||
function calculateETA(givenSeconds: number) {
|
function calculateETA(givenSeconds: number) {
|
||||||
if (givenSeconds > 86399) { // No
|
if (givenSeconds > 86399) { // No
|
||||||
@@ -140,7 +141,7 @@ export default function DownloadComponent() {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<Text size="xs">{size > 0 ? (size > 999 ? `${(size / 1024).toFixed(1)} GB` : `${size.toFixed(1)} MB`) : '-' }</Text>
|
<Text size="xs">{humanFileSize(size)}</Text>
|
||||||
</td>
|
</td>
|
||||||
{width > 576 ?
|
{width > 576 ?
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user