1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-19 17:32:38 +01:00

Convert formatBytes to TypeScript

Closes #10272
This commit is contained in:
Bogdan 2024-08-14 18:48:49 +03:00
parent abc7efabea
commit 6c456e57d8
5 changed files with 8 additions and 8 deletions

View File

@ -568,9 +568,7 @@ class MovieDetails extends Component {
size={sizes.LARGE}
>
<span className={styles.sizeOnDisk}>
{
formatBytes(sizeOnDisk || 0)
}
{formatBytes(sizeOnDisk)}
</span>
</InfoLabel>

View File

@ -134,10 +134,12 @@ function getInfoRowProps(
}
if (name === 'sizeOnDisk') {
const { sizeOnDisk = 0 } = props;
return {
title: 'Size on Disk',
iconName: icons.DRIVE,
label: formatBytes(props.sizeOnDisk),
label: formatBytes(sizeOnDisk),
};
}

View File

@ -58,7 +58,7 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) {
certification,
originalTitle,
originalLanguage,
sizeOnDisk,
sizeOnDisk = 0,
tags = [],
sortKey,
showRelativeDates,

View File

@ -21,7 +21,7 @@ interface RootFolderRowProps {
}
function RootFolderRow(props: RootFolderRowProps) {
const { id, path, accessible, freeSpace, unmappedFolders = [] } = props;
const { id, path, accessible, freeSpace = 0, unmappedFolders = [] } = props;
const isUnavailable = !accessible;

View File

@ -1,6 +1,6 @@
import { filesize } from 'filesize';
function formatBytes(input) {
function formatBytes(input: string | number) {
const size = Number(input);
if (isNaN(size)) {
@ -9,7 +9,7 @@ function formatBytes(input) {
return `${filesize(size, {
base: 2,
round: 1
round: 1,
})}`;
}