From 85e13314a2eae791f55c4dd5fa6be40e91abb45e Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Tue, 12 May 2026 21:20:13 -0400 Subject: [PATCH] feat: add confirm step to message-level delete Clicking del now shows 'confirm delete / cancel' inline in the action bar. Cancel rebuilds the original buttons; confirm proceeds as before. Matches the session delete pattern added in the prior commit. Co-Authored-By: Claude Sonnet 4.6 --- cortex/static/app.js | 15 ++++++++++++++- documentation/TODO__Agents.md | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cortex/static/app.js b/cortex/static/app.js index 2f5e259..0abceed 100644 --- a/cortex/static/app.js +++ b/cortex/static/app.js @@ -935,7 +935,20 @@ delBtn.className = 'msg-act-btn del'; delBtn.innerHTML = icon_html('trash-2', 12) + ' del'; delBtn.addEventListener('click', () => { - deleteMsg(wrapper); + actionsDiv.innerHTML = ''; + + const yesBtn = document.createElement('button'); + yesBtn.className = 'msg-act-btn del'; + yesBtn.textContent = 'confirm delete'; + yesBtn.addEventListener('click', () => deleteMsg(wrapper)); + + const noBtn = document.createElement('button'); + noBtn.className = 'msg-act-btn'; + noBtn.textContent = 'cancel'; + noBtn.addEventListener('click', () => + attachHistoryControls(msgDiv, parseInt(wrapper.dataset.histIdx))); + + actionsDiv.append(yesBtn, noBtn); }); actionsDiv.appendChild(editBtn); diff --git a/documentation/TODO__Agents.md b/documentation/TODO__Agents.md index 26a5126..cf5f85f 100644 --- a/documentation/TODO__Agents.md +++ b/documentation/TODO__Agents.md @@ -139,7 +139,7 @@ ability to act on HA via the REST API. ### [UX] Session delete confirmation - [x] Inline "Delete this session? [Delete] [Cancel]" reveal on `×` click in `app.js` — 2026-05-12 -- [ ] Consider: also confirm for message-level delete (Edit/Delete hover controls) +- [x] Message-level delete: "confirm delete / cancel" inline in the actions bar — 2026-05-12 ### [UI] File attachments in chat Upload an image or document inline and have it flow into context. Natural workflow