import React, { useEffect } from "react"; import Spinner from "../../icons/Spinner"; function ProgressBar({ progress, doubleUpscaylCounter, stopHandler, batchMode, }: { progress: string; doubleUpscaylCounter: number; stopHandler: () => void; batchMode: boolean; }) { const [batchProgress, setBatchProgress] = React.useState(0); useEffect(() => { const progressString = progress.trim().replace(/\n/g, ""); // Remove trailing and leading spaces if (progressString.includes("Successful")) { setBatchProgress((prev) => prev + 1); } }, [progress]); console.log({ progress, }); return (
{batchMode && "Batch Upscale In Progress: " + batchProgress} {!batchMode && (doubleUpscaylCounter > 0 ? `${progress}\nPass ${doubleUpscaylCounter}` : `${progress}`)}
Doing the Upscayl magic...