feat: launch fresh mobile work in Agenda (Closes #701)
All checks were successful
CI / lint (pull_request) Successful in 1m27s
CI / build-release (pull_request) Successful in 6s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy 2026-08-13 02:51:25 +00:00
parent 71d06347fd
commit 1b311c9cd4
3 changed files with 12 additions and 7 deletions

View File

@ -2164,6 +2164,7 @@
if (!launchFilterResolved) { if (!launchFilterResolved) {
selectedWorkFilter = mobileLaunch.chooseFilter({ selectedWorkFilter = mobileLaunch.chooseFilter({
saved: savedWorkFilter, today: counts.today, attention: counts.attention, saved: savedWorkFilter, today: counts.today, attention: counts.attention,
agenda: counts.agenda,
}); });
launchFilterResolved = true; launchFilterResolved = true;
document.querySelectorAll('[data-work-filter]').forEach(item => document.querySelectorAll('[data-work-filter]').forEach(item =>

View File

@ -4,13 +4,14 @@
else root.mobileLaunch = api; else root.mobileLaunch = api;
})(typeof globalThis !== 'undefined' ? globalThis : this, function () { })(typeof globalThis !== 'undefined' ? globalThis : this, function () {
const allowedFilters = new Set([ const allowedFilters = new Set([
'all', 'today', 'attention', 'issue', 'pull', 'review', 'update', 'later', 'draft', 'all', 'today', 'attention', 'agenda', 'issue', 'pull', 'review', 'update', 'later', 'draft',
]); ]);
function chooseFilter({ saved, today = 0, attention = 0 } = {}) { function chooseFilter({ saved, today = 0, attention = 0, agenda = 0 } = {}) {
if (allowedFilters.has(saved)) return saved; if (allowedFilters.has(saved)) return saved;
if (today > 0) return 'today'; if (today > 0) return 'today';
if (attention > 0) return 'attention'; if (attention > 0) return 'attention';
if (agenda > 0) return 'agenda';
return 'all'; return 'all';
} }

View File

@ -14,10 +14,11 @@ def test_mobile_launch_selects_priority_queue_without_overriding_saved_choice():
script = f""" script = f"""
const mobileLaunch = require({json.dumps(str(MOBILE_LAUNCH))}); const mobileLaunch = require({json.dumps(str(MOBILE_LAUNCH))});
process.stdout.write(JSON.stringify({{ process.stdout.write(JSON.stringify({{
today: mobileLaunch.chooseFilter({{saved:null, today:2, attention:4}}), today: mobileLaunch.chooseFilter({{saved:null, today:2, attention:4, agenda:6}}),
attention: mobileLaunch.chooseFilter({{saved:null, today:0, attention:4}}), attention: mobileLaunch.chooseFilter({{saved:null, today:0, attention:4, agenda:6}}),
all: mobileLaunch.chooseFilter({{saved:null, today:0, attention:0}}), agenda: mobileLaunch.chooseFilter({{saved:null, today:0, attention:0, agenda:6}}),
saved: mobileLaunch.chooseFilter({{saved:'review', today:2, attention:4}}), all: mobileLaunch.chooseFilter({{saved:null, today:0, attention:0, agenda:0}}),
saved: mobileLaunch.chooseFilter({{saved:'agenda', today:2, attention:4, agenda:6}}),
}})); }}));
""" """
result = subprocess.run(["node", "-e", script], capture_output=True, text=True) result = subprocess.run(["node", "-e", script], capture_output=True, text=True)
@ -26,8 +27,9 @@ process.stdout.write(JSON.stringify({{
assert json.loads(result.stdout) == { assert json.loads(result.stdout) == {
"today": "today", "today": "today",
"attention": "attention", "attention": "attention",
"agenda": "agenda",
"all": "all", "all": "all",
"saved": "review", "saved": "agenda",
} }
@ -64,6 +66,7 @@ async def test_mobile_launch_progressively_discloses_secondary_controls():
service_worker = (Path(__file__).resolve().parents[1] / "frontend" / "service-worker.js").read_text() service_worker = (Path(__file__).resolve().parents[1] / "frontend" / "service-worker.js").read_text()
assert "BASE + 'static/mobile-launch.js'" in service_worker assert "BASE + 'static/mobile-launch.js'" in service_worker
assert "mobileLaunch.chooseFilter" in html assert "mobileLaunch.chooseFilter" in html
assert "agenda: counts.agenda" in html
assert "mobileLaunch.createDisclosure" in html assert "mobileLaunch.createDisclosure" in html
assert "@media (max-width: 600px)" in html assert "@media (max-width: 600px)" in html
assert "header { min-height:56px; max-height:64px;" in html assert "header { min-height:56px; max-height:64px;" in html