Skip to content

Commit 15f6e6d

Browse files
committed
Add progress bar for queue processing with show/hide functionality
1 parent 1acded2 commit 15f6e6d

File tree

5 files changed

+79
-0
lines changed

5 files changed

+79
-0
lines changed

floating-panel-ui-engine.js

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ window.MaxExtensionFloatingPanel.startQueue = function () {
6666
}
6767
this.isQueueRunning = true;
6868
logConCgp('[queue-engine] Queue started.');
69+
70+
// Show progress bar container when queue starts
71+
if (this.queueProgressContainer) {
72+
this.queueProgressContainer.style.display = 'block';
73+
}
74+
6975
this.updateQueueControlsState();
7076
this.processNextQueueItem();
7177
};
@@ -80,6 +86,14 @@ window.MaxExtensionFloatingPanel.pauseQueue = function () {
8086
this.queueTimerId = null;
8187
}
8288
logConCgp('[queue-engine] Queue paused.');
89+
90+
// Freeze the progress bar
91+
if (this.queueProgressBar) {
92+
const computedWidth = window.getComputedStyle(this.queueProgressBar).width;
93+
this.queueProgressBar.style.transition = 'none';
94+
this.queueProgressBar.style.width = computedWidth;
95+
}
96+
8397
this.updateQueueControlsState();
8498
};
8599

@@ -90,6 +104,16 @@ window.MaxExtensionFloatingPanel.resetQueue = function () {
90104
this.pauseQueue(); // Stop any running timers and set isQueueRunning to false
91105
this.promptQueue = [];
92106
logConCgp('[queue-engine] Queue reset.');
107+
108+
// Hide and reset progress bar
109+
if (this.queueProgressBar) {
110+
this.queueProgressBar.style.transition = 'none';
111+
this.queueProgressBar.style.width = '100%';
112+
}
113+
if (this.queueProgressContainer) {
114+
this.queueProgressContainer.style.display = 'none';
115+
}
116+
93117
this.renderQueueDisplay();
94118
this.updateQueueControlsState(); // This will disable buttons as needed
95119
};
@@ -138,10 +162,34 @@ window.MaxExtensionFloatingPanel.processNextQueueItem = function () {
138162
logConCgp(`[queue-engine] Waiting for ${delayMin} minutes before next item.`);
139163
}
140164

165+
// Start the progress bar animation
166+
if (this.queueProgressBar) {
167+
// Reset to full width instantly, then start the transition
168+
this.queueProgressBar.style.transition = 'none';
169+
this.queueProgressBar.style.width = '100%';
170+
171+
// Force reflow to apply the reset before starting transition
172+
setTimeout(() => {
173+
this.queueProgressBar.style.transition = `width ${delayMs / 1000}s linear`;
174+
this.queueProgressBar.style.width = '0%';
175+
}, 20);
176+
}
177+
141178
this.queueTimerId = setTimeout(() => this.processNextQueueItem(), delayMs);
142179
} else {
143180
logConCgp('[queue-engine] All items have been sent.');
144181
this.pauseQueue(); // Queue finished, so pause/stop
182+
183+
// Hide progress bar after a short delay to let animation finish
184+
setTimeout(() => {
185+
if (this.queueProgressContainer && !this.isQueueRunning) {
186+
this.queueProgressContainer.style.display = 'none';
187+
if (this.queueProgressBar) {
188+
this.queueProgressBar.style.transition = 'none';
189+
this.queueProgressBar.style.width = '100%';
190+
}
191+
}
192+
}, 1000); // Wait 1 second after finish to hide
145193
}
146194
};
147195

floating-panel-ui-queue.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ window.MaxExtensionFloatingPanel.initializeQueueSection = function () {
3232
this.playQueueButton = document.getElementById('max-extension-play-queue-btn');
3333
this.resetQueueButton = document.getElementById('max-extension-reset-queue-btn');
3434
this.queueDisplayArea = document.getElementById('max-extension-queue-display');
35+
this.queueProgressContainer = document.getElementById('max-extension-queue-progress-container');
36+
this.queueProgressBar = document.getElementById('max-extension-queue-progress-bar');
3537

3638
if (!this.queueSectionElement) {
3739
logConCgp('[floating-panel-queue] Queue section element not found in the DOM.');
@@ -166,4 +168,9 @@ window.MaxExtensionFloatingPanel.updateQueueControlsState = function () {
166168

167169
// Reset Button
168170
this.resetQueueButton.disabled = !hasItems && !this.isQueueRunning;
171+
172+
// Hide progress bar if queue is empty and not running
173+
if (this.queueProgressContainer && !this.isQueueRunning && !hasItems) {
174+
this.queueProgressContainer.style.display = 'none';
175+
}
169176
};

floating-panel.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,24 @@
156156
background-color: rgba(255, 0, 0, 0.3);
157157
}
158158

159+
#max-extension-queue-progress-container {
160+
height: 4px;
161+
background-color: rgba(0, 0, 0, 0.2);
162+
border-radius: 2px;
163+
overflow: hidden;
164+
display: none;
165+
/* Hidden by default */
166+
}
167+
168+
#max-extension-queue-progress-bar {
169+
height: 100%;
170+
width: 100%;
171+
background-color: white;
172+
/* Changed from green to white */
173+
border-radius: 2px;
174+
}
175+
176+
159177
/* Profile Switcher Footer */
160178
#max-extension-profile-switcher {
161179
padding: 8px 12px;

floating-panel.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@
6060
>
6161
<!-- Queued items will be shown here -->
6262
</div>
63+
<!-- Progress bar for queue delay -->
64+
<div id="max-extension-queue-progress-container">
65+
<div id="max-extension-queue-progress-bar"></div>
66+
</div>
6367
</div>
6468

6569
<!-- Footer for profile switching -->

floating-panel.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ window.MaxExtensionFloatingPanel = {
5656
queueTimerId: null,
5757
queueSectionElement: null,
5858
queueDisplayArea: null,
59+
queueProgressContainer: null,
60+
queueProgressBar: null,
5961
playQueueButton: null,
6062
pauseQueueButton: null, // This might be the same as play button
6163
resetQueueButton: null,

0 commit comments

Comments
 (0)