mirror of
http://nostr-git-proxy.forgejo.svc.cluster.local/git/45387ca441053e230b2126802005eb03767ab59d84555e8bac86b6e7def14e27/myadhd
synced 2026-09-23 20:23:10 +00:00
feat: implement 'Brain dump' inbox tool
All checks were successful
Build and Deploy / deploy (push) Successful in 17s
All checks were successful
Build and Deploy / deploy (push) Successful in 17s
Adds a quick-capture inbox tab to rapid-fire short tasks, edit them, and send them directly to the task breaker tool.
This commit is contained in:
parent
977f805abb
commit
275aab69b3
2 changed files with 127 additions and 1 deletions
|
|
@ -25,6 +25,7 @@
|
|||
<a href="#timer" data-tab="timer" class="tab" role="tab" id="tab-timer" aria-selected="false" aria-controls="timer">Focus timer</a>
|
||||
<a href="#dopamine" data-tab="dopamine" class="tab" role="tab" id="tab-dopamine" aria-selected="false" aria-controls="dopamine">Dopamine menu</a>
|
||||
<a href="#now" data-tab="now" class="tab" role="tab" id="tab-now" aria-selected="false" aria-controls="now">One thing</a>
|
||||
<a href="#inbox" data-tab="inbox" class="tab" role="tab" id="tab-inbox" aria-selected="false" aria-controls="inbox">Brain dump</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
|
|
@ -43,6 +44,7 @@
|
|||
<button class="btn welcome-btn" data-goto="timer" data-label="I need to focus">⏱️ I need to focus</button>
|
||||
<button class="btn welcome-btn" data-goto="dopamine" data-label="I need a break">🧠 I need a break</button>
|
||||
<button class="btn welcome-btn" data-goto="now" data-label="I'm overwhelmed">🌀 I'm overwhelmed</button>
|
||||
<button class="btn welcome-btn" data-goto="inbox" data-label="I have too many thoughts">🧠 I have too many thoughts</button>
|
||||
<button class="btn ghost welcome-btn" data-goto="pick" data-label="Pick for me">🎲 Just pick for me</button>
|
||||
</div>
|
||||
<p class="tiny">Pick whatever feels right. You can always switch. No wrong answers.</p>
|
||||
|
|
@ -152,6 +154,28 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<!-- ============ BRAIN DUMP INBOX ============ -->
|
||||
<section id="inbox" class="tool" role="tabpanel" aria-labelledby="tab-inbox" hidden>
|
||||
<div class="tool-head">
|
||||
<h1>Brain dump</h1>
|
||||
<p class="sub">Get it out of your head before you forget. Rapid-fire your tasks, then pick one to break down when you're ready.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<form id="inbox-form" class="row">
|
||||
<label for="inbox-input" class="sr-only">New task</label>
|
||||
<input id="inbox-input" type="text" placeholder="Type a task and hit Enter..." autocomplete="off">
|
||||
<button class="btn" type="submit">dump it</button>
|
||||
</form>
|
||||
<div id="inbox-out" hidden>
|
||||
<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-clear" type="button">clear all</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- ============ ONE THING ============ -->
|
||||
<section id="now" class="tool" role="tabpanel" aria-labelledby="tab-now" hidden>
|
||||
<div class="tool-head">
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@
|
|||
showTab('welcome');
|
||||
store('visited', true);
|
||||
} else {
|
||||
showTab(['breaker', 'timer', 'dopamine', 'now'].indexOf(initial) !== -1 ? initial : 'breaker');
|
||||
showTab(['breaker', 'timer', 'dopamine', 'now', 'inbox'].indexOf(initial) !== -1 ? initial : 'breaker');
|
||||
}
|
||||
|
||||
$$('.welcome-btn').forEach(function (b) {
|
||||
|
|
@ -662,6 +662,107 @@
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
/* ---------- inbox ---------- */
|
||||
var inboxItems = store('inbox') || [];
|
||||
var $inboxForm = $('#inbox-form'),
|
||||
$inboxInput = $('#inbox-input'),
|
||||
$inboxOut = $('#inbox-out'),
|
||||
$inboxCount = $('#inbox-count'),
|
||||
$inboxList = $('#inbox-list'),
|
||||
$inboxClear = $('#inbox-clear');
|
||||
|
||||
function saveInbox() {
|
||||
store('inbox', inboxItems);
|
||||
renderInbox();
|
||||
}
|
||||
|
||||
function renderInbox() {
|
||||
$inboxList.innerHTML = '';
|
||||
if (inboxItems.length === 0) {
|
||||
$inboxOut.hidden = true;
|
||||
return;
|
||||
}
|
||||
$inboxOut.hidden = false;
|
||||
$inboxCount.textContent = inboxItems.length + ' item' + (inboxItems.length === 1 ? '' : 's');
|
||||
inboxItems.forEach(function (item, i) {
|
||||
var li = document.createElement('li');
|
||||
li.className = 'step';
|
||||
|
||||
var textDiv = document.createElement('div');
|
||||
textDiv.className = 'step-text';
|
||||
textDiv.textContent = item;
|
||||
|
||||
var editInput = document.createElement('input');
|
||||
editInput.type = 'text';
|
||||
editInput.className = 'step-edit-input sr-only';
|
||||
editInput.value = item;
|
||||
|
||||
textDiv.addEventListener('click', function () {
|
||||
textDiv.classList.add('sr-only');
|
||||
editInput.classList.remove('sr-only');
|
||||
editInput.focus();
|
||||
});
|
||||
|
||||
function commitEdit() {
|
||||
var v = editInput.value.trim();
|
||||
if (!v) { inboxItems.splice(i, 1); }
|
||||
else { inboxItems[i] = v; }
|
||||
saveInbox();
|
||||
}
|
||||
|
||||
editInput.addEventListener('blur', commitEdit);
|
||||
editInput.addEventListener('keydown', function(e) { if (e.key === 'Enter') commitEdit(); });
|
||||
|
||||
var actionsDiv = document.createElement('div');
|
||||
actionsDiv.className = 'row gap';
|
||||
|
||||
var breakBtn = document.createElement('button');
|
||||
breakBtn.className = 'btn ghost small';
|
||||
breakBtn.textContent = 'break down';
|
||||
breakBtn.addEventListener('click', function() {
|
||||
inboxItems.splice(i, 1);
|
||||
saveInbox();
|
||||
$('#breaker-input').value = item;
|
||||
showTab('breaker');
|
||||
$('#breaker-form').dispatchEvent(new Event('submit'));
|
||||
});
|
||||
|
||||
var delBtn = document.createElement('button');
|
||||
delBtn.className = 'btn ghost small';
|
||||
delBtn.textContent = '×';
|
||||
delBtn.addEventListener('click', function() {
|
||||
inboxItems.splice(i, 1);
|
||||
saveInbox();
|
||||
});
|
||||
|
||||
actionsDiv.appendChild(breakBtn);
|
||||
actionsDiv.appendChild(delBtn);
|
||||
|
||||
li.appendChild(textDiv);
|
||||
li.appendChild(editInput);
|
||||
li.appendChild(actionsDiv);
|
||||
$inboxList.appendChild(li);
|
||||
});
|
||||
}
|
||||
|
||||
$inboxForm.addEventListener('submit', function (e) {
|
||||
e.preventDefault();
|
||||
var val = $inboxInput.value.trim();
|
||||
if (!val) return;
|
||||
inboxItems.unshift(val);
|
||||
$inboxInput.value = '';
|
||||
saveInbox();
|
||||
});
|
||||
|
||||
$inboxClear.addEventListener('click', function () {
|
||||
if (confirm('Clear entire inbox?')) {
|
||||
inboxItems = [];
|
||||
saveInbox();
|
||||
}
|
||||
});
|
||||
|
||||
renderInbox();
|
||||
/* ---------- keyboard shortcuts ---------- */
|
||||
document.addEventListener('keydown', function (e) {
|
||||
// Don't trigger shortcuts when typing in an input or contenteditable
|
||||
|
|
@ -673,6 +774,7 @@
|
|||
if (e.key === '2') { showTab('timer'); e.preventDefault(); }
|
||||
if (e.key === '3') { showTab('dopamine'); e.preventDefault(); }
|
||||
if (e.key === '4') { showTab('now'); e.preventDefault(); }
|
||||
if (e.key === '5') { showTab('inbox'); e.preventDefault(); }
|
||||
|
||||
// Space to start/pause timer when on timer tab
|
||||
if (e.key === ' ' && !$('#timer').hidden) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue