Skip to content

Commit 61020cb

Browse files
committed
Enhance zone status handling in slot refresh timer to update UI when moving in and out of zones
1 parent a1e2d51 commit 61020cb

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

content/wardrive.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,11 +1075,19 @@ function startSlotRefreshTimer() {
10751075
const coords = await getValidGpsForZoneCheck();
10761076
if (coords) {
10771077
const result = await checkZoneStatus(coords);
1078-
if (result.success && result.zone) {
1078+
if (result.success && result.in_zone && result.zone) {
1079+
// Still in zone - update slots display
10791080
state.currentZone = result.zone;
10801081
updateSlotsDisplay(result.zone);
10811082
updateMapOnZoneCheck(coords); // Update map and GPS overlay
10821083
debugLog(`[GEO AUTH] [SLOT REFRESH] Updated slots: ${result.zone.slots_available}/${result.zone.slots_max}`);
1084+
} else if (result.success && !result.in_zone) {
1085+
// Moved outside zone - update UI to show outside zone status
1086+
state.currentZone = null;
1087+
state.lastZoneCheckCoords = { lat: coords.lat, lon: coords.lon };
1088+
updateZoneStatusUI(result);
1089+
updateMapOnZoneCheck(coords);
1090+
debugLog(`[GEO AUTH] [SLOT REFRESH] Now outside zone, nearest: ${result.nearest_zone?.name} at ${result.nearest_zone?.distance_km}km`);
10831091
} else if (result && !result.success) {
10841092
// Handle error states (outofdate, etc.) - this will disable button and clear currentZone
10851093
updateZoneStatusUI(result);

0 commit comments

Comments
 (0)