'use strict'; // Planner: Calendar and Tasks in one menu entry. Each part keeps its own address (#/calendar, #/tasks) so links and reminders still work. const PLANNER_PANES = [['calendar', 'Calendar'], ['tasks', 'Tasks']]; function viewPlanner(args = []) { const ok = PLANNER_PANES.map(p => p[0]).filter(p => allowed(p)); 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. */ function plannerHead(active) { try { localStorage.setItem(nk('planner_pane'), JSON.stringify(active)); } catch {} const panes = PLANNER_PANES.filter(p => allowed(p[0])); if (panes.length < 2) return `

${esc((PLANNER_PANES.find(p => p[0] === active) || [0, 'Planner'])[1])}

`; return `

Planner

${panes.map(([k, l]) => `${l}`).join('')}
`; }