diff --git a/README.md b/README.md index 82cf8fb..5c22d9d 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,10 @@ overwriting newer views. Rename and delete affect only the saved view, never Git sync service leaves ad-hoc Search usable. Set `STACKCHAIN_SAVED_SEARCH_DB` to override the default `.stackchain-state/saved-searches.sqlite3` path. Completed delegated issues remain in the mobile **Filed** queue until their latest outcome is acknowledged. +The mobile queue sheet begins with **Prepare Today**, a live briefing that totals Agenda, Attention, Updates, and +Filed work, opens the highest-priority non-empty review queue, and refreshes the next action as queues clear. Once +urgent review is clear it continues the existing Today plan, or opens Find Work when Today is empty; viewing the +briefing itself never changes Gitea state. Filed separates actionable **Needs review** from a browsable **Reviewed** history, so acknowledgement clears the queue without erasing the delegated-work record. Reviewed cards reopen the existing read-only issue detail and conversation, while the Filed badge continues to count actionable outcomes only. A later Gitea update moves that diff --git a/frontend/dashboard.css b/frontend/dashboard.css index 9d360ee..3ae98bb 100644 --- a/frontend/dashboard.css +++ b/frontend/dashboard.css @@ -850,6 +850,10 @@ textarea { resize: vertical; min-height: 120px; } .mobile-queue-panel { padding:16px; padding-bottom:calc(16px + env(safe-area-inset-bottom)); } .mobile-queue-panel header { display:flex; align-items:center; justify-content:space-between; gap:12px; } .mobile-queue-panel h2 { margin:0; } + .mobile-start-day { display:grid; gap:12px; max-width:100%; overflow-wrap:anywhere; margin-top:12px; padding:14px; border:1px solid #31577f; border-radius:14px; background:linear-gradient(135deg,#173b64,#102641); } + .mobile-start-day h3, .mobile-start-day p { margin:0; } + .mobile-start-day p + p { margin-top:4px; } + .mobile-start-day-action { width:100%; min-height:48px; text-align:center; } .mobile-queue-list { display:grid; gap:8px; margin-top:12px; } .mobile-queue-list button { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:56px; width:100%; padding:10px 14px; text-align:left; } .mobile-queue-list button > span:first-child { display:grid; gap:2px; } diff --git a/frontend/dashboard.js b/frontend/dashboard.js index 8fe1502..8a1e985 100644 --- a/frontend/dashboard.js +++ b/frontend/dashboard.js @@ -95,7 +95,18 @@ findWork: () => qs('#find-work').click(), }); + const mobileStartDay = createMobileStartDay({ + getCounts: () => mobileQueueCounts, + openQueue: name => name === 'find' ? qs('#find-work').click() : mobileQueueLauncher.open(name), + elements: { + summary: qs('#mobile-start-day-summary'), + phases: qs('#mobile-start-day-phases'), + action: qs('#mobile-start-day-action'), + }, + }); + mobileStartDay.start(); function showMobileQueueCompletion(completedName, cleared = true) { + mobileStartDay.render(); const next = mobileQueueLauncher.recommend(); qs('#mobile-queue-heading').textContent = completedName + (cleared ? ' cleared' : ''); document.querySelectorAll('[data-mobile-queue]').forEach(row => row.removeAttribute('data-recommended')); @@ -2639,6 +2650,7 @@ if (element) element.textContent = count; }); mobileQueueCounts = counts; + mobileStartDay.render(); mobileTaskDock.updateQueues(counts); mobileTaskDock.updateWork(mobileWorkEntry.mode()); mobileTaskDock.updateAttention(countMyWork(activeMyWork).attention); diff --git a/frontend/index.html b/frontend/index.html index 1dfcca2..c8e81e8 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1223,6 +1223,14 @@

Choose what to work through next.

+
+
+

Prepare Today

+

Reviewing urgent queues…

+

Checking Agenda, Attention, Updates, and Filed

+
+ +
@@ -1322,6 +1330,7 @@ + diff --git a/frontend/mobile-start-day.js b/frontend/mobile-start-day.js new file mode 100644 index 0000000..aaca4b5 --- /dev/null +++ b/frontend/mobile-start-day.js @@ -0,0 +1,58 @@ +(function (root, factory) { + if (typeof module === 'object' && module.exports) module.exports = factory; + else root.createMobileStartDay = factory; +})(typeof self !== 'undefined' ? self : this, function createMobileStartDay(options) { + const reviewOrder = [ + ['agenda', 'Agenda'], + ['attention', 'Attention'], + ['update', 'Updates'], + ['filed', 'Filed'], + ]; + + function count(value) { + return Math.max(0, Number(value) || 0); + } + + function briefing() { + const counts = options.getCounts ? options.getCounts() : {}; + const phases = reviewOrder + .map(([name, label]) => ({name, label, count: count(counts[name])})) + .filter(phase => phase.count > 0); + const total = phases.reduce((sum, phase) => sum + phase.count, 0); + const today = count(counts.today); + const next = phases.length ? phases[0].name : (today ? 'today' : 'find'); + const nextLabel = phases.length ? 'Review ' + phases[0].label : (today ? 'Continue Today' : 'Find Work'); + return { + total, + next, + label: nextLabel, + summary: total ? total + ' items before Today · ' + today + ' planned' : + (today ? 'Review clear · ' + today + ' planned' : 'Review clear · Today is empty'), + phases, + }; + } + + function startNext() { + const next = briefing().next; + options.openQueue(next); + return next; + } + + function render() { + const current = briefing(); + if (!options.elements) return current; + options.elements.summary.textContent = current.summary; + options.elements.phases.textContent = current.phases.length ? + current.phases.map(phase => phase.label + ' ' + phase.count).join(' · ') : + 'All urgent queues reviewed'; + options.elements.action.textContent = current.label; + return current; + } + + function start() { + render(); + if (options.elements) options.elements.action.addEventListener('click', startNext); + } + + return {briefing, render, start, startNext}; +}); diff --git a/frontend/service-worker.js b/frontend/service-worker.js index a73e075..25efeaf 100644 --- a/frontend/service-worker.js +++ b/frontend/service-worker.js @@ -1,7 +1,7 @@ const BASE = new URL('./', self.location.href).pathname; importScripts(BASE + 'static/private-data-registry.js'); importScripts(BASE + 'static/background-issue-sync.js'); -const CACHE = 'stackchain-dashboard-shell-v102'; +const CACHE = 'stackchain-dashboard-shell-v103'; const OFFLINE_LEASE_URL = new URL(BASE + '__offline-session-lease', self.location.origin).href; const OUTAGE_STATUSES = new Set([500, 502, 503, 504]); const NAVIGATION_TIMEOUT_MS = self.__STACKCHAIN_NAVIGATION_TIMEOUT_MS || 4000; @@ -87,6 +87,7 @@ const SHELL = [ BASE + 'static/mobile-task-dock.js', BASE + 'static/mobile-work-entry.js', BASE + 'static/mobile-queue-launcher.js', + BASE + 'static/mobile-start-day.js', BASE + 'static/update-triage-session.js', BASE + 'static/update-review-handoff.js', BASE + 'static/update-read-position.js', diff --git a/src/frontend_bundle.py b/src/frontend_bundle.py index 082215b..29925ee 100644 --- a/src/frontend_bundle.py +++ b/src/frontend_bundle.py @@ -30,7 +30,7 @@ FEATURE_SOURCES = { "device-setup": ("static/install-app.js", "static/mobile-device-setup.js"), "security-center": ("static/security-center.js",), "today-timer": ( - "static/today-completion.js", "static/work-detail-position.js", "static/work-route.js", "static/commands.js", "static/saved-searches.js", "static/task-overlay-history.js", "static/search-preview.js", "static/search-defer.js", "static/mobile-search-viewport.js", "static/my-work.js", "static/protect-today.js", "static/mobile-task-dock.js", "static/mobile-queue-launcher.js", "static/update-triage-session.js", "static/update-review-handoff.js", "static/update-triage-launcher.js", "static/update-triage-gesture.js", "static/notification-undo.js", "static/today-timer.js", "static/today-recap.js", + "static/today-completion.js", "static/work-detail-position.js", "static/work-route.js", "static/commands.js", "static/saved-searches.js", "static/task-overlay-history.js", "static/search-preview.js", "static/search-defer.js", "static/mobile-search-viewport.js", "static/my-work.js", "static/protect-today.js", "static/mobile-task-dock.js", "static/mobile-queue-launcher.js", "static/mobile-start-day.js", "static/update-triage-session.js", "static/update-review-handoff.js", "static/update-triage-launcher.js", "static/update-triage-gesture.js", "static/notification-undo.js", "static/today-timer.js", "static/today-recap.js", "static/today-rollover.js", "static/later-work.js", "static/later-picker.js", "static/drafts.js", "static/unfiled-captures.js", "static/unfiled-draft-sync.js", "static/assign-and-start.js", "static/filed-claim.js", "static/queue-today.js", "static/create-and-start.js", "static/draft-filing-session.js", "static/draft-capacity-dialog.js", "static/work-selection.js", diff --git a/tests/test_comment_next.py b/tests/test_comment_next.py index a1fde35..b6f25af 100644 --- a/tests/test_comment_next.py +++ b/tests/test_comment_next.py @@ -303,4 +303,4 @@ async def test_unread_update_offers_reply_mark_read_and_next_independent_of_toda assert '.update-reply-actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr));' in html assert '.update-reply-actions button { min-height:44px;' in html worker = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text() - assert "stackchain-dashboard-shell-v102" in worker + assert "stackchain-dashboard-shell-v103" in worker diff --git a/tests/test_later_sync.py b/tests/test_later_sync.py index 9a0d752..534386e 100644 --- a/tests/test_later_sync.py +++ b/tests/test_later_sync.py @@ -347,5 +347,5 @@ async def test_dashboard_syncs_every_later_change_and_exposes_account_status(): def test_later_sync_ships_atomically_in_the_offline_shell(): source = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/later-sync.js'" in source diff --git a/tests/test_markdown_renderer.py b/tests/test_markdown_renderer.py index 2f215a8..9657282 100644 --- a/tests/test_markdown_renderer.py +++ b/tests/test_markdown_renderer.py @@ -137,4 +137,4 @@ def test_markdown_work_bodies_are_mobile_safe_block_containers(): assert ".markdown-content { min-width:0; max-width:100%; overflow-wrap:anywhere;" in css assert ".markdown-content pre { max-width:100%; overflow-x:auto;" in css assert ".markdown-content a { min-height:44px;" in css - assert "stackchain-dashboard-shell-v102" in worker + assert "stackchain-dashboard-shell-v103" in worker diff --git a/tests/test_mobile_composer_integration.py b/tests/test_mobile_composer_integration.py index e06770c..0b74503 100644 --- a/tests/test_mobile_composer_integration.py +++ b/tests/test_mobile_composer_integration.py @@ -45,7 +45,7 @@ def test_offline_shell_contains_every_local_dashboard_runtime_asset(): shell_assets = set(re.findall(r"BASE \+ '([^']+)'", worker.split("async function sessionCsrf", 1)[0])) assert local_assets <= shell_assets, f"Offline shell is missing: {sorted(local_assets - shell_assets)}" - assert "stackchain-dashboard-shell-v102" in worker + assert "stackchain-dashboard-shell-v103" in worker def test_all_conversation_composers_offer_accessible_mobile_mentions(): diff --git a/tests/test_mobile_device_setup.py b/tests/test_mobile_device_setup.py index 8b92c1a..ec91010 100644 --- a/tests/test_mobile_device_setup.py +++ b/tests/test_mobile_device_setup.py @@ -214,7 +214,7 @@ def test_mobile_dashboard_mounts_phone_safe_device_setup_flow(): assert "promptStorage:localStorage" in dashboard assert "pushControllerReady.then(ensureDeviceSetup)" in dashboard assert "BASE + 'static/mobile-device-setup.js'" in worker - assert "stackchain-dashboard-shell-v102" in worker + assert "stackchain-dashboard-shell-v103" in worker assert ".device-setup-panel" in css assert ".device-readiness-card" in css assert "overflow-x:hidden" in css diff --git a/tests/test_mobile_start_day.py b/tests/test_mobile_start_day.py new file mode 100644 index 0000000..c4ed648 --- /dev/null +++ b/tests/test_mobile_start_day.py @@ -0,0 +1,129 @@ +import json +import subprocess +from pathlib import Path +import pytest + +from tests.dashboard_bundle import dashboard + + +START_DAY = Path(__file__).resolve().parents[1] / "frontend" / "mobile-start-day.js" + + +def run_node(script: str) -> dict: + result = subprocess.run(["node", "-e", script], capture_output=True, text=True) + assert result.returncode == 0, result.stderr + return json.loads(result.stdout) + + +def test_start_day_briefing_guides_urgent_review_before_today(): + script = f""" +const createStartDay = require({json.dumps(str(START_DAY))}); +let counts = {{agenda:2, attention:3, update:4, filed:1, today:5}}; +const opened = []; +const controller = createStartDay({{ + getCounts: () => counts, + openQueue: name => opened.push(name), +}}); +const first = controller.briefing(); +controller.startNext(); +counts = {{agenda:0, attention:3, update:4, filed:1, today:5}}; +const second = controller.briefing(); +controller.startNext(); +counts = {{agenda:0, attention:0, update:0, filed:0, today:5}}; +const ready = controller.briefing(); +controller.startNext(); +process.stdout.write(JSON.stringify({{first, second, ready, opened}})); +""" + + result = run_node(script) + + assert result == { + "first": { + "total": 10, + "next": "agenda", + "label": "Review Agenda", + "summary": "10 items before Today · 5 planned", + "phases": [ + {"name": "agenda", "label": "Agenda", "count": 2}, + {"name": "attention", "label": "Attention", "count": 3}, + {"name": "update", "label": "Updates", "count": 4}, + {"name": "filed", "label": "Filed", "count": 1}, + ], + }, + "second": { + "total": 8, + "next": "attention", + "label": "Review Attention", + "summary": "8 items before Today · 5 planned", + "phases": [ + {"name": "attention", "label": "Attention", "count": 3}, + {"name": "update", "label": "Updates", "count": 4}, + {"name": "filed", "label": "Filed", "count": 1}, + ], + }, + "ready": { + "total": 0, + "next": "today", + "label": "Continue Today", + "summary": "Review clear · 5 planned", + "phases": [], + }, + "opened": ["agenda", "attention", "today"], + } + + +def test_start_day_view_renders_refreshed_phases_and_launches_primary_action(): + script = f""" +const createStartDay = require({json.dumps(str(START_DAY))}); +const elements = {{ + summary: {{textContent:''}}, + phases: {{textContent:''}}, + action: {{textContent:'', listeners:{{}}, addEventListener(name, fn) {{ this.listeners[name] = fn; }}}}, +}}; +const opened = []; +let counts = {{agenda:0, attention:2, update:1, filed:0, today:3}}; +const controller = createStartDay({{ + getCounts: () => counts, + openQueue: name => opened.push(name), + elements, +}}); +controller.start(); +const first = {{summary:elements.summary.textContent, phases:elements.phases.textContent, action:elements.action.textContent}}; +elements.action.listeners.click(); +counts = {{agenda:0, attention:0, update:0, filed:0, today:3}}; +controller.render(); +const ready = {{summary:elements.summary.textContent, phases:elements.phases.textContent, action:elements.action.textContent}}; +process.stdout.write(JSON.stringify({{first, ready, opened}})); +""" + + assert run_node(script) == { + "first": { + "summary": "3 items before Today · 3 planned", + "phases": "Attention 2 · Updates 1", + "action": "Review Attention", + }, + "ready": { + "summary": "Review clear · 3 planned", + "phases": "All urgent queues reviewed", + "action": "Continue Today", + }, + "opened": ["attention"], + } + + +@pytest.mark.anyio +async def test_dashboard_wires_thumb_safe_start_day_briefing_into_offline_mobile_bundle(): + html = await dashboard() + service_worker = (START_DAY.parent / "service-worker.js").read_text() + + assert 'class="mobile-start-day"' in html + assert 'id="mobile-start-day-summary"' in html + assert 'id="mobile-start-day-phases"' in html + assert 'id="mobile-start-day-action"' in html + assert '' in html + assert "const mobileStartDay = createMobileStartDay({" in html + assert "openQueue: name => name === 'find'" in html + assert "mobileStartDay.render();" in html + assert ".mobile-start-day-action { width:100%; min-height:48px;" in html + assert "max-width:100%; overflow-wrap:anywhere;" in html + assert "BASE + 'static/mobile-start-day.js'" in service_worker diff --git a/tests/test_plan_today.py b/tests/test_plan_today.py index 2e380d9..d4b1c8d 100644 --- a/tests/test_plan_today.py +++ b/tests/test_plan_today.py @@ -410,7 +410,7 @@ async def test_plan_today_wires_cancel_back_and_success_through_overlay_history( def test_plan_today_controller_is_available_in_the_offline_shell(): source = SERVICE_WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/plan-today.js'" in source assert "BASE + 'static/plan-today-readiness.js'" in source assert "BASE + 'static/plan-today-preview.js'" in source diff --git a/tests/test_service_worker.py b/tests/test_service_worker.py index d43ff02..08f3e1f 100644 --- a/tests/test_service_worker.py +++ b/tests/test_service_worker.py @@ -152,7 +152,7 @@ async function dispatchPush(payload) {{ def test_resumable_today_session_ships_in_a_new_offline_shell(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/my-work.js'" in source assert "BASE + 'static/dashboard.js'" in source assert "BASE + 'static/dashboard.css'" in source @@ -161,14 +161,14 @@ def test_resumable_today_session_ships_in_a_new_offline_shell(): def test_ownership_exit_runtime_rolls_the_offline_shell_cache(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/dashboard.js'" in source def test_offline_review_next_ships_today_completion_atomically(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/today-completion.js'" in source assert "BASE + 'static/dashboard.js'" in source @@ -176,7 +176,7 @@ def test_offline_review_next_ships_today_completion_atomically(): def test_duplicate_aware_capture_ships_in_a_new_offline_shell(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/create-issue-sheet.js'" in source assert "BASE + 'static/dashboard.js'" in source @@ -184,14 +184,14 @@ def test_duplicate_aware_capture_ships_in_a_new_offline_shell(): def test_exact_later_picker_ships_atomically_in_a_new_offline_shell(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/later-picker.js'" in source def test_navigation_deadline_ships_in_a_new_shell_cache(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/dashboard.css'" in source assert "BASE + 'static/dashboard.js'" in source assert "BASE + 'static/install-app.js'" in source @@ -200,21 +200,21 @@ def test_navigation_deadline_ships_in_a_new_shell_cache(): def test_today_convergence_ships_in_a_new_shell_cache(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/today-sync.js'" in source def test_mobile_search_viewport_ships_in_a_new_offline_shell(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/mobile-search-viewport.js'" in source def test_update_ownership_flow_ships_atomically_in_a_new_offline_shell(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/update-ownership.js'" in source @@ -800,7 +800,7 @@ def test_one_session_bound_csrf_proof_is_reused_for_a_background_drain(): def test_queue_today_ships_atomically_in_a_new_offline_shell(): source = WORKER.read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/queue-today.js'" in source @@ -894,6 +894,7 @@ def test_install_precaches_complete_subpath_scoped_app_shell(): "/dashboard/static/mobile-task-dock.js", "/dashboard/static/mobile-work-entry.js", "/dashboard/static/mobile-queue-launcher.js", + "/dashboard/static/mobile-start-day.js", "/dashboard/static/update-triage-session.js", "/dashboard/static/update-review-handoff.js", "/dashboard/static/update-read-position.js", diff --git a/tests/test_today_readiness.py b/tests/test_today_readiness.py index 6d248eb..4795120 100644 --- a/tests/test_today_readiness.py +++ b/tests/test_today_readiness.py @@ -221,7 +221,7 @@ async def test_today_blocker_opens_existing_preview_and_preserves_readiness_gate def test_readiness_runtime_is_available_in_offline_shell(): service_worker = SERVICE_WORKER.read_text() - assert "const CACHE = 'stackchain-dashboard-shell-v102';" in service_worker + assert "const CACHE = 'stackchain-dashboard-shell-v103';" in service_worker assert "BASE + 'static/today-readiness.js'" in service_worker diff --git a/tests/test_today_sync.py b/tests/test_today_sync.py index c71393d..a349c70 100644 --- a/tests/test_today_sync.py +++ b/tests/test_today_sync.py @@ -127,7 +127,7 @@ sync.enqueueConfiguration(120, {{'issue:r:1:':60}}); def test_inflight_today_drain_ships_in_a_new_offline_shell(): source = (Path(__file__).parents[1] / "frontend" / "service-worker.js").read_text() - assert "stackchain-dashboard-shell-v102" in source + assert "stackchain-dashboard-shell-v103" in source assert "BASE + 'static/today-sync.js'" in source