mirror of
http://nostr-git-proxy.forgejo.svc.cluster.local/git/45387ca441053e230b2126802005eb03767ab59d84555e8bac86b6e7def14e27/myadhd
synced 2026-09-23 20:23:10 +00:00
Merge branch 'sprint/4-anti-guilt-morning-sweep'
# Conflicts: # site/static/style.css
This commit is contained in:
commit
b4484d134f
3 changed files with 198 additions and 0 deletions
|
|
@ -227,6 +227,7 @@
|
|||
<p class="tiny" id="inbox-count"></p>
|
||||
<ul id="inbox-list" class="steps" role="list"></ul>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -291,6 +292,21 @@
|
|||
</footer>
|
||||
|
||||
|
||||
<!-- 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>
|
||||
<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 -->
|
||||
<button id="btn-unstuck" class="unstuck-trigger" title="Feeling paralyzed? Click here for the Unstuck Protocol">🆘 Unstuck</button>
|
||||
|
||||
|
|
|
|||
|
|
@ -827,6 +827,132 @@
|
|||
});
|
||||
|
||||
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, 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 = '';
|
||||
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.onclick = 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.onclick = 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.onclick = 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;
|
||||
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(), false);
|
||||
} else {
|
||||
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(), true);
|
||||
});
|
||||
}
|
||||
|
||||
/* ---------- keyboard shortcuts ---------- */
|
||||
document.addEventListener('keydown', function (e) {
|
||||
// Don't trigger shortcuts when typing in an input or contenteditable
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-off
|
|||
}
|
||||
|
||||
|
||||
|
||||
/* Ambient Doubling */
|
||||
.ambient-pill {
|
||||
position: absolute;
|
||||
|
|
@ -505,3 +506,58 @@ input[type="text"]:focus-visible { outline: 2px solid var(--accent); outline-off
|
|||
gap: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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; }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue