feat: move Connect to Settings, open on Settings until connected, name last reception (v1.3.1)

- Connect/Disconnect (+ progress + status) moves from Home to the Settings tab, so
  the recently-heard list moves up — Home stays a pure monitor.
- The app opens on Settings (where Connect lives) until a companion is connected,
  then jumps to Home; the live monitor is shown only when there's something to watch.
- Last reception shows the resolved node name when available, upgrading from the raw
  ID once names.js resolves it (label derived live each tick).

SW cache v8→v9.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
efitenandClaude Opus 4.8 committed 2026-06-20 15:57:37 +02:00
1 parent ff7e4c0dd7
commit bbf91c2afc
5 files changed
+18 -13

No files matched your search

+3 -2
View File
@@ -46,8 +46,9 @@ phone GPS (gps.js) ────────────────────
receptions), a status strip (GPS accuracy, pending uploads, upload health + last-upload age,
capture rate), the last reception's SNR on a peak-hold meter, and the recently-heard list.
- **🗺️ Map** — live per-cell coverage for this session.
- **⚙️ Settings** — CoreScope broker status + a **Push pending now** button, companion info, and
diagnostics (verbose toggle, debug log, share/mail the log).
- **⚙️ Settings** — the **Connect/Disconnect** button (with connection progress), CoreScope broker
status + a **Push pending now** button, companion info, and diagnostics (verbose toggle, debug log,
share/mail the log). The app opens here until a companion is connected, then jumps to Home.
## Self-hosting (for a CoreScope sysop)
+5 -5
View File
@@ -84,11 +84,6 @@
<div class="meterval" id="snrVal"></div>
</div>
<div id="pausechip" style="display:none;background:#3a2e10;color:#e6a23c;border:1px solid #6b5212;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px;font-weight:600"></div>
<div class="card">
<button id="btnConnect">Connect companion (BLE)</button>
<div class="progress" id="progress"></div>
<div class="muted" id="status"></div>
</div>
<div class="card">
<label>Recently heard nodes (latest SNR)</label>
<div id="recent" class="recent"><div class="muted">— nothing yet —</div></div>
@@ -99,6 +94,11 @@
<div id="liveMap"></div>
</div>
<div id="view-settings" style="display:none">
<div class="card">
<button id="btnConnect">Connect companion (BLE)</button>
<div class="progress" id="progress"></div>
<div class="muted" id="status"></div>
</div>
<div class="card">
<label>CoreScope</label>
<div class="muted" id="brokerStatus">— not connected —</div>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "coredrive-rx",
"version": "1.3.0",
"version": "1.3.1",
"private": false,
"license": "GPL-3.0-or-later",
"type": "module",
+1 -1
View File
@@ -1,7 +1,7 @@
// Minimal service worker: makes the app installable and lets the shell load
// offline. Network-first (always fresh online), cache fallback (offline).
// Only the static app assets go through fetch; MQTT runs over WSS (not cached).
const CACHE = 'coredrive-rx-v8';
const CACHE = 'coredrive-rx-v9';
self.addEventListener('install', () => self.skipWaiting());
self.addEventListener('activate', (e) => e.waitUntil((async () => {
+8 -4
View File
@@ -211,8 +211,10 @@ async function renderStatusStrip() {
function renderLastHeard() {
if (!state.lastHeard) { els('lastHeardCard').style.display = 'none'; return; }
els('lastHeardCard').style.display = 'block';
const { label, at } = state.lastHeard;
els('lhLine').textContent = label + ' — ' + agoText(at, Date.now());
// Derive the label live so it upgrades from ID → resolved name once names.js
// returns (the per-second tick re-renders this).
const { key, at } = state.lastHeard;
els('lhLine').textContent = nodeLabel(key) + ' — ' + agoText(at, Date.now());
}
function renderSnrMeter() {
@@ -280,7 +282,7 @@ async function processFrame(dv) {
state.rxTotal++;
state.rxTimes.push(Date.now());
addNodeKey(state.nodeKeys, hk.heardKey);
state.lastHeard = { label: nodeLabel(hk.heardKey), snr: f.snr, at: Date.now() };
state.lastHeard = { key: hk.heardKey, snr: f.snr, at: Date.now() };
noteSnr(f.snr); // sets bar/peak + colour from the now-current lastHeard
renderCounters();
renderLastHeard();
@@ -425,6 +427,8 @@ async function connectAll() {
state.lastFireAt = 0; // fire a discover sweep immediately on the first tick
state.tick = setInterval(monitorTick, 1000);
log('capturing as ' + (info.name || state.companionPubkey.slice(0, 12)));
switchView('home'); // connected → jump to the live monitor
} catch (e) {
step('✗ ' + e.message, 'err');
dbg('connect failed: ' + e.message, 'no');
@@ -492,7 +496,7 @@ window.addEventListener('DOMContentLoaded', async () => {
els('tabHome').addEventListener('click', () => switchView('home'));
els('tabMap').addEventListener('click', () => switchView('map'));
els('tabSettings').addEventListener('click', () => switchView('settings'));
switchView('home');
switchView(state.connected ? 'home' : 'settings'); // land on Settings (where Connect lives) until connected
// Network came back (e.g. cellular→WiFi handoff) — kick a drain so backlog flushes
// without waiting for the 5 s loop.
window.addEventListener('online', () => { drain().then(refreshCounters).catch(() => {}); });