From 86965950ac2002f10ee4436cf40e8b390c3cddbe Mon Sep 17 00:00:00 2001 From: pewdiepie-archdaemon Date: Thu, 11 Jun 2026 20:24:19 +0900 Subject: [PATCH] Email reader: AI reply becomes a split button (main + caret) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Main button: open cached AI draft if one exists, otherwise generate a fast draft inline. No more intermediate Fast/Full/Note menu. Caret on the side opens a focused popover with just a textarea + Generate button — the user types instructions (e.g. 'thank them and confirm Tuesday at 2', 'decline politely') and submitting fires the full-mode generation with those instructions as the noteHint. - _aiReplySplitButtonHtml(data) centralizes the new HTML so all three reader render sites use the same markup. - _showAiReplyChoice rewritten — drops the Fast/Full toggle row plus the kebab + 'Draft with note' two-step. Ctrl/Cmd+Enter submits. - _handleAiReplyButton routes based on which inner button was clicked (caret → popover, main → run-or-open). - The three reader event registrations now listen on .ai-reply-split so both inner buttons feed the same handler. --- static/js/emailLibrary.js | 136 ++++++++++++++++++-------------------- 1 file changed, 64 insertions(+), 72 deletions(-) diff --git a/static/js/emailLibrary.js b/static/js/emailLibrary.js index 2c1f8d743..5ee628f09 100644 --- a/static/js/emailLibrary.js +++ b/static/js/emailLibrary.js @@ -3062,7 +3062,7 @@ async function _toggleCardPreview(card, em) { ${_hasMultipleRecipients(data) ? `` : ''} - + ${_aiReplySplitButtonHtml(data)}
@@ -3119,7 +3119,7 @@ async function _toggleCardPreview(card, em) { _snapEmailModalToLeftSidebar(ev.currentTarget.closest('.modal')); if (state._onEmailClick) await state._onEmailClick({ email: em, emailData: data, mode: 'reply-all' }); }); - reader.querySelector('[data-act="ai-reply"]')?.addEventListener('click', (ev) => _handleAiReplyButton(ev, em, data)); + reader.querySelector('.ai-reply-split')?.addEventListener('click', (ev) => _handleAiReplyButton(ev, em, data)); reader.querySelector('[data-act="forward"]')?.addEventListener('click', async (ev) => { ev.stopPropagation(); if (state._onEmailClick) await state._onEmailClick({ email: em, emailData: data, mode: 'forward' }); @@ -4759,7 +4759,7 @@ async function _openEmailAsTab(em, folder) { ${_hasMultipleRecipients(data) ? `` : ''} - + ${_aiReplySplitButtonHtml(data)}