7JHL5GZZVA76345RT3XJU2J65SRFSL5CVLRATGP52ZZ4DRQFLAJQC
console.log(data, error);
useEffect(() => {
if((data && data.sync.kind === 'CANCELLED') || error) {
setCancelled(true);
if(progress === 0) {
setProgress(100);
}
} else if(data && data.sync.remainingLogs && data.sync.totalLogs) {
const new_prog = (1 - data.sync.remainingLogs / data.sync.totalLogs) * 100;
setProgress(new_prog);
}
}, [data]);
if (data !== undefined) {
return (
<div className="m-auto mt-10 max-w-xl">
<div className="h-3 relative max-w-xl rounded-full overflow-hidden">
<div className="w-full h-full bg-gray-200 absolute"></div>
<div className="h-full bg-blue-500 absolute" style={{ width: `${(1 - data.sync.remainingLogs / data.sync.totalLogs) * 100}%` }}></div>
</div>
return (
<div className="m-auto mt-10 max-w-xl">
<span>{cancelled ? 'Unable to import logs' : 'Importing Logs...'}</span>
<div className="h-3 relative max-w-xl rounded-full overflow-hidden">
<div className="w-full h-full bg-gray-200 absolute"></div>
<div className={`h-full absolute ${cancelled ? "bg-red-500" : "bg-blue-500"}`} style={{ width: `${progress}%` }}></div>