From ba178292024a355aee7895c8b100bf82c5f585cb Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Sat, 13 Jun 2026 07:16:26 +0900 Subject: [PATCH] AI reply menu: Fast/Full sit below the context textarea as confirm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dropped the two-step (pick mode → context → OK) flow. Now the context textarea is at the top of the popover and Fast (left) / Full (right) sit below as the confirm buttons themselves — they fire the draft with whatever's currently in the textarea (empty = no steering). --- static/js/emailLibrary.js | 44 ++++++++++++--------------------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js index cec7f8983..31e8570e0 100644 --- a/static/js/emailLibrary.js +++ b/static/js/emailLibrary.js @@ -5923,49 +5923,31 @@ function _showAiReplyChoice(btn, em, data) { // Full = layered concentric circles to suggest "more, deeper" — not a fully // filled circle so it reads as a complement to the lightning, not as a "stop". menu.innerHTML = ` -
-
- -
-
`; - const modeRow = menu.querySelector('[data-mode-row]'); - const notePanel = menu.querySelector('[data-note-panel]'); const noteInput = menu.querySelector('[data-note-input]'); - let pendingMode = null; + setTimeout(() => noteInput.focus(), 0); menu.addEventListener('click', async (ev) => { const choice = ev.target.closest('[data-mode]'); - if (choice) { - ev.preventDefault(); - ev.stopPropagation(); - // First click reveals the optional-context textarea; the actual - // draft runs on OK. Empty context just runs the chosen mode. - pendingMode = choice.getAttribute('data-mode') || 'ai-reply'; - modeRow.setAttribute('hidden', ''); - notePanel.removeAttribute('hidden'); - setTimeout(() => noteInput.focus(), 0); - return; - } - const ok = ev.target.closest('[data-act="note-ok"]'); - if (ok) { - ev.preventDefault(); - ev.stopPropagation(); - const noteHint = (noteInput.value || '').trim(); - const mode = pendingMode || 'ai-reply'; - _closeAiReplyChoice(); - await _runAiReplyFromButton(btn, em, data, mode, noteHint); - } + if (!choice) return; + ev.preventDefault(); + ev.stopPropagation(); + const mode = choice.getAttribute('data-mode') || 'ai-reply'; + const noteHint = (noteInput.value || '').trim(); + _closeAiReplyChoice(); + await _runAiReplyFromButton(btn, em, data, mode, noteHint); }); // Esc closes the popover; ignore plain clicks inside the menu so the // textarea stays focused.