Show non downloading state while partially downloaded
The state wasn't shown in case the chapter was partially downloaded
This commit is contained in:
@@ -33,6 +33,8 @@ export const DownloadStateIndicator = ({ chapterId }: { chapterId: ChapterIdInfo
|
|||||||
const isDownloading = download.state === DownloadState.Downloading;
|
const isDownloading = download.state === DownloadState.Downloading;
|
||||||
const isPartiallyDownloaded = download.progress !== 0;
|
const isPartiallyDownloaded = download.progress !== 0;
|
||||||
|
|
||||||
|
const progress = `${Math.round(download.progress * 100)}%`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@@ -63,10 +65,12 @@ export const DownloadStateIndicator = ({ chapterId }: { chapterId: ChapterIdInfo
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
{(isDownloading || isPartiallyDownloaded) && `${Math.round(download.progress * 100)}%`}
|
{isDownloading && progress}
|
||||||
{!isDownloading &&
|
{!isDownloading &&
|
||||||
!isPartiallyDownloaded &&
|
t('global.value', {
|
||||||
t(DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP[download.state])}
|
value: t(DOWNLOAD_STATE_TO_TRANSLATION_KEY_MAP[download.state]),
|
||||||
|
unit: isPartiallyDownloaded ? ` (${progress})` : '',
|
||||||
|
})}
|
||||||
</>
|
</>
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
Reference in New Issue
Block a user