Skip to content

Commit cdaaa0c

Browse files
committed
Update queue delay input validation and UI constraints for improved user experience
1 parent 8ab7b63 commit cdaaa0c

File tree

3 files changed

+44
-11
lines changed

3 files changed

+44
-11
lines changed

floating-panel-ui-queue.js

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,15 @@ window.MaxExtensionFloatingPanel.initializeQueueSection = function () {
5454
if (unit === 'sec') {
5555
this.delayUnitToggle.textContent = 'sec';
5656
this.delayInputElement.value = window.globalMaxExtensionConfig.queueDelaySeconds;
57-
this.delayInputElement.title = "Delay in seconds between sending each queued prompt. Minimum 2 seconds.";
58-
} else {
57+
this.delayInputElement.min = 15;
58+
this.delayInputElement.max = 64000;
59+
this.delayInputElement.title = "Delay in seconds between sending each queued prompt. Min: 15, Max: 64000.";
60+
} else { // 'min'
5961
this.delayUnitToggle.textContent = 'min';
6062
this.delayInputElement.value = window.globalMaxExtensionConfig.queueDelayMinutes;
61-
this.delayInputElement.title = "Delay in minutes between sending each queued prompt. Minimum 2 minutes.";
63+
this.delayInputElement.min = 1;
64+
this.delayInputElement.max = 64000;
65+
this.delayInputElement.title = "Delay in minutes between sending each queued prompt. Min: 1, Max: 64000.";
6266
}
6367
};
6468
updateDelayUI();
@@ -72,14 +76,20 @@ window.MaxExtensionFloatingPanel.initializeQueueSection = function () {
7276

7377
this.delayInputElement.addEventListener('change', (event) => {
7478
let delay = parseInt(event.target.value, 10);
75-
if (isNaN(delay) || delay < 2) {
76-
delay = 2;
77-
event.target.value = delay;
79+
const unit = window.globalMaxExtensionConfig.queueDelayUnit || 'min';
80+
const minDelay = (unit === 'sec') ? 15 : 1;
81+
const maxDelay = 64000;
82+
83+
if (isNaN(delay) || delay < minDelay) {
84+
delay = minDelay;
85+
} else if (delay > maxDelay) {
86+
delay = maxDelay;
7887
}
88+
event.target.value = delay;
7989

80-
if (window.globalMaxExtensionConfig.queueDelayUnit === 'sec') {
90+
if (unit === 'sec') {
8191
window.globalMaxExtensionConfig.queueDelaySeconds = delay;
82-
} else {
92+
} else { // 'min'
8393
window.globalMaxExtensionConfig.queueDelayMinutes = delay;
8494
}
8595
this.saveCurrentProfileConfig(); // Save to profile

floating-panel.css

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,17 @@
100100
}
101101

102102
#max-extension-queue-delay-input {
103-
width: 50px;
103+
min-width: 50px;
104+
/* Set a minimum width so it doesn't get too small */
105+
max-width: 100px;
106+
/* Set a maximum width to prevent breaking the layout */
104107
background-color: rgba(80, 80, 80, 1);
105108
color: white;
106109
border: 1px solid #666;
107110
border-radius: 4px;
108111
padding: 2px 4px;
109112
font-size: 12px;
113+
/* The fixed 'width' property is removed to allow dynamic sizing */
110114
}
111115

112116
#max-extension-queue-section .action-buttons-container {
@@ -238,4 +242,22 @@
238242
font-size: 12px;
239243
cursor: pointer;
240244
min-width: 120px;
245+
}
246+
247+
/* === ADDED TO RESTORE NUMBER INPUT SPINNERS === */
248+
/* This rule ensures the up/down arrows are visible on the queue delay input */
249+
#max-extension-queue-delay-input {
250+
appearance: textfield;
251+
-moz-appearance: textfield;
252+
/* For Firefox */
253+
}
254+
255+
#max-extension-queue-delay-input::-webkit-inner-spin-button,
256+
#max-extension-queue-delay-input::-webkit-outer-spin-button {
257+
-webkit-appearance: auto;
258+
/* For Chrome, Safari, Edge */
259+
opacity: 1;
260+
/* Make sure they are not transparent */
261+
margin: 0;
262+
/* Reset any custom margin */
241263
}

floating-panel.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
<input
3535
id="max-extension-queue-delay-input"
3636
type="number"
37-
min="2"
38-
title="Delay in minutes between sending each queued prompt. Minimum 2 minutes."
37+
min="1"
38+
max="64000"
39+
title="Delay in minutes between sending each queued prompt. Min: 1, Max: 64000."
3940
/>
4041
</div>
4142
<div class="action-buttons-container">

0 commit comments

Comments
 (0)