Planner: one compact toolbar (title, Calendar | Tasks, view switch, agenda range, Add event)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
nmemmertandClaude Sonnet 5.5 committed 2026-10-22 08:59:29 -04:00
1 parent b8ab84a009
commit 4173d2c058
3 files changed
+22 -13

No files matched your search

+6 -5
View File
@@ -6,11 +6,12 @@ function viewPlanner(args = []) {
const want = args[0] && ok.includes(args[0]) ? args[0] : store.get('planner_pane', ok[0]);
location.replace('#/' + (ok.includes(want) ? want : ok[0] || 'home'));
}
/** The page heading, with a Calendar | Tasks switch when this person may use both. `extra` (a button, say) sits on the same row, at the right. */
function plannerHead(active, extra = '') {
/** One compact toolbar instead of stacked rows: title, Calendar | Tasks switch, then `mid` (the view switch) and `extra` (a button) pushed to the right. */
function plannerHead(active, extra = '', mid = '') {
try { localStorage.setItem(nk('planner_pane'), JSON.stringify(active)); } catch {}
const panes = PLANNER_PANES.filter(p => allowed(p[0]));
const seg = panes.length < 2 ? '' : `<div class="seg" role="tablist" aria-label="Planner">${panes.map(([k, l]) => `<a href="#/${k}" role="tab" aria-selected="${k === active}" class="${k === active ? 'on' : ''}">${l}</a>`).join('')}</div>`;
const title = panes.length < 2 ? (PLANNER_PANES.find(p => p[0] === active) || [0, 'Planner'])[1] : 'Planner';
return `<h1>${esc(title)}</h1>${seg || extra ? `<div class="prow">${seg}${extra}</div>` : ''}`;
const two = panes.length > 1;
const group = two ? `<div class="sgrp" role="tablist" aria-label="Planner">${panes.map(([k, l]) => `<a href="#/${k}" role="tab" aria-selected="${k === active}" class="${k === active ? 'on' : ''}">${l}</a>`).join('')}</div>` : '';
const title = two ? 'Planner' : (PLANNER_PANES.find(p => p[0] === active) || [0, 'Planner'])[1];
return `<div class="ptop"><h1>${esc(title)}</h1>${group}${mid}<span class="pspace"></span>${extra}</div>`;
}