feat: Track 1 — Anti-Guilt Morning Sweep

- Detect >24h absence via localStorage timestamp
- Show gentle full-screen sweep modal listing all inbox items
- Each item gets Keep or Release to Universe with dissolve animation
- Bulk Keep All / Release All buttons
- After sweep, update inbox and stamp lastVisit
- Add manual 'sweep stale' button in inbox section
- Stardust dissolve CSS animation on released items
- Remove leftover utility/patch scripts from repo root

Implements Sprint 4 Track 1 per MYADHD_SPRINT_4_SPEC.md
This commit is contained in:
djg 2026-09-23 06:21:02 +00:00
parent 2077e9b1d7
commit 0f9bf0c34e
3 changed files with 187 additions and 0 deletions

View file

@ -215,6 +215,7 @@
<p class="tiny" id="inbox-count"></p> <p class="tiny" id="inbox-count"></p>
<ul id="inbox-list" class="steps" role="list"></ul> <ul id="inbox-list" class="steps" role="list"></ul>
<div id="inbox-actions" class="row gap mt-2"> <div id="inbox-actions" class="row gap mt-2">
<button class="btn ghost" id="inbox-sweep" type="button">sweep stale 🌌</button>
<button class="btn ghost" id="inbox-clear" type="button">clear all dumped tasks</button> <button class="btn ghost" id="inbox-clear" type="button">clear all dumped tasks</button>
</div> </div>
</div> </div>
@ -279,6 +280,20 @@
</footer> </footer>
<!-- Morning Sweep Modal -->
<div id="sweep-modal" class="modal-overlay" hidden>
<div class="modal-content sweep-card">
<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>
<div class="sweep-actions">
<button id="sweep-keep-all" class="btn ghost" type="button">Keep all</button>
<button id="sweep-release-all" class="btn ghost" type="button">Release all 🌌</button>
<button id="sweep-done" class="btn primary" type="button">Done — let's go</button>
</div>
</div>
</div>
<!-- Unstuck Floating Button --> <!-- Unstuck Floating Button -->
<button id="btn-unstuck" class="unstuck-trigger" title="Feeling paralyzed? Click here for the Unstuck Protocol">🆘 Unstuck</button> <button id="btn-unstuck" class="unstuck-trigger" title="Feeling paralyzed? Click here for the Unstuck Protocol">🆘 Unstuck</button>

View file

@ -827,6 +827,124 @@
}); });
renderInbox(); renderInbox();
/* ---------- morning sweep ---------- */
var SWEEP_KEY = 'lastVisit';
var SWEEP_THRESHOLD = 24 * 60 * 60 * 1000; // 24 hours
function stampVisit() { store(SWEEP_KEY, Date.now()); }
function sweepNeeded() {
var last = store(SWEEP_KEY);
if (!last) { stampVisit(); return false; } // first ever visit
return (Date.now() - last) > SWEEP_THRESHOLD;
}
function openSweep(items) {
var modal = $('#sweep-modal');
var list = $('#sweep-list');
var keepAll = $('#sweep-keep-all');
var relAll = $('#sweep-release-all');
var doneBtn = $('#sweep-done');
if (!modal || !list) return;
list.innerHTML = '';
var decisions = items.map(function () { return null; }); // null = undecided
items.forEach(function (text, i) {
var li = document.createElement('li');
var span = document.createElement('span');
span.className = 'sweep-text';
span.textContent = text;
var keep = document.createElement('button');
keep.className = 'sweep-btn sweep-keep';
keep.textContent = 'Keep';
keep.type = 'button';
var release = document.createElement('button');
release.className = 'sweep-btn sweep-release';
release.textContent = 'Release 🌌';
release.type = 'button';
keep.addEventListener('click', function () {
decisions[i] = 'keep';
keep.classList.add('kept');
keep.textContent = '✓ Kept';
release.style.display = 'none';
});
release.addEventListener('click', function () {
decisions[i] = 'release';
li.classList.add('sweep-dissolve');
setTimeout(function () { li.classList.add('released'); }, 500);
});
li.appendChild(span);
li.appendChild(keep);
li.appendChild(release);
list.appendChild(li);
});
keepAll.addEventListener('click', function () {
items.forEach(function (_, i) {
if (decisions[i] !== 'release') {
decisions[i] = 'keep';
var lis = list.children[i];
if (lis) {
var kb = lis.querySelector('.sweep-keep');
if (kb) { kb.classList.add('kept'); kb.textContent = '✓ Kept'; }
var rb = lis.querySelector('.sweep-release');
if (rb) rb.style.display = 'none';
}
}
});
});
relAll.addEventListener('click', function () {
items.forEach(function (_, i) {
if (decisions[i] !== 'keep') {
decisions[i] = 'release';
var lis = list.children[i];
if (lis) {
lis.classList.add('sweep-dissolve');
setTimeout(function () { lis.classList.add('released'); }, 500);
}
}
});
});
doneBtn.addEventListener('click', function () {
// Rebuild inbox: keep items that were kept or undecided
var kept = [];
items.forEach(function (text, i) {
if (decisions[i] !== 'release') kept.push(text);
});
inboxItems = kept;
saveInbox();
modal.hidden = true;
stampVisit();
});
modal.hidden = false;
}
// Auto-trigger on page load if stale
if (sweepNeeded() && inboxItems.length > 0) {
openSweep(inboxItems.slice());
}
stampVisit();
// Manual "sweep stale" button in inbox
var $inboxSweep = $('#inbox-sweep');
if ($inboxSweep) {
$inboxSweep.addEventListener('click', function () {
if (inboxItems.length === 0) return;
openSweep(inboxItems.slice());
});
}
/* ---------- keyboard shortcuts ---------- */ /* ---------- keyboard shortcuts ---------- */
document.addEventListener('keydown', function (e) { document.addEventListener('keydown', function (e) {
// Don't trigger shortcuts when typing in an input or contenteditable // Don't trigger shortcuts when typing in an input or contenteditable

View file

@ -381,3 +381,57 @@ input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-off
0% { fill: #d97706; } 0% { fill: #d97706; }
100% { fill: #f59e0b; } 100% { fill: #f59e0b; }
} }
/* Morning Sweep */
.sweep-card {
background: var(--bg-card, #1e1e2e);
padding: 36px 28px;
border-radius: 20px;
max-width: 520px;
width: 92%;
border: 1px solid var(--border, #313244);
text-align: center;
box-shadow: 0 20px 40px rgba(0,0,0,0.5);
max-height: 85vh;
overflow-y: auto;
}
.sweep-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.sweep-sub { color: var(--dim); font-size: .95rem; margin-bottom: 22px; line-height: 1.5; }
.sweep-items {
list-style: none; text-align: left;
display: flex; flex-direction: column; gap: 8px;
margin-bottom: 24px;
}
.sweep-items li {
display: flex; align-items: center; gap: 10px;
background: var(--bg2); border: 1.5px solid var(--line);
border-radius: 12px; padding: 10px 14px;
transition: opacity 0.6s ease, transform 0.6s ease, max-height 0.4s ease 0.3s;
max-height: 80px; overflow: hidden;
}
.sweep-items li .sweep-text { flex: 1; font-size: .95rem; }
.sweep-items li .sweep-btn {
flex: 0 0 auto; font: inherit; font-size: .75rem; font-weight: 700;
cursor: pointer; border-radius: 8px; padding: 4px 12px;
transition: all 0.15s ease; white-space: nowrap;
}
.sweep-keep {
color: var(--good); background: transparent; border: 1.5px solid var(--good);
}
.sweep-keep:hover { background: var(--good); color: #14141c; }
.sweep-keep.kept { background: var(--good); color: #14141c; pointer-events: none; }
.sweep-release {
color: var(--accent); background: transparent; border: 1.5px solid var(--accent-dim);
}
.sweep-release:hover { background: var(--accent-dim); color: #fff; }
.sweep-items li.released {
opacity: 0; transform: translateY(-8px) scale(0.95);
max-height: 0; padding: 0 14px; margin: 0; border-color: transparent;
}
.sweep-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes stardust {
0% { opacity: 1; filter: blur(0); }
60% { opacity: 0.3; filter: blur(2px); }
100% { opacity: 0; filter: blur(6px); transform: translateY(-12px) scale(0.8); }
}
.sweep-dissolve { animation: stardust 0.6s ease forwards; }