From d0e8378a02c158e6d42e21eb2b1b0297c2e19ffb Mon Sep 17 00:00:00 2001 From: timmy Date: Sat, 22 Aug 2026 17:28:29 +0000 Subject: [PATCH] fix: keep first-task coach host visible (Closes #1272) --- frontend/mobile-first-task.js | 5 ++++- tests/test_mobile_first_task.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/frontend/mobile-first-task.js b/frontend/mobile-first-task.js index a96aece..9ba3603 100644 --- a/frontend/mobile-first-task.js +++ b/frontend/mobile-first-task.js @@ -62,7 +62,10 @@ function renderCoach() { if (!options.coach) return; - options.coach.hidden = !(options.mediaQuery.matches && state() === 'coaching' && options.isTodayActive()); + const visible = options.mediaQuery.matches && state() === 'coaching' && options.isTodayActive(); + options.coach.hidden = !visible; + const host = options.coach.closest?.('[data-mobile-today-hud]'); + if (visible && host) host.hidden = false; } function render() { diff --git a/tests/test_mobile_first_task.py b/tests/test_mobile_first_task.py index a071bad..fc2aa5f 100644 --- a/tests/test_mobile_first_task.py +++ b/tests/test_mobile_first_task.py @@ -190,6 +190,26 @@ process.stdout.write(JSON.stringify({offline, calls, sheetOpen:sheet.open})); } +def test_first_task_coaching_reveals_its_mobile_today_host(): + result = run_node( + """ +const values = new Map([['stackchain.first-task.v1:timmy', 'coaching']]); +const host = new Element(); host.hidden = true; +const coach = new Element(); coach.hidden = true; coach.closest = () => host; +const controller = createFirstTask({ + storage:{getItem:key=>values.get(key)||null,setItem:(key,value)=>values.set(key,value)}, + getLogin:()=> 'timmy',hasWork:()=>true,isTodayActive:()=>true,isOnline:()=>true, + mediaQuery:{matches:true},sheet:new Element(),title:new Element(),coach,receipt:new Element(), + findButton:new Element(),createButton:new Element(),setupButton:new Element(),closeButton:new Element(),status:new Element(), +}); +controller.refresh(); +process.stdout.write(JSON.stringify({coachHidden:coach.hidden,hostHidden:host.hidden})); +""" + ) + + assert result == {"coachHidden": False, "hostHidden": False} + + def test_first_task_exposes_completion_operation_before_showing_local_success(): result = run_node( """ -- 2.43.0