Show non downloading state while partially downloaded

The state wasn't shown in case the chapter was partially downloaded
This commit is contained in:
schroda
2025-01-12 16:39:13 +01:00
parent 257c0c8e10
commit 77973df0ff

View File

@@ -33,6 +33,8 @@ export const DownloadStateIndicator = ({ chapterId }: { chapterId: ChapterIdInfo
const isDownloading = download.state === DownloadState.Downloading;
const isPartiallyDownloaded = download.progress !== 0;
const progress = `${Math.round(download.progress * 100)}%`;
return (
<Box
sx={{
@@ -63,10 +65,12 @@ export const DownloadStateIndicator = ({ chapterId }: { chapterId: ChapterIdInfo
}}
>
<>
{(isDownloading || isPartiallyDownloaded) && `${Math.round(download.progress * 100)}%`}
{isDownloading && progress}
{!isDownloading &&
!isPartiallyDownloaded &&
t(DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP[download.state])}
t('global.value', {
value: t(DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP[download.state]),
unit: isPartiallyDownloaded ? ` (${progress})` : '',
})}
</>
</Typography>
</Box>