Add undo to drag-drop trash. Fix toast undo button visibility (darker bg, border, max-width).

This commit is contained in:
2026-05-12 19:46:01 +01:00
parent ff9802e685
commit 73818e4e2e
2 changed files with 8 additions and 5 deletions
+3 -3
View File
@@ -25,9 +25,9 @@ body {
.toast { padding:0.7rem 1.2rem; border-radius:0.8rem; font-size:0.85rem; animation:slideIn 0.3s ease; color:#fff; } .toast { padding:0.7rem 1.2rem; border-radius:0.8rem; font-size:0.85rem; animation:slideIn 0.3s ease; color:#fff; }
.toast.error { background:var(--danger); } .toast.error { background:var(--danger); }
.toast.success { background:var(--success); } .toast.success { background:var(--success); }
.toast { display:flex; align-items:center; gap:0.6rem; } .toast { display:flex; align-items:center; gap:0.6rem; max-width:400px; }
.toast-action { background:rgba(255,255,255,0.25); border:none; color:#fff; font-weight:700; font-size:0.75rem; padding:0.25rem 0.6rem; border-radius:1rem; cursor:pointer; white-space:nowrap; transition:0.15s; } .toast-action { background:rgba(0,0,0,0.3); border:1px solid rgba(255,255,255,0.4); color:#fff; font-weight:700; font-size:0.8rem; padding:0.25rem 0.7rem; border-radius:1rem; cursor:pointer; white-space:nowrap; flex-shrink:0; transition:0.15s; }
.toast-action:hover { background:rgba(255,255,255,0.4); } .toast-action:hover { background:rgba(0,0,0,0.5); }
@keyframes slideIn { from { transform:translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } } @keyframes slideIn { from { transform:translateX(100%); opacity:0; } to { transform:translateX(0); opacity:1; } }
.vault { .vault {
+5 -2
View File
@@ -1326,10 +1326,13 @@ if (token && curUser) {
if (!id) return; if (!id) return;
const ids = selectedIds.has(id) && selectedIds.size > 1 ? [...selectedIds] : [id]; const ids = selectedIds.has(id) && selectedIds.size > 1 ? [...selectedIds] : [id];
for (const sid of ids) await delEntry(sid, true); for (const sid of ids) await delEntry(sid, true);
toast('📦 Moved ' + ids.length + ' entries to trash');
playSound('delete');
clearSelection(); clearSelection();
await loadEntries(); await loadEntries();
toast('📦 Moved ' + ids.length + ' entries to trash', 'success', {
label: '↩ Undo',
cb: async () => { for (const sid of ids) await restoreEntry(sid, true); await loadEntries(); toast('↩ Restored ' + ids.length + ' entries'); playSound('success'); }
});
playSound('delete');
}); });
} }
})(); })();