From 77973df0ff8689a65f62278a1771dcb6eaaeaeca Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sun, 12 Jan 2025 16:39:13 +0100 Subject: [PATCH] Show non downloading state while partially downloaded The state wasn't shown in case the chapter was partially downloaded --- src/modules/core/components/DownloadStateIndicator.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/core/components/DownloadStateIndicator.tsx b/src/modules/core/components/DownloadStateIndicator.tsx index 382edbb7..63dd1e19 100644 --- a/src/modules/core/components/DownloadStateIndicator.tsx +++ b/src/modules/core/components/DownloadStateIndicator.tsx @@ -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 ( <> - {(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})` : '', + })}