diff --git a/frontend/src/Movie/Details/MovieDetails.js b/frontend/src/Movie/Details/MovieDetails.js index 34f9f613f..bbca0a83c 100644 --- a/frontend/src/Movie/Details/MovieDetails.js +++ b/frontend/src/Movie/Details/MovieDetails.js @@ -568,9 +568,7 @@ class MovieDetails extends Component { size={sizes.LARGE} > - { - formatBytes(sizeOnDisk || 0) - } + {formatBytes(sizeOnDisk)} diff --git a/frontend/src/Movie/Index/Overview/MovieIndexOverviewInfo.tsx b/frontend/src/Movie/Index/Overview/MovieIndexOverviewInfo.tsx index b237dd92b..b60825b4c 100644 --- a/frontend/src/Movie/Index/Overview/MovieIndexOverviewInfo.tsx +++ b/frontend/src/Movie/Index/Overview/MovieIndexOverviewInfo.tsx @@ -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), }; } diff --git a/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.tsx b/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.tsx index 2e8f3e4c5..0d3cdc17e 100644 --- a/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.tsx +++ b/frontend/src/Movie/Index/Posters/MovieIndexPosterInfo.tsx @@ -58,7 +58,7 @@ function MovieIndexPosterInfo(props: MovieIndexPosterInfoProps) { certification, originalTitle, originalLanguage, - sizeOnDisk, + sizeOnDisk = 0, tags = [], sortKey, showRelativeDates, diff --git a/frontend/src/RootFolder/RootFolderRow.tsx b/frontend/src/RootFolder/RootFolderRow.tsx index bf8ac6f7a..3b97319da 100644 --- a/frontend/src/RootFolder/RootFolderRow.tsx +++ b/frontend/src/RootFolder/RootFolderRow.tsx @@ -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; diff --git a/frontend/src/Utilities/Number/formatBytes.js b/frontend/src/Utilities/Number/formatBytes.ts similarity index 75% rename from frontend/src/Utilities/Number/formatBytes.js rename to frontend/src/Utilities/Number/formatBytes.ts index d4d389357..a0ae8a985 100644 --- a/frontend/src/Utilities/Number/formatBytes.js +++ b/frontend/src/Utilities/Number/formatBytes.ts @@ -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, })}`; }