mirror of
http://nostr-git-proxy.forgejo.svc.cluster.local/git/45387ca441053e230b2126802005eb03767ab59d84555e8bac86b6e7def14e27/myadhd
synced 2026-09-23 20:23:10 +00:00
fix(sweep): add missing explicit close button to ui so cancelation flow avoids persistence bugs, and enforce manual vs auto sweep stamping
This commit is contained in:
parent
7db88148b7
commit
7035643d88
2 changed files with 18 additions and 10 deletions
|
|
@ -283,6 +283,7 @@
|
||||||
<!-- Morning Sweep Modal -->
|
<!-- Morning Sweep Modal -->
|
||||||
<div id="sweep-modal" class="modal-overlay" hidden>
|
<div id="sweep-modal" class="modal-overlay" hidden>
|
||||||
<div class="modal-content sweep-card">
|
<div class="modal-content sweep-card">
|
||||||
|
<button id="sweep-close" class="modal-close" aria-label="Close modal">×</button>
|
||||||
<h2>🌅 Welcome back</h2>
|
<h2>🌅 Welcome back</h2>
|
||||||
<p class="sweep-sub">You've been away. Some tasks are still here — and that's okay.<br>Keep what matters, release the rest.</p>
|
<p class="sweep-sub">You've been away. Some tasks are still here — and that's okay.<br>Keep what matters, release the rest.</p>
|
||||||
<ul id="sweep-list" class="sweep-items" role="list"></ul>
|
<ul id="sweep-list" class="sweep-items" role="list"></ul>
|
||||||
|
|
|
||||||
|
|
@ -840,12 +840,13 @@
|
||||||
return (Date.now() - last) > SWEEP_THRESHOLD;
|
return (Date.now() - last) > SWEEP_THRESHOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openSweep(items) {
|
function openSweep(items, isManual) {
|
||||||
var modal = $('#sweep-modal');
|
var modal = $('#sweep-modal');
|
||||||
var list = $('#sweep-list');
|
var list = $('#sweep-list');
|
||||||
var keepAll = $('#sweep-keep-all');
|
var keepAll = $('#sweep-keep-all');
|
||||||
var relAll = $('#sweep-release-all');
|
var relAll = $('#sweep-release-all');
|
||||||
var doneBtn = $('#sweep-done');
|
var doneBtn = $('#sweep-done');
|
||||||
|
var closeBtn = $('#sweep-close');
|
||||||
if (!modal || !list) return;
|
if (!modal || !list) return;
|
||||||
|
|
||||||
list.innerHTML = '';
|
list.innerHTML = '';
|
||||||
|
|
@ -887,7 +888,7 @@
|
||||||
list.appendChild(li);
|
list.appendChild(li);
|
||||||
});
|
});
|
||||||
|
|
||||||
keepAll.addEventListener('click', function () {
|
keepAll.onclick = function () {
|
||||||
items.forEach(function (_, i) {
|
items.forEach(function (_, i) {
|
||||||
if (decisions[i] !== 'release') {
|
if (decisions[i] !== 'release') {
|
||||||
decisions[i] = 'keep';
|
decisions[i] = 'keep';
|
||||||
|
|
@ -900,9 +901,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
relAll.addEventListener('click', function () {
|
relAll.onclick = function () {
|
||||||
items.forEach(function (_, i) {
|
items.forEach(function (_, i) {
|
||||||
if (decisions[i] !== 'keep') {
|
if (decisions[i] !== 'keep') {
|
||||||
decisions[i] = 'release';
|
decisions[i] = 'release';
|
||||||
|
|
@ -913,9 +914,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
};
|
||||||
|
|
||||||
doneBtn.addEventListener('click', function () {
|
doneBtn.onclick = function () {
|
||||||
// Rebuild inbox: keep items that were kept or undecided
|
// Rebuild inbox: keep items that were kept or undecided
|
||||||
var kept = [];
|
var kept = [];
|
||||||
items.forEach(function (text, i) {
|
items.forEach(function (text, i) {
|
||||||
|
|
@ -924,15 +925,21 @@
|
||||||
inboxItems = kept;
|
inboxItems = kept;
|
||||||
saveInbox();
|
saveInbox();
|
||||||
modal.hidden = true;
|
modal.hidden = true;
|
||||||
stampVisit();
|
if (!isManual) stampVisit();
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (closeBtn) {
|
||||||
|
closeBtn.onclick = function () {
|
||||||
|
modal.hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
modal.hidden = false;
|
modal.hidden = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auto-trigger on page load if stale
|
// Auto-trigger on page load if stale
|
||||||
if (sweepNeeded() && inboxItems.length > 0) {
|
if (sweepNeeded() && inboxItems.length > 0) {
|
||||||
openSweep(inboxItems.slice());
|
openSweep(inboxItems.slice(), false);
|
||||||
} else {
|
} else {
|
||||||
stampVisit();
|
stampVisit();
|
||||||
}
|
}
|
||||||
|
|
@ -942,7 +949,7 @@
|
||||||
if ($inboxSweep) {
|
if ($inboxSweep) {
|
||||||
$inboxSweep.addEventListener('click', function () {
|
$inboxSweep.addEventListener('click', function () {
|
||||||
if (inboxItems.length === 0) return;
|
if (inboxItems.length === 0) return;
|
||||||
openSweep(inboxItems.slice());
|
openSweep(inboxItems.slice(), true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue