diff --git a/frontend/dashboard.js b/frontend/dashboard.js index 914cce9..1a60eca 100644 --- a/frontend/dashboard.js +++ b/frontend/dashboard.js @@ -43,20 +43,30 @@ Array.from(document.querySelectorAll('[data-mobile-task]')).map(button => [button.dataset.mobileTask, button]) ); const mobileTaskOverlays = Array.from(document.querySelectorAll('[role="dialog"], #whiteboard-modal, #markdown-modal')); - function openMobileWork() { + function openMobileWorkFallback() { const counts = countMyWork(activeMyWork); - const filter = todayMyWork.length ? 'today' : (counts.attention ? 'attention' : 'all'); + const filter = counts.attention ? 'attention' : 'all'; qs('[data-work-filter="' + filter + '"]').click(); qs('#my-work').scrollIntoView({block:'start'}); qs('#my-work').focus(); } + const mobileWorkEntry = createMobileWorkEntry({ + isTodayActive: () => workSession.checkpointed(), + isTodayResumable: () => workSession.resumable(), + getTodayCount: () => todayMyWork.length, + continueToday: continueTodaySession, + resumeToday: resumeTodaySession, + startToday: startTodaySession, + openFallback: openMobileWorkFallback, + }); const mobileTaskDock = createMobileTaskDock({ nav: qs('#mobile-task-dock'), buttons: mobileTaskButtons, + workLabel: qs('#mobile-work-label'), attentionBadge: qs('#mobile-attention-count'), overlays: mobileTaskOverlays, actions: { - work: openMobileWork, + work: () => mobileWorkEntry.open(), find: () => qs('#find-work').click(), new: () => qs('#new-issue').click(), search: () => qs('#open-palette').click(), @@ -678,6 +688,7 @@ qs('#start-work-session').hidden = active; qs('#resume-today-session').hidden = active || !todayMyWork.length || !workSession.resumable(); qs('#end-today-session').hidden = !active; + mobileTaskDock.updateWork(mobileWorkEntry.mode(), countMyWork(activeMyWork).attention); } const workSession = createWorkSession({ @@ -709,6 +720,31 @@ }, }); + function selectTodayWork() { + qs('[data-work-filter="today"]').click(); + } + + function continueTodaySession() { + selectTodayWork(); + if (!workSession.reopen() && !workSession.reconcile()) { + qs('#my-work-action-status').textContent = 'Current Today item is no longer available.'; + updateWorkSessionActions(); + } + } + + function resumeTodaySession() { + selectTodayWork(); + if (!workSession.resume()) { + qs('#my-work-action-status').textContent = 'Saved Today session is no longer available.'; + updateWorkSessionActions(); + } + } + + function startTodaySession() { + selectTodayWork(); + workSession.start(); + } + const createAndStart = createCreateAndStart({ todayWork, todaySync, @@ -1105,7 +1141,7 @@ const element = qs('[data-work-count="' + filter + '"]'); if (element) element.textContent = count; }); - mobileTaskDock.updateAttention(counts.attention); + mobileTaskDock.updateWork(mobileWorkEntry.mode(), countMyWork(activeMyWork).attention); const activeQueue = qs('[data-work-filter="' + selectedWorkFilter + '"]'); qs('#active-work-queue').textContent = activeQueue.firstChild.textContent.trim() + ' (' + (counts[selectedWorkFilter] || 0) + ')'; diff --git a/frontend/index.html b/frontend/index.html index 0d1dee9..b68af68 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -567,7 +567,7 @@