Fix: do not render the processing bar when progress is more than 0%

This commit is contained in:
Arkaprabha Chakraborty
2024-08-09 02:29:39 +05:30
parent ab699dc260
commit 95644266c5
2 changed files with 6 additions and 11 deletions

Binary file not shown.

View File

@@ -58,18 +58,13 @@ const DownloadForm = () => {
return "bg-blue-500"; // Default color when not processing return "bg-blue-500"; // Default color when not processing
}; };
const getBarStyle = () => { const getBarStyle = () => ({
if (message === "Download complete" || message === "Download failed") { transition: "width 0.5s ease-in-out",
return { transition: "width 0.5s ease-in-out" }; });
}
return { transition: "width 0.5s ease-in-out" };
};
const getAnimationStyle = () => { const getAnimationStyle = () => {
if (message === "Download complete" || message === "Download failed") { // Hide the loading animation when progress is greater than 0
return { animation: "none" }; return progress === 0 ? { animation: "loading 1.5s infinite" } : {};
}
return { animation: "loading 1.5s infinite" };
}; };
useEffect(() => { useEffect(() => {
@@ -136,7 +131,7 @@ const DownloadForm = () => {
...getBarStyle(), ...getBarStyle(),
}} }}
></div> ></div>
{isProcessing && ( {isProcessing && progress === 0 && (
<div <div
className={`absolute top-0 left-0 w-full h-full bg-blue-300 rounded-full`} className={`absolute top-0 left-0 w-full h-full bg-blue-300 rounded-full`}
style={getAnimationStyle()} style={getAnimationStyle()}