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 -->
|
||||
<div id="sweep-modal" class="modal-overlay" hidden>
|
||||
<div class="modal-content sweep-card">
|
||||
<button id="sweep-close" class="modal-close" aria-label="Close modal">×</button>
|
||||
<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>
|
||||
<ul id="sweep-list" class="sweep-items" role="list"></ul>
|
||||
|
|
|
|||
|
|
@ -840,12 +840,13 @@
|
|||
return (Date.now() - last) > SWEEP_THRESHOLD;
|
||||
}
|
||||
|
||||
function openSweep(items) {
|
||||
function openSweep(items, isManual) {
|
||||
var modal = $('#sweep-modal');
|
||||
var list = $('#sweep-list');
|
||||
var keepAll = $('#sweep-keep-all');
|
||||
var relAll = $('#sweep-release-all');
|
||||
var doneBtn = $('#sweep-done');
|
||||
var closeBtn = $('#sweep-close');
|
||||
if (!modal || !list) return;
|
||||
|
||||
list.innerHTML = '';
|
||||
|
|
@ -887,7 +888,7 @@
|
|||
list.appendChild(li);
|
||||
});
|
||||
|
||||
keepAll.addEventListener('click', function () {
|
||||
keepAll.onclick = function () {
|
||||
items.forEach(function (_, i) {
|
||||
if (decisions[i] !== 'release') {
|
||||
decisions[i] = 'keep';
|
||||
|
|
@ -900,9 +901,9 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
relAll.addEventListener('click', function () {
|
||||
relAll.onclick = function () {
|
||||
items.forEach(function (_, i) {
|
||||
if (decisions[i] !== 'keep') {
|
||||
decisions[i] = 'release';
|
||||
|
|
@ -913,9 +914,9 @@
|
|||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
doneBtn.addEventListener('click', function () {
|
||||
doneBtn.onclick = function () {
|
||||
// Rebuild inbox: keep items that were kept or undecided
|
||||
var kept = [];
|
||||
items.forEach(function (text, i) {
|
||||
|
|
@ -924,15 +925,21 @@
|
|||
inboxItems = kept;
|
||||
saveInbox();
|
||||
modal.hidden = true;
|
||||
stampVisit();
|
||||
});
|
||||
if (!isManual) stampVisit();
|
||||
};
|
||||
|
||||
if (closeBtn) {
|
||||
closeBtn.onclick = function () {
|
||||
modal.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
modal.hidden = false;
|
||||
}
|
||||
|
||||
// Auto-trigger on page load if stale
|
||||
if (sweepNeeded() && inboxItems.length > 0) {
|
||||
openSweep(inboxItems.slice());
|
||||
openSweep(inboxItems.slice(), false);
|
||||
} else {
|
||||
stampVisit();
|
||||
}
|
||||
|
|
@ -942,7 +949,7 @@
|
|||
if ($inboxSweep) {
|
||||
$inboxSweep.addEventListener('click', function () {
|
||||
if (inboxItems.length === 0) return;
|
||||
openSweep(inboxItems.slice());
|
||||
openSweep(inboxItems.slice(), true);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue