Files
corescope-rx/index.html
efiten c2468ee0d2 fix(native): keep the layout clear of the status and navigation bars
The Android app draws edge to edge, so the header sat under the status bar
and the Home/Map/Settings bar under the navigation buttons. index.html now
pads the body and the bottom bar by the system bar insets: Capacitor's
--safe-area-inset-* variables, env(safe-area-inset-*) as fallback, 0 in a
desktop browser. Checked headless at phone width in a browser; not yet on
the phone.
2026-11-10 22:20:04 +01:00

199 lines
13 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>CoreDrive RX — coverage capture</title>
<link rel="manifest" href="/manifest.webmanifest" />
<meta name="theme-color" content="#0f1115" />
<link rel="apple-touch-icon" href="/icon-192.png" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<style>
/* System bars. The Android app draws under the status and navigation bars, and
Capacitor reports their size as --safe-area-inset-* (env() on older WebViews and
on iOS). In a desktop browser all four are 0. */
:root {
--inset-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
--inset-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
--inset-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
--inset-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
}
body { font-family: system-ui, sans-serif; margin: 0; padding: calc(16px + var(--inset-top)) calc(16px + var(--inset-right)) 16px calc(16px + var(--inset-left)); background: #0f1115; color: #e6e6e6; }
h1 { font-size: 18px; }
.card { background: #1a1d24; border: 1px solid #2a2f3a; border-radius: 8px; padding: 12px; margin: 10px 0; }
label { display: block; font-size: 12px; color: #9aa4b2; margin: 6px 0 2px; }
button { width: 100%; padding: 12px; margin-top: 4px; font-size: 15px; border: 0; border-radius: 8px; background: #2ecc71; color: #07120a; font-weight: 600; }
button.danger { background: #e74c3c; color: #fff; }
button:disabled { opacity: .6; }
.btn2 { background: #3b82f6; color: #fff; }
.btn2.on { background: #2ecc71; color: #07120a; }
.stats { display: flex; gap: 16px; font-size: 24px; font-weight: 700; }
.stats div { flex: 1; text-align: center; }
.stats small { display: block; font-size: 11px; color: #9aa4b2; font-weight: 400; }
.muted { font-size: 12px; color: #9aa4b2; margin-top: 6px; }
.progress { margin-top: 10px; font: 12px/1.7 ui-monospace, monospace; }
.progress div { color: #9fe6b8; }
.progress div.pending { color: #9aa4b2; }
.progress div.err { color: #ff8b7a; }
.row { display: flex; gap: 8px; }
.row button { flex: 1; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; color: #e6e6e6; }
label.inline input { width: auto; }
input.txt { width: 100%; box-sizing: border-box; padding: 10px; font-size: 15px; background: #0a0c10; color: #e6e6e6; border: 1px solid #2a2f3a; border-radius: 6px; }
#log { background: #0a0c10; border: 1px solid #2a2f3a; border-radius: 6px; padding: 8px; font: 11px/1.4 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow: auto; margin-top: 8px; }
#log .lg-ok { color: #9fe6b8; } /* captured / published (the data product) */
#log .lg-no { color: #ff8b7a; } /* held back / failed */
#log .lg-st { color: #9aa4b2; } /* status */
#log .lg-tx { color: #e6a23c; } /* our own outbound radio sends (discover / flood) */
.statusstrip { font-size: 12px; color: #9aa4b2; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.statusstrip .udot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #9aa4b2; margin-right: 3px; }
.discstatus { font-size: 12px; margin-top: 4px; min-height: 13px; color: #9aa4b2; }
.lh { font-size: 13px; }
.meter { position: relative; height: 18px; background: #0a0c10; border: 1px solid #2a2f3a; border-radius: 5px; overflow: hidden; margin-top: 6px; }
.meterfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #2ecc71; transition: width .2s linear; }
.meterpeak { position: absolute; top: 0; bottom: 0; width: 2px; background: #fff; left: 0; transition: left .2s linear; }
.meterval { font: 12px ui-monospace, monospace; color: #9aa4b2; margin-top: 4px; }
.recent { display: flex; flex-direction: column; gap: 4px; }
.rr { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: #11141a; border: 1px solid #2a2f3a; border-radius: 6px; font-size: 13px; }
.rr .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rr .rk { font-family: ui-monospace, monospace; }
.rr .rname { flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr .rsnr { margin-left: auto; font-weight: 600; flex: 0 0 auto; }
.rr .rc { color: #9aa4b2; font-size: 11px; min-width: 34px; text-align: right; }
.rg { display: flex; flex-direction: column; gap: 4px; }
.rgrow { padding: 7px 9px; background: #11141a; border: 1px solid #2a2f3a; border-radius: 6px; font-size: 13px; }
.rgrow .rgname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rgrow .rgregions { font-size: 12px; color: #e6e6e6; margin-top: 2px; }
.rgrow .rgregions.none { color: #e6a23c; }
.rgrow .rgunscoped { margin-left: 6px; font-size: 10px; color: #9aa4b2; border: 1px solid #2a2f3a; border-radius: 4px; padding: 0 4px; white-space: nowrap; }
.rgrow .rgwarn { font-size: 11px; color: #ff8b7a; margin-top: 2px; }
body { padding-bottom: calc(70px + var(--inset-bottom)); }
.bottombar { position: fixed; bottom: 0; left: 0; right: 0; height: 56px; padding: 0 var(--inset-right) var(--inset-bottom) var(--inset-left); display: flex; background: #1a1d24; border-top: 1px solid #2a2f3a; z-index: 1000; }
.bottombar .tab { flex: 1; background: transparent; color: #9aa4b2; border: 0; border-radius: 0; margin: 0; font-size: 14px; font-weight: 600; }
.bottombar .tab.active { color: #2ecc71; }
#view-map #liveMap { height: calc(100vh - 140px - var(--inset-top) - var(--inset-bottom)); min-height: 300px; border: 1px solid #2a2f3a; border-radius: 6px; }
</style>
</head>
<body>
<h1>📡 CoreDrive RX <span id="appver" style="font-size:11px;font-weight:400;color:#9aa4b2"></span></h1>
<div class="muted" style="margin-top:-6px;margin-bottom:8px">Mobile RX coverage for CoreScope</div>
<div id="btnotice" style="display:none;background:#3a1414;color:#ff8b7a;border:1px solid #6b2020;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px">⚠️ Web Bluetooth isn't available in this browser. On <b>iOS</b>, open this page in the <b>Bluefy</b> browser; on <b>Android</b>, use <b>Chrome</b>.</div>
<div id="view-home">
<div class="card">
<div class="stats">
<div><span id="cNodes">0</span><small>nodes</small></div>
<div><span id="cHex">0</span><small>hex cells</small></div>
<div><span id="cRx">0</span><small>receptions</small></div>
<div id="cRfLogRow" style="display:none"><span id="cRfLog">0</span><small>RF log</small></div>
</div>
<div class="statusstrip">
<span id="sGps">… no fix</span><span>·</span>
<span id="sPending">0 pending</span><span>·</span>
<span id="sUpload"><span class="udot" id="uDot"></span>upload</span><span>·</span>
<span id="sRate">0 pkt/min</span>
</div>
<div class="discstatus" id="discStatus"></div>
</div>
<div class="card" id="lastHeardCard" style="display:none">
<label>Last reception</label>
<div class="lh" id="lhLine">—</div>
<div class="meter"><div class="meterfill" id="snrFill"></div><div class="meterpeak" id="snrPeak"></div></div>
<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>
<!-- Uplink warning: shown continuously while receptions are being queued but not
uploaded. Red, not amber — the pause chip above is a normal condition, this
one is not. A degraded uplink used to be visible nowhere on this screen. -->
<div id="uplinkchip" style="display:none;background:#3a1414;color:#ff8a80;border:1px solid #6b1212;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px;font-weight:600"></div>
<div id="msgchip" style="display:none;cursor:pointer;background:#10283a;color:#8cc8ff;border:1px solid #1d4a6b;border-radius:8px;padding:10px 12px;margin:10px 0;font-size:13px"></div>
<div class="card">
<label>Recently heard nodes (latest SNR)</label>
<div id="recent" class="recent"><div class="muted">— nothing yet —</div></div>
</div>
<div class="card" id="regionsCard" style="display:none">
<label>Last 5 declared scopes (region discovery)</label>
<div id="regionsList" class="rg"></div>
</div>
</div><!-- /view-home -->
<div id="view-map" style="display:none">
<label>Live coverage (this session) — hexes persist until you reload</label>
<div id="liveMap"></div>
</div>
<div id="view-settings" style="display:none">
<!-- Native app only (src/deployment.js): which CoreDrive RX deployment's
config.json this app uses. The web app always uses its own. -->
<div class="card" id="deployCard" style="display:none">
<label for="deployUrl">Deployment</label>
<input id="deployUrl" class="txt" type="url" inputmode="url" autocapitalize="off" spellcheck="false" placeholder="https://rx.example.org">
<button id="btnDeploy" class="btn2" style="margin-top:8px">Use this deployment</button>
<button id="btnDeployScan" class="btn2" style="margin-top:8px">📷 Scan QR code</button>
<div class="muted" id="deployInfo">The address of the CoreDrive RX web version you upload to. A CoreScope that takes CoreDrive data shows it as a QR code on its Coverage page.</div>
<div class="muted" id="deployMsg" style="color:#ff8b7a"></div>
</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>CoreScope</label>
<div class="muted" id="brokerStatus">— not connected —</div>
<button id="btnPush" class="btn2" style="margin-top:8px">Push pending now</button>
</div>
<!-- CoreScope account (src/account.js). Hidden unless the CoreScope this app
uploads to has user management on, or this companion's uploads are held. -->
<div class="card" id="accountCard" style="display:none">
<label>CoreScope account</label>
<div id="acctOut">
<label for="acctEmail">Email</label>
<input id="acctEmail" class="txt" type="email" autocomplete="username" autocapitalize="off" spellcheck="false">
<label for="acctPassword">Password</label>
<input id="acctPassword" class="txt" type="password" autocomplete="current-password">
<button id="btnLogin" class="btn2" style="margin-top:8px">Log in</button>
</div>
<div id="acctIn" style="display:none">
<div class="muted" id="acctWho"></div>
<div id="acctCompanions" class="recent" style="margin-top:6px"></div>
<button id="btnLogout" class="btn2" style="margin-top:8px">Log out</button>
</div>
<div class="muted" id="acctLink"></div>
<button id="btnLinkRetry" class="btn2" style="display:none;margin-top:8px">Retry</button>
<div class="muted" id="acctHold" style="display:none;color:#e6a23c"></div>
<div class="muted" id="acctMsg" style="color:#ff8b7a"></div>
</div>
<div class="card">
<label>Companion</label>
<div class="muted" id="companionInfo">— not connected —</div>
<div class="muted" id="hashinfo"></div>
</div>
<div class="card">
<label>Capture</label>
<label class="inline"><input type="checkbox" id="chkSound"> Sound ping when a node is mapped</label>
<label class="inline"><input type="checkbox" id="chkMsg"> Notify when a direct message waits on the companion</label>
<label class="inline"><input type="checkbox" id="chkMsgSound"> &hellip; with a sound</label>
</div>
<div class="card">
<label>Diagnostics</label>
<div class="muted" id="fullRfLogInfo" style="display:none">Full RF logging: on</div>
<div class="muted" id="rfSamplerInfo" style="display:none"></div>
<div class="muted" id="regionsInfo" style="display:none"></div>
<label class="inline"><input type="checkbox" id="chkVerbose"> Verbose (raw packet bytes + unattributable frames)</label>
<div class="row" style="margin-top:10px">
<button id="btnDbg" class="btn2">Show debug log</button>
<button id="btnClear" class="btn2">Clear log</button>
</div>
<button id="btnShareLog" class="btn2" style="margin-top:8px">📤 Share / mail debug log</button>
<button id="btnPingNow" class="btn2" style="margin-top:8px;display:none">📡 Uplink ping now</button>
<pre id="log" style="display:none"></pre>
</div>
</div>
<nav class="bottombar">
<button id="tabHome" class="tab active">🏠 Home</button>
<button id="tabMap" class="tab">🗺️ Map</button>
<button id="tabSettings" class="tab">⚙️ Settings</button>
</nav>
<script type="module" src="/src/app.js"></script>
</body>
</html>