Skip to content

Commit b5bc42d

Browse files
committed
tooltips + hide queue UI when not in use
1 parent fb6f42e commit b5bc42d

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

floating-panel-ui-queue.js

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,27 +96,58 @@ window.MaxExtensionFloatingPanel.createQueueSection = function () {
9696
this.playQueueButton = document.createElement('button');
9797
this.playQueueButton.innerHTML = '▶️';
9898
this.playQueueButton.title = 'Start sending the queued prompts.';
99-
this.playQueueButton.style.cssText = 'background: none; border: none; font-size: 18px; cursor: pointer; display: none; padding: 0; color: white;';
99+
this.playQueueButton.style.cssText = 'background: none; border: none; font-size: 18px; cursor: pointer; padding: 0; color: white;';
100100

101101
this.resetQueueButton = document.createElement('button');
102102
this.resetQueueButton.innerHTML = '🔄';
103103
this.resetQueueButton.title = 'Clear all prompts from the queue.';
104-
this.resetQueueButton.style.cssText = 'background: none; border: none; font-size: 18px; cursor: pointer; display: none; padding: 0; color: white;';
104+
this.resetQueueButton.style.cssText = 'background: none; border: none; font-size: 18px; cursor: pointer; padding: 0; color: white;';
105105

106106
actionButtonsContainer.appendChild(this.playQueueButton);
107107
actionButtonsContainer.appendChild(this.resetQueueButton);
108108

109-
controlsContainer.appendChild(this.queueModeToggle);
110-
controlsContainer.appendChild(delayContainer);
111-
controlsContainer.appendChild(actionButtonsContainer);
112-
113109
// --- Queue Display Area ---
114110
this.queueDisplayArea = document.createElement('div');
115111
this.queueDisplayArea.id = 'max-extension-queue-display';
116-
this.queueDisplayArea.style.cssText = `min-height: 30px; background-color: rgba(40, 40, 40, 0.5); border-radius: 4px; padding: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;`;
112+
this.queueDisplayArea.style.cssText = `min-height: 30px; background-color: rgba(40, 40, 40, 0.5); border-radius: 4px; padding: 6px; display: none; flex-wrap: wrap; gap: 6px; align-items: center;`;
113+
114+
// --- Expandable Section for other controls ---
115+
const expandableSection = document.createElement('div');
116+
expandableSection.style.display = 'contents'; // Use 'contents' to not disrupt parent's flex layout.
117+
expandableSection.appendChild(delayContainer);
118+
expandableSection.appendChild(actionButtonsContainer);
119+
120+
// 1. Queue Mode Toggle (controls the expandable section)
121+
const isQueueEnabled = globalMaxExtensionConfig.enableQueueMode || false;
122+
this.queueModeToggle = MaxExtensionInterface.createToggle(
123+
'enableQueueMode', // ID must match localStorage key
124+
'Enable Queue Mode',
125+
isQueueEnabled,
126+
(state) => {
127+
globalMaxExtensionConfig.enableQueueMode = state;
128+
expandableSection.style.display = state ? 'contents' : 'none';
129+
this.queueDisplayArea.style.display = state ? 'flex' : 'none';
130+
}
131+
);
132+
this.queueModeToggle.style.margin = '0'; // Override default margins from createToggle
133+
this.queueModeToggle.title = 'When enabled, clicking buttons adds them to a queue instead of sending immediately.';
134+
135+
// Set initial visibility based on config
136+
if (isQueueEnabled) {
137+
expandableSection.style.display = 'contents';
138+
this.queueDisplayArea.style.display = 'flex';
139+
} else {
140+
expandableSection.style.display = 'none';
141+
this.queueDisplayArea.style.display = 'none';
142+
}
143+
144+
controlsContainer.appendChild(this.queueModeToggle);
145+
controlsContainer.appendChild(expandableSection);
146+
117147
queueSection.appendChild(controlsContainer);
118148
queueSection.appendChild(this.queueDisplayArea);
119149
this.queueSectionElement = queueSection;
120150
return queueSection;
121151
};
122152

153+

0 commit comments

Comments
 (0)