automation fixes (part2)

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-28 03:15:39 +00:00
parent d4b9c8693a
commit f92b3fba6e
4 changed files with 543 additions and 37 deletions

View File

@@ -58,6 +58,11 @@ const GlobalProgressBar: React.FC<GlobalProgressBarProps> = ({
stages,
initialSnapshot,
}) => {
// Animated progress state - moves 1% every 10 seconds
const [animatedPercent, setAnimatedPercent] = React.useState(0);
const lastRealPercent = React.useRef(0);
const animationTimer = React.useRef<ReturnType<typeof setInterval> | null>(null);
// Don't render if no run or run is completed with 100%
if (!currentRun) {
return null;
@@ -99,7 +104,43 @@ const GlobalProgressBar: React.FC<GlobalProgressBarProps> = ({
};
};
const { percentage, completed, total } = calculateGlobalProgress();
const { percentage: realPercent, completed, total } = calculateGlobalProgress();
// Animated progress: moves 1% per 10 seconds, within current stage bounds
React.useEffect(() => {
if (realPercent > lastRealPercent.current) {
lastRealPercent.current = realPercent;
setAnimatedPercent(realPercent);
}
if (animationTimer.current) {
clearInterval(animationTimer.current);
}
if (currentRun.status !== 'running') {
return;
}
// Calculate ceiling based on current stage (each stage is ~14% of total)
const stageCeiling = Math.min(currentRun.current_stage * 14, realPercent + 10);
animationTimer.current = setInterval(() => {
setAnimatedPercent(prev => {
if (prev >= stageCeiling || prev >= realPercent + 5) {
return prev;
}
return Math.min(prev + 1, stageCeiling);
});
}, 10000); // 1% every 10 seconds
return () => {
if (animationTimer.current) {
clearInterval(animationTimer.current);
}
};
}, [currentRun.status, realPercent, currentRun.current_stage]);
const percentage = Math.max(animatedPercent, realPercent);
// Hide if completed and at 100%
if (currentRun.status === 'completed' && percentage >= 100) {