fix: keep first-task coach host visible (Closes #1272)
All checks were successful
CI / lint (pull_request) Successful in 3m41s
CI / build-release (pull_request) Successful in 7s
CI / browser-journey (pull_request) Successful in 5m43s
CI / release-candidate (pull_request) Has been skipped

This commit is contained in:
timmy 2026-08-22 17:28:29 +00:00
parent 424ab2bb6d
commit d0e8378a02
2 changed files with 24 additions and 1 deletions

View File

@ -62,7 +62,10 @@
function renderCoach() { function renderCoach() {
if (!options.coach) return; 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() { function render() {

View File

@ -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(): def test_first_task_exposes_completion_operation_before_showing_local_success():
result = run_node( result = run_node(
""" """