From d0857e4018447d064b3cb465bd963f2e09101216 Mon Sep 17 00:00:00 2001 From: Danny Date: Mon, 16 Nov 2026 12:37:38 -0800 Subject: [PATCH] Networks: Tidy Page --- .../starpilot/galaxy/tests/test_networks.mjs | 6 ++ .../starpilot/galaxy/web/css/settings.css | 13 ++++ openpilot/starpilot/galaxy/web/js/hotspot.js | 54 +++++++++------- openpilot/starpilot/galaxy/web/js/networks.js | 63 ++++++++++++------- 4 files changed, 89 insertions(+), 47 deletions(-) diff --git a/openpilot/starpilot/galaxy/tests/test_networks.mjs b/openpilot/starpilot/galaxy/tests/test_networks.mjs index 2c8788ff2d..9a924af03d 100644 --- a/openpilot/starpilot/galaxy/tests/test_networks.mjs +++ b/openpilot/starpilot/galaxy/tests/test_networks.mjs @@ -22,6 +22,12 @@ vm.active = true vm.adopt(value) assert.equal(vm.signalText(value.networks[0]), 'Connected') assert.equal(vm.signalText(value.networks[1]), 'In range, signal 60%') +assert.equal(vm.networkSummary(value.networks[0]), 'Connected · Auto-join') +assert.equal(vm.isOpen(value.networks[0]), false) +vm.toggleNetwork(first) +assert.equal(vm.isOpen(value.networks[0]), true) +vm.toggleNetwork(first) +assert.equal(vm.isOpen(value.networks[0]), false) const sent = [] globalThis.fetch = async (_url, options) => { sent.push(options?.body ? JSON.parse(options.body) : null); return { ok: true, json: async () => value } } await vm.move(1, -1) diff --git a/openpilot/starpilot/galaxy/web/css/settings.css b/openpilot/starpilot/galaxy/web/css/settings.css index a8511f2c5a..3b98c71a18 100644 --- a/openpilot/starpilot/galaxy/web/css/settings.css +++ b/openpilot/starpilot/galaxy/web/css/settings.css @@ -911,3 +911,16 @@ html.gx-maker-open, html.gx-maker-open body { touch-action: manipulation; } .gx-sentry-status .gx-status-dot { flex: none; background: currentColor; } .gx-sentry-status--armed .gx-status-dot { background: var(--success); } .gx-sentry-status--warning .gx-status-dot { background: var(--warning); } +.gx-networks > .gx-card { margin-bottom: 0; } +.gx-networks__caption { margin: 0; padding: var(--sp-2) var(--sp-4) var(--sp-3); border-top: 1px solid var(--outline); } +.gx-networks__toggle { border: 0; padding: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; } +.gx-networks__toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: var(--radius-sm); } +.gx-networks__details { background: rgba(255, 255, 255, 0.015); box-shadow: inset 3px 0 var(--primary); } +.gx-networks__details > .gx-row { padding-left: calc(var(--sp-4) + var(--sp-2)); } +.gx-hotspot__controls { flex: 1 1 260px; justify-content: flex-end; } +.gx-hotspot__field { flex: 1 1 160px; max-width: 240px; } +.gx-hotspot__details { padding: var(--sp-3) var(--sp-4); } +@media (max-width: 600px) { + .gx-hotspot__field { max-width: none; } + .gx-hotspot__controls { justify-content: stretch; } +} diff --git a/openpilot/starpilot/galaxy/web/js/hotspot.js b/openpilot/starpilot/galaxy/web/js/hotspot.js index de6523152c..c4eed55c19 100644 --- a/openpilot/starpilot/galaxy/web/js/hotspot.js +++ b/openpilot/starpilot/galaxy/web/js/hotspot.js @@ -83,34 +83,42 @@ export const GalaxyHotspot = { } }, }, - template: `
Galaxy Wi-Fi Hotspot
-

Local Galaxy access for iPhone and Android. No Android Auto, Bluetooth browser support, or cellular connection needed.

+ template: `
Galaxy Wi-Fi Hotspot{{ snapshot.config.ssid }}
Connect to your comma to configure the hotspot. Loading hotspot settings… -
    -
  • Starts automatically when enabled. Needs the comma on and Wi-Fi available.
  • -
  • Works standalone, or shares the channel of connected Wi-Fi or Android Auto.
  • -
  • Local access without Internet; no Internet sharing.
  • -
  • Network or channel changes may interrupt access. Changing the password or disabling the hotspot disconnects phones.
  • -
  • The public galaxy.firestar.link address still needs Internet and its tunnel.
  • -
- {{ saveError || error }}{{ notice }} + {{ saveError || error }}{{ notice }}
`, } diff --git a/openpilot/starpilot/galaxy/web/js/networks.js b/openpilot/starpilot/galaxy/web/js/networks.js index 9c46ec0c31..f69f32274e 100644 --- a/openpilot/starpilot/galaxy/web/js/networks.js +++ b/openpilot/starpilot/galaxy/web/js/networks.js @@ -21,7 +21,7 @@ export const NetworksPage = { name: "NetworksPage", components: { GxNotice, GxState, GalaxySettingRow, GalaxyHotspot }, props: { mode: { type: String, required: true }, unauthorized: { type: Function, required: true } }, - data: () => ({ snapshot: null, busy: false, error: '', timer: null, controller: null, generation: 0, active: false }), + data: () => ({ snapshot: null, busy: false, error: '', openUuid: null, timer: null, controller: null, generation: 0, active: false }), computed: { linkName() { return LINKS[this.snapshot?.link.link] || 'Unknown' }, changed() { @@ -30,7 +30,7 @@ export const NetworksPage = { }, cellularDetail() { const cellular = this.snapshot.cellular - if (!cellular.enabled) return 'Cellular data is off. The comma only goes online over Wi-Fi.' + if (!cellular.enabled) return 'Off · comma goes online over Wi-Fi only.' return cellular.connected ? `Connected${cellular.operator ? ' to ' + cellular.operator : ''}${cellular.type ? ' (' + cellular.type.toUpperCase() + ')' : ''}.` : 'Not connected right now.' }, }, @@ -40,10 +40,18 @@ export const NetworksPage = { methods: { switchRow, choiceRow, start() { if (this.mode === 'local') { this.active = true; this.refresh() } }, - stop() { this.active = false; this.generation++; clearTimeout(this.timer); this.controller?.abort(); this.snapshot = null; this.busy = false }, + stop() { this.active = false; this.generation++; clearTimeout(this.timer); this.controller?.abort(); this.snapshot = null; this.openUuid = null; this.busy = false }, adopt(value) { if (!validNetworks(value)) throw new Error('Invalid network status') this.snapshot = value + if (this.openUuid && !value.networks.some(n => n.uuid === this.openUuid)) this.openUuid = null + }, + isOpen(network) { return this.openUuid === network.uuid || this.snapshot?.networks.length === 1 }, + toggleNetwork(uuid) { this.openUuid = this.openUuid === uuid ? null : uuid }, + networkSummary(network) { + const parts = [this.signalText(network), network.autoJoin ? (network.whileDriving ? 'Auto-join' : 'Parked only') : 'Manual'] + if (network.metered !== 'Auto') parts.push(network.metered) + return parts.join(' · ') }, async refresh() { if (!this.active || this.busy) return @@ -94,40 +102,47 @@ export const NetworksPage = { return network.signal == null ? 'Not in range' : `In range, signal ${network.signal}%` }, }, - template: `
+ template: `
+

Networks

Wi-Fi priority, cellular data, and local hotspot access.

Connect to your comma to manage its networks. Loading network settings… {{ error }} - -
`, + +
`, }