From 95644266c57889750770dff6ae6c52d907fb22a9 Mon Sep 17 00:00:00 2001 From: Arkaprabha Chakraborty Date: Fri, 9 Aug 2024 02:29:39 +0530 Subject: [PATCH] Fix: do not render the processing bar when progress is more than 0% --- frontend/bun.lockb | Bin 619526 -> 619526 bytes frontend/src/components/DownloadForm.js | 17 ++++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/frontend/bun.lockb b/frontend/bun.lockb index 61279ec0db773fd0ed72f30ce5fa0354971ffa0e..3e04e77feac6e44bc91f6207a16c0358f776135a 100755 GIT binary patch delta 47 zcmZpBq1yIBwV{Qvg{g(Pg{6gc3tMOoJ7b)go}r#WdrS@+5VHd@$M%>U&Q<{9 diff --git a/frontend/src/components/DownloadForm.js b/frontend/src/components/DownloadForm.js index 99fc7c2..bffa6f9 100644 --- a/frontend/src/components/DownloadForm.js +++ b/frontend/src/components/DownloadForm.js @@ -58,18 +58,13 @@ const DownloadForm = () => { return "bg-blue-500"; // Default color when not processing }; - const getBarStyle = () => { - if (message === "Download complete" || message === "Download failed") { - return { transition: "width 0.5s ease-in-out" }; - } - return { transition: "width 0.5s ease-in-out" }; - }; + const getBarStyle = () => ({ + transition: "width 0.5s ease-in-out", + }); const getAnimationStyle = () => { - if (message === "Download complete" || message === "Download failed") { - return { animation: "none" }; - } - return { animation: "loading 1.5s infinite" }; + // Hide the loading animation when progress is greater than 0 + return progress === 0 ? { animation: "loading 1.5s infinite" } : {}; }; useEffect(() => { @@ -136,7 +131,7 @@ const DownloadForm = () => { ...getBarStyle(), }} > - {isProcessing && ( + {isProcessing && progress === 0 && (