Skip to content

Commit d684a8b

Browse files
committed
Remove zone status display from connection bar and update documentation for status messages
1 parent d9aeaeb commit d684a8b

3 files changed

Lines changed: 54 additions & 88 deletions

File tree

content/wardrive.js

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ setConnStatus("Disconnected", STATUS_COLORS.error);
185185
const intervalSelect = $("intervalSelect"); // 15 / 30 / 60 seconds
186186
const powerSelect = $("powerSelect"); // "", "0.3w", "0.6w", "1.0w"
187187
const deviceModelEl = $("deviceModel");
188-
const zoneStatus = $("zoneStatus"); // Zone status in connection bar
188+
// Zone status removed from connection bar - only shown in settings panel (locationDisplay)
189189
const locationDisplay = $("locationDisplay"); // Location (zone code) in settings
190190
const slotsDisplay = $("slotsDisplay"); // Slot availability in settings
191191

@@ -882,8 +882,6 @@ function updateZoneStatusUI(zoneData) {
882882

883883
if (!zoneData) {
884884
debugWarn(`[GEO AUTH] [UI] No zone data provided, setting error state`);
885-
zoneStatus.textContent = "Zone check failed";
886-
zoneStatus.className = "text-xs text-red-400";
887885
locationDisplay.textContent = "Unknown";
888886
locationDisplay.className = "font-medium text-red-400";
889887
updateSlotsDisplay(null);
@@ -894,7 +892,6 @@ function updateZoneStatusUI(zoneData) {
894892
if (zoneData.success && zoneData.in_zone) {
895893
const zone = zoneData.zone;
896894
const atCapacity = zone.at_capacity;
897-
const slotsText = `Zone: ${zone.code}`;
898895
const statusColor = atCapacity ? "text-amber-300" : "text-emerald-300";
899896

900897
// Clear persistent outside zone error if it was set
@@ -904,11 +901,8 @@ function updateZoneStatusUI(zoneData) {
904901
setDynamicStatus("—", STATUS_COLORS.idle); // Clear the dynamic status bar
905902
}
906903

907-
zoneStatus.textContent = slotsText;
908-
zoneStatus.className = `text-xs ${statusColor}`;
909-
910904
locationDisplay.textContent = zone.code;
911-
locationDisplay.className = "font-medium text-emerald-300";
905+
locationDisplay.className = `font-medium ${statusColor}`;
912906

913907
updateSlotsDisplay(zone);
914908

@@ -921,10 +915,6 @@ function updateZoneStatusUI(zoneData) {
921915
const nearest = zoneData.nearest_zone;
922916
const distText = `Outside zone (${nearest.distance_km}km to ${nearest.code})`;
923917

924-
// Clear zone status in connection bar (don't show distance there)
925-
zoneStatus.textContent = "";
926-
zoneStatus.className = "text-xs text-slate-400";
927-
928918
// Set persistent outside zone error - blocks all other dynamic status messages
929919
statusMessageState.outsideZoneError = distText;
930920
debugLog(`[GEO AUTH] [UI] Set persistent outside zone error: "${distText}"`);
@@ -956,24 +946,27 @@ function updateZoneStatusUI(zoneData) {
956946
statusText = "GPS: inaccurate";
957947
} else if (reason === "outofdate") {
958948
// App version outdated - show persistent error in dynamic status bar
959-
statusText = ""; // Clear zone status in connection bar
949+
statusText = ""; // Clear location display
960950
dynamicStatusText = zoneData.message || "App version outdated, please update";
961951

962952
// Set persistent error - blocks all other dynamic status messages
963953
statusMessageState.outsideZoneError = dynamicStatusText;
964-
debugLog(`[GEO AUTH] [UI] Set persistent outofdate error: "${dynamicStatusText}"`);
954+
debugLog(`[GEO AUTH] Set persistent outofdate error: "${dynamicStatusText}"`);
965955

966956
// Show error in dynamic status bar (red)
967957
setDynamicStatus(dynamicStatusText, STATUS_COLORS.error);
968958

969-
// Log as error
970-
debugError(`[GEO AUTH] [UI] ${dynamicStatusText}`);
959+
// Disable Connect button - can't use app with outdated version
960+
setConnectButtonDisabled(true);
961+
962+
// Clear current zone to stop slot refresh timer from running
963+
state.currentZone = null;
964+
965+
// Log as error (single consolidated message)
966+
debugError(`[GEO AUTH] ${dynamicStatusText}`);
971967
}
972968

973-
zoneStatus.textContent = statusText;
974-
zoneStatus.className = "text-xs text-red-400";
975-
976-
locationDisplay.textContent = "Unknown";
969+
locationDisplay.textContent = statusText || "Unknown";
977970
locationDisplay.className = "font-medium text-red-400";
978971

979972
updateSlotsDisplay(null);
@@ -1027,10 +1020,10 @@ async function performAppLaunchZoneCheck() {
10271020
setConnectButtonDisabled(true);
10281021
debugLog("[GEO AUTH] [INIT] Connect button disabled during zone check");
10291022

1030-
// Show "Checking zone..." status
1031-
zoneStatus.textContent = "Checking zone...";
1032-
zoneStatus.classList.remove("hidden");
1033-
debugLog("[GEO AUTH] [INIT] Zone status set to 'Checking zone...'");
1023+
// Show "Checking zone..." in location display
1024+
locationDisplay.textContent = "Checking...";
1025+
locationDisplay.className = "font-medium text-slate-400";
1026+
debugLog("[GEO AUTH] [INIT] Location display set to 'Checking...'");
10341027

10351028
try {
10361029
// Get valid GPS coordinates
@@ -1109,6 +1102,10 @@ async function performAppLaunchZoneCheck() {
11091102
state.currentZone = result.zone;
11101103
updateSlotsDisplay(result.zone);
11111104
debugLog(`[GEO AUTH] [SLOT REFRESH] Updated slots: ${result.zone.slots_available}/${result.zone.slots_max}`);
1105+
} else if (result && !result.success) {
1106+
// Handle error states (outofdate, etc.) - this will disable button and clear currentZone
1107+
updateZoneStatusUI(result);
1108+
debugLog(`[GEO AUTH] [SLOT REFRESH] Zone check failed, updated UI`);
11121109
}
11131110
}
11141111
}
@@ -1893,7 +1890,10 @@ async function checkZoneStatus(coords) {
18931890
} else if (data.success && !data.in_zone) {
18941891
debugLog(`[GEO AUTH] ⚠️ Outside all zones, nearest: ${data.nearest_zone.name} (${data.nearest_zone.code}) at ${data.nearest_zone.distance_km}km`);
18951892
} else if (!data.success) {
1896-
debugError(`[GEO AUTH] ❌ Zone check failed: reason=${data.reason}, message=${data.message}`);
1893+
// Only log non-outofdate failures here (outofdate logged in updateZoneStatusUI)
1894+
if (data.reason !== "outofdate") {
1895+
debugError(`[GEO AUTH] ❌ Zone check failed: reason=${data.reason}, message=${data.message}`);
1896+
}
18971897
}
18981898

18991899
return data;
@@ -5529,6 +5529,10 @@ async function disconnect() {
55295529
state.currentZone = result.zone;
55305530
updateSlotsDisplay(result.zone);
55315531
debugLog(`[GEO AUTH] [SLOT REFRESH] Updated slots: ${result.zone.slots_available}/${result.zone.slots_max}`);
5532+
} else if (result && !result.success) {
5533+
// Handle error states (outofdate, etc.) - this will disable button and clear currentZone
5534+
updateZoneStatusUI(result);
5535+
debugLog(`[GEO AUTH] [SLOT REFRESH] Zone check failed, updated UI`);
55325536
}
55335537
}
55345538
}

docs/STATUS_MESSAGES.md

Lines changed: 25 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -243,88 +243,51 @@ These messages appear in the Dynamic App Status Bar. They NEVER include connecti
243243

244244
**Phase 4.1 Scope**: Zone checks provide **preflight UI feedback** while disconnected. Real validation happens server-side in Phase 4.2+ via `/auth` (connect) and `/wardrive` (ongoing) endpoints.
245245

246-
**Note**: Zone status appears in **two locations**:
247-
- **Connection Bar** (`#zoneStatus`): Visible when disconnected, hidden when connected
248-
- **Settings Panel** (`#locationDisplay`): Always visible with full zone name
246+
**Note**: Zone status appears in the **Settings Panel** (`#locationDisplay`) only. Errors (outside zone, outdated app) appear as persistent messages in the **Dynamic Status Bar**.
249247

250-
##### Checking zone...
251-
- **Message (Connection Bar)**: `"Checking zone..."`
248+
##### Checking...
252249
- **Message (Settings Panel)**: `"Checking..."`
253-
- **Color**: Amber (warning)
250+
- **Color**: Gray (slate-400)
254251
- **When** (Phase 4.1 - disconnected mode only):
255252
- During app launch zone check (before Connect button enabled)
256253
- After 100m GPS movement while disconnected triggers zone recheck
257-
- **Display**:
258-
- Connection bar: Orange/amber "Checking zone..."
259-
- Settings panel: Gray "Checking..."
260254
- **Source**: `content/wardrive.js:performAppLaunchZoneCheck()`, `handleZoneCheckOnMove()`
261255

262-
##### Zone: [code]
263-
- **Message (Connection Bar)**: `"Zone: YOW"` (or other zone code)
264-
- **Message (Settings Panel)**: `"Ottawa, ON"` (full zone name)
265-
- **Color**: Green (success) in connection bar, white in settings panel
256+
##### Zone Code (e.g., YOW)
257+
- **Message (Settings Panel)**: `"YOW"` (or other zone code)
258+
- **Color**: Green (emerald-300) when available, Amber (amber-300) when at capacity
266259
- **When**: Successfully validated location within enabled wardriving zone (Phase 4.1 preflight check)
267-
- **Display**:
268-
- Connection bar: Green "Zone: YOW" (when disconnected)
269-
- Settings panel: White "Ottawa, ON" (always visible)
270260
- **Source**: `content/wardrive.js:updateZoneStatusUI()`
271261

272-
##### Outside zone
273-
- **Message (Connection Bar)**: `"Outside zone"`
274-
- **Message (Settings Panel)**: `"Outside zone"`
275-
- **Color**: Red (error)
262+
##### Outside zone (distance to nearest)
263+
- **Message (Dynamic Status Bar)**: `"Outside zone (Xkm to CODE)"`
264+
- **Message (Settings Panel)**: `"—"` (dash)
265+
- **Color**: Red (error) - persistent message
276266
- **When**:
277267
- **Phase 4.1**: GPS coordinates outside any enabled wardriving zone boundary (preflight check, Connect button disabled)
278-
- **Phase 4.2+**: Server-side validation failure from `/auth` or `/wardrive` endpoint (triggers disconnect)
279-
- **Terminal State**: Yes (Connect button disabled in Phase 4.1, disconnect triggered in Phase 4.2+)
268+
- **Terminal State**: Yes (Connect button disabled, persistent error blocks other status messages)
280269
- **Source**: `content/wardrive.js:updateZoneStatusUI()`
281270

282-
##### Zone disabled
283-
- **Message (Connection Bar)**: `"Zone disabled"`
284-
- **Message (Settings Panel)**: `"Disabled"`
285-
- **Color**: Red (error)
286-
- **When**:
287-
- **Phase 4.1**: Location within zone boundary but zone is not enabled for wardriving (preflight check, Connect button disabled)
288-
- **Phase 4.2+**: Server-side validation failure from `/auth` or `/wardrive` endpoint (triggers disconnect)
289-
- **Terminal State**: Yes (Connect button disabled in Phase 4.1, disconnect triggered in Phase 4.2+)
290-
- **Source**: `content/wardrive.js:updateZoneStatusUI()`, disconnect reason handling (Phase 4.2+)
291-
292-
##### Zone at capacity
293-
- **Message (Connection Bar)**: `"At capacity"`
294-
- **Message (Settings Panel)**: `"At capacity"`
295-
- **Color**: Red (error)
296-
- **When**:
297-
- **Phase 4.1**: Zone has reached maximum concurrent wardriver limit during preflight check (Connect button disabled)
298-
- **Phase 4.2+**: Server-side capacity limit from `/auth` or `/wardrive` endpoint (triggers disconnect)
299-
- **Terminal State**: Yes (Connect button disabled in Phase 4.1, disconnect triggered in Phase 4.2+)
300-
- **Notes**: Different from "MeshMapper at capacity" - this is zone-specific capacity, not global server capacity
301-
- **Source**: `content/wardrive.js:updateZoneStatusUI()`, disconnect reason handling (Phase 4.2+)
302-
303-
##### GPS unavailable
304-
- **Message (Connection Bar)**: `"GPS unavailable"`
305-
- **Message (Settings Panel)**: `"GPS unavailable"`
271+
##### GPS/Zone Errors
272+
- **Message (Settings Panel)**: `"GPS: stale"`, `"GPS: inaccurate"`, `"Unknown"`
306273
- **Color**: Red (error)
307274
- **When** (Phase 4.1 client-side GPS failure):
308-
- GPS permissions denied
309-
- GPS data too stale (>60s)
310-
- GPS accuracy too poor (>50m)
311-
- Failed to acquire GPS after 3 retries
275+
- GPS data too stale (>60s) → "GPS: stale"
276+
- GPS accuracy too poor (>50m) → "GPS: inaccurate"
277+
- GPS permissions denied or network error → "Unknown"
312278
- **Terminal State**: Yes (Connect button disabled)
313-
- **Source**: `content/wardrive.js:getValidGpsForZoneCheck()`, `updateZoneStatusUI()`
279+
- **Source**: `content/wardrive.js:updateZoneStatusUI()`
314280

315-
##### Zone check failed
316-
- **Message (Connection Bar)**: `"Zone check failed"`
317-
- **Message (Settings Panel)**: `"Check failed"`
318-
- **Color**: Red (error)
319-
- **When** (Phase 4.1 network error):
320-
- Network error contacting zone check API (`/status` endpoint)
321-
- Zone check API returned error
322-
- Exception during zone check process
323-
- **Terminal State**: Yes (Connect button disabled)
324-
- **Source**: `content/wardrive.js:checkZoneStatus()`, `updateZoneStatusUI()`
281+
##### App Version Outdated
282+
- **Message (Dynamic Status Bar)**: API message or `"App version outdated, please update"`
283+
- **Message (Settings Panel)**: `""` (empty)
284+
- **Color**: Red (error) - persistent message
285+
- **When**: Server returns `reason: "outofdate"` during zone check
286+
- **Terminal State**: Yes (Connect button disabled, persistent error blocks other status messages)
287+
- **Source**: `content/wardrive.js:updateZoneStatusUI()`
325288

326289
**Slot Availability Display** (Settings Panel only):
327-
- **Location**: Settings panel "Status Info" section, right side of Location row
290+
- **Location**: Settings panel "Status Info" section, Slots row
328291
- **Display Format**:
329292
- `"N/A"` (gray) - Zone not checked yet or check failed
330293
- `"X available"` (green) - X slots available in zone

index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ <h1 class="flex items-center gap-2 text-lg sm:text-xl font-semibold truncate min
5050
<div class="flex items-center gap-2 text-sm">
5151
<span id="statusIndicator" class="text-base text-red-400"></span>
5252
<span id="connectionStatus" class="font-medium text-red-300">Disconnected</span>
53-
<span id="zoneStatus" class="text-xs text-slate-400"></span>
5453
</div>
5554
<div class="flex items-center gap-3">
5655
<span id="noiseDisplay" class="text-sm text-slate-300"></span>

0 commit comments

Comments
 (0)