Puzzle list: each section counts its own stars (#231)

The 'Your stars' box at the top counted only the puzzle packs, yet sat above the architect runs and the weekly puzzle. It moves right above the packs as 'Stars from the packs' (what unlocks the next pack), and the architect runs header shows its own total like a pack does. Weekly rows already show their stars. One label renamed in all six languages.
This commit is contained in:
Frederic Jung 2026-10-31 07:25:57 +01:00
parent 59757c2256
commit 4edd760ff6
No known key found for this signature in database
10 changed files with 27 additions and 8 deletions

View file

@ -128,10 +128,11 @@ function pzMenu(){pzWkEnsure();const p=pzLoad(),tot=pzStarsTotal(p),max=PZ.lengt
<p class="tagline">${tr('puzzles.no_clock_no_bills_real_traffic')}</p>`;
// Once, after the puzzles got traffic: the old stars are kept on the wall, the new set starts at zero.
if(p.old&&!p.noted){h+=`<div class="pznote">🖼️ ${tr('puzzles.puzzles_got_traffic_note',{n:p.old})}</div>`;p.noted=1;pzStore(p);}
h+=`<div class="pzprog"><div class="kv"><span>${tr('puzzles.your_stars')}</span><b>⭐ ${tot} / ${max}</b></div><div class="bar me"><i style="width:${(tot/max*100).toFixed(1)}%"></i></div>${nxP?`<div class="meta">${tr('puzzles.next_pack_unlocks_at_n',{n:nxP.need,pack:esc(nxP.n)})}</div>`:''}${p.old?`<div class="meta">🖼️ ${tr('puzzles.framed_n_stars_from_the_old',{n:p.old})}</div>`:''}</div>`;
if(pzOn())h+=`<div class="btns" style="margin:8px 0">${(UI.pzTop||0)>0&&(UI.pzTop||0)<3?btn(tr('puzzles.finish_here'),'pzFinish',{},'sm'):''}${btn(UI.pzFrom==='game'?tr('puzzles.back_to_my_network'):tr('puzzles.back_to_the_title'),'pzLeave',{},'')}${btn(tr('puzzles.keep_building'),'closeModal',{},'ghost')}</div>`;
h+=arMenuRows();
h+=pzWkRow();
// The packs' own total, right above them: it is what unlocks the next pack (#231). Runs and weeklies count their own.
h+=`<div class="pzprog"><div class="kv"><span>${tr('puzzles.stars_from_the_packs')}</span><b>⭐ ${tot} / ${max}</b></div><div class="bar me"><i style="width:${(tot/max*100).toFixed(1)}%"></i></div>${nxP?`<div class="meta">${tr('puzzles.next_pack_unlocks_at_n',{n:nxP.need,pack:esc(nxP.n)})}</div>`:''}${p.old?`<div class="meta">🖼️ ${tr('puzzles.framed_n_stars_from_the_old',{n:p.old})}</div>`:''}</div>`;
for(const pk of PZ_PACKS){const open=tot>=pk.need,got=PZ.filter(x=>x.pack===pk.id).reduce((a,x)=>a+((p.s[x.id]||{}).st|0),0),n=PZ.filter(x=>x.pack===pk.id).length;
h+=`<h3 class="pzpack">${open?'':'🔒 '}${esc(pk.n)} <span class="meta">⭐ ${got}/${n*3}</span></h3><p class="meta" style="margin:0 0 2px">${open?esc(pk.d):tr('puzzles.unlocks_at_n_stars',{n:pk.need})}</p>`;
for(const d of PZ.filter(x=>x.pack===pk.id)){const r=p.s[d.id],tg=pzDemTag(d);

View file

@ -75,7 +75,7 @@ function arResults(done){const A=S.ar,run=arRun(),sp=arSpend(),br=done?run.brief
<div class="btns cta" style="margin-top:12px">${nx&&done?btn(tr('architect.next_run')+' →','pzArStart',{id:nx.id},'pink big'):btn(tr('puzzles.more_puzzles'),'puzzleMenu',{},'pink big')}${btn(tr('architect.try_again'),'pzRetry',{},'')}${done?btn(tr('common.share_2cd9'),'pzShare',{},'ghost'):btn(tr('architect.keep_going'),'closeModal',{},'ghost')}</div></div>`);
for(let i=0;i<st;i++)setTimeout(()=>{sfx('star');haptic(15);},i*450+150);if(st>=3)setTimeout(()=>sfx('fanfare'),3*450+250);}
// ---------- the list ----------
function arMenuRows(){const p=arLoad();let h=`<h3 class="pzpack">🏗️ ${tr('architect.architect_runs')} <span class="pznew">${tr('architect.new')}</span></h3><p class="meta" style="margin:0 0 2px">${tr('architect.runs_lead')}</p>`;arWkEnsure();h+=arWkRow();
function arMenuRows(){const p=arLoad(),got=AR_RUNS.reduce((a,r)=>a+((p.runs[r.id]||{}).st|0),0);let h=`<h3 class="pzpack">🏗️ ${tr('architect.architect_runs')} <span class="meta">⭐ ${got}/${AR_RUNS.length*3}</span> <span class="pznew">${tr('architect.new')}</span></h3><p class="meta" style="margin:0 0 2px">${tr('architect.runs_lead')}</p>`;arWkEnsure();h+=arWkRow();
for(const r of AR_RUNS){const x=p.runs[r.id];
h+=`<div class="scn"><div class="grow"><div class="nm">${esc(r.n)} <span class="pzst">${pzStarStr(x?x.st:0)}</span></div><div class="meta">${esc(r.j)}</div><div class="meta">${tr('architect.n_briefs',{n:r.briefs.length})} · 🏠 ${esc(CITY[r.hq].name)}${' · '+tr('puzzles.budget_x',{x:fmt$(r.budget)})}${x&&x.sp!=null?' · '+tr('puzzles.best_x',{x:fmt$(x.sp)}):x&&x.br?' · '+tr('architect.best_n_briefs',{n:x.br}):''}</div></div>${btn(tr('common.play'),'pzArStart',{id:r.id},x&&x.st>=3?'ghost':'pink')}</div>`;}
return h;}

View file

@ -3146,6 +3146,7 @@
"puzzles.small_networks_real_traffic":"Small networks, real traffic",
"puzzles.spent_x":"Spent {x}",
"puzzles.spent_x_of_y":"Spent {x} / {y}",
"puzzles.stars_from_the_packs":"Stars from the packs",
"puzzles.stepping_stone_optional":"Stepping stone (optional)",
"puzzles.suez_you_later":"Suez You Later",
"puzzles.survive_any_single_cut_with_the":"Survive any single cut, with the traffic still flowing. Connected is not enough.",
@ -3171,7 +3172,6 @@
"puzzles.with_the_pop_price":"with the POP: {price}",
"puzzles.your_pop":"Your POP",
"puzzles.your_routers_pick_the_path":"Your routers pick the path. Tell them which: metrics, lowest latency, best effort.",
"puzzles.your_stars":"Your stars",
"puzzles.your_stars_so_far":"Your stars so far",
"puzzles_weekly.detour":"Detour",
"puzzles_weekly.island_hopping":"Island hopping",