Use dynamic unit for Torrent DownloadSpeed and UploadSpeed

Use humanFileSize to display Torrent DownloadSpeed and UploadSpeed
This commit is contained in:
Someone
2023-11-05 17:39:37 +01:00
committed by GitHub
parent f4a4b3c252
commit 2d28ecc990

View File

@@ -39,8 +39,6 @@ export const BitTorrentQueueItem = ({ torrent, width, app }: TorrentQueueItemPro
const { classes } = useStyles(); const { classes } = useStyles();
const { t } = useTranslation('modules/torrents-status'); const { t } = useTranslation('modules/torrents-status');
const downloadSpeed = torrent.downloadSpeed / 1024 / 1024;
const uploadSpeed = torrent.uploadSpeed / 1024 / 1024;
const size = torrent.totalSelected; const size = torrent.totalSelected;
return ( return (
<Popover <Popover
@@ -81,14 +79,14 @@ export const BitTorrentQueueItem = ({ torrent, width, app }: TorrentQueueItemPro
{width > MIN_WIDTH_MOBILE && ( {width > MIN_WIDTH_MOBILE && (
<td> <td>
<Text className={classes.noTextBreak} size="xs"> <Text className={classes.noTextBreak} size="xs">
{downloadSpeed > 0 ? `${downloadSpeed.toFixed(1)} MB/s` : '-'} {torrent.downloadSpeed > 0 ? `${humanFileSize(torrent.downloadSpeed,false)}/s` : '-'}
</Text> </Text>
</td> </td>
)} )}
{width > MIN_WIDTH_MOBILE && ( {width > MIN_WIDTH_MOBILE && (
<td> <td>
<Text className={classes.noTextBreak} size="xs"> <Text className={classes.noTextBreak} size="xs">
{uploadSpeed > 0 ? `${uploadSpeed.toFixed(1)} MB/s` : '-'} {torrent.uploadSpeed > 0 ? `${humanFileSize(torrent.uploadSpeed,false)}/s` : '-'}
</Text> </Text>
</td> </td>
)} )}