$ steps through the open offers, soonest to expire first

$ moves the map to the next offer's city, in the Deals list's order,
opens the Customers tab on a POP and marks the offer under Offers here
(UI.offerAt, the existing .row.on style). Two offers in one city each
get a press; any other selection clears the mark. With nothing on the
table it says so with the Deals tab's own "No open offers" text.
This commit is contained in:
Charlie Allom 2026-11-03 10:47:51 +00:00
parent daec638bfc
commit 3192f42b5a
No known key found for this signature in database
13 changed files with 44 additions and 9 deletions

View file

@ -49,6 +49,10 @@ const ACT={
findGo:({city})=>{if(!isCity(city))return;closeModal();$('dash').hidden=true;ACT.focusCity({city});},
focusCity:({city})=>{selectCity(city);const C=CITY[city];cam.x=C.x;cam.y=C.y;cam.z=Math.max(cam.z,1.2);if(innerWidth<760)UI.leftOpen=false;renderLeft();},
popStep:({d})=>{const L=popOrder(),n=L.length;if(!n)return;const i=UI.sel&&UI.sel.type==='city'?L.indexOf(UI.sel.id):-1;$('dash').hidden=true;ACT.focusCity({city:L[i<0?(d>0?0:n-1):(i+(d>0?1:n-1))%n]});},
// The offer stays marked in its city's Offers here until something else is selected, so two offers in one city each get a press.
offerStep:()=>{const L=offerOrder(),n=L.length;if(!n){toast(tr('hud_and_panels.no_open_offers_right_now_businesses'));return;}
const i=L.findIndex(o=>o.id===UI.offerAt),o=L[(i+1)%n];$('dash').hidden=true;ACT.focusCity({city:o.city});UI.offerAt=o.id;if(S.pops[o.city])UI.tab='cust';renderPanel();
const r=document.querySelector('#panelBody .row.on');if(r&&r.scrollIntoView)r.scrollIntoView({block:'nearest'});},
zoomStep:({d})=>zoomAt(CW/2,CH/2,d>0?1.25:0.8),
keys:()=>showKeys(),
selLink:({id})=>{selectLink(id);focusLink(id);},

View file

@ -46,5 +46,5 @@ function focusLink(id){if(pzOn())return;const l=S.links.find(x=>x.id===id);if(!l
// Phones leave a thin strip above the sheet: a fixed margin would eat most of it.
const m=(a,b)=>Math.max(40,b-a-Math.min(100,(b-a)*0.3)),fw=m(fl,fr),fh=m(ft,fb),z=clamp(Math.min(fw/Math.max(1,x1-x0),fh/Math.max(1,y1-y0),Math.max(cam.z,1.2)),ZMIN,ZMAX);
cam.z=z;cam.x=(x0+x1)/2-((fl+fr)/2-CW/2)/z;cam.y=(y0+y1)/2-((ft+fb)/2-CH/2)/z;wrapCam();}
function selectCity(c){UI.sel={type:'city',id:c};UI.confirm=null;if(isTablet()||isPhone())UI.leftOpen=false;const P=$('panel');if(P)P.classList.remove('full');if(!S.pops[c])UI.tab='cust';renderPanel();}
function selectCity(c){UI.sel={type:'city',id:c};UI.confirm=null;UI.offerAt=null;if(isTablet()||isPhone())UI.leftOpen=false;const P=$('panel');if(P)P.classList.remove('full');if(!S.pops[c])UI.tab='cust';renderPanel();}