Fixed generic progress

This commit is contained in:
2025-09-04 20:14:12 +02:00
parent 3c6e2d3a9b
commit 6f90d0caa5

View File

@@ -46,18 +46,20 @@ export default function GenericProgress({ percent, tooltipId, tooltipContent, cl
> >
<div <div
data-id={tooltipId} data-id={tooltipId}
className="h-5 rounded-l-md" className={cn("h-5 rounded-l-md", percent > 100 ? "rounded-r-md" : undefined, className)}
style={{ style={{
width: `${percent}%`, width: `${percent > 100 ? 100 : percent}%`,
background: "repeating-linear-gradient(to right,#f55,#fa0,#ff5,#5f5,#5ff,#f5f,#a0a,#f55 16rem)" background: "repeating-linear-gradient(to right,#f55,#fa0,#ff5,#5f5,#5ff,#f5f,#a0a,#f55 16rem)"
}} }}
> >
</div> </div>
<div {percent < 100 && (
data-id={tooltipId} <div
className={cn("flex-1 h-5 rounded-r-md bg-background", percent === 0 ? "rounded-l-md" : undefined)} data-id={tooltipId}
> className={cn("flex-1 h-5 rounded-r-md bg-background", percent === 0 ? "rounded-l-md" : undefined)}
</div> >
</div>
)}
</div> </div>
<Tooltip id={tooltipId} position={pos} /> <Tooltip id={tooltipId} position={pos} />
</> </>
@@ -73,15 +75,17 @@ export default function GenericProgress({ percent, tooltipId, tooltipContent, cl
> >
<div <div
data-id={tooltipId} data-id={tooltipId}
className={cn("h-5 rounded-l-md", className)} className={cn("h-5 rounded-l-md", percent > 100 ? "rounded-r-md" : undefined, className)}
style={{ width: `${percent}%` }} style={{ width: `${percent > 100 ? 100 : percent}%` }}
>
</div>
<div
data-id={tooltipId}
className={cn("flex-1 h-5 rounded-r-md bg-background", percent === 0 ? "rounded-l-md" : undefined)}
> >
</div> </div>
{percent < 100 && (
<div
data-id={tooltipId}
className={cn("flex-1 h-5 rounded-r-md bg-background", percent === 0 ? "rounded-l-md" : undefined)}
>
</div>
)}
</div> </div>
<Tooltip id={tooltipId} position={pos} /> <Tooltip id={tooltipId} position={pos} />
</> </>