From 7d0f9f677f762ae6257020ee31fa2099b29bcffb Mon Sep 17 00:00:00 2001 From: Denis Groshev Date: Tue, 17 Nov 2026 16:47:29 +0100 Subject: [PATCH] Smaller review items: comment placement, dead helpers, locale clock, LIVE republish, STATION keyboard and touch - getLiveSubjectKeys no longer sits between trackById's comment and body. - issCommandSunPoses and issCommandStatusText go: nothing called them. - The STATION section's 'no signal since' time is formatted in the app's locale (formatDate), not the browser's. - LiveControls sends an unchanged view only once: the 2 s refresh resends nothing (tested). - The STATION mode radios take arrow keys and keep only the checked one in the tab order; the LIVE stream arrows are 44 px on a coarse pointer. --- src/layers/satellites/controls.js | 12 +++++----- src/layers/satellites/issCommand.js | 27 ----------------------- src/layers/satellites/issCommand.test.mjs | 8 ------- src/ui/liveControls.js | 14 ++++++++++-- src/ui/liveControls.test.mjs | 12 ++++++++++ src/ui/styles/live.css | 6 +++++ src/ui/views/panels/StationPanel.vue | 19 +++++++++++----- 7 files changed, 50 insertions(+), 48 deletions(-) diff --git a/src/layers/satellites/controls.js b/src/layers/satellites/controls.js index e6172e6842..8959a2e662 100644 --- a/src/layers/satellites/controls.js +++ b/src/layers/satellites/controls.js @@ -440,12 +440,6 @@ export function createControls({ state: layerState, services, parts, source }) { return result; }, - /** - * Track a satellite by NORAD id (camera follow + orbit path + highlight), - * same path as clicking its point. - * @param {string|number} noradId NORAD catalog number. - * @returns {boolean} True if tracking started. - */ /** * The keys the LIVE section matches streams by for the tracked * satellite: a station is `station:` (`station:iss`, @@ -458,6 +452,12 @@ export function createControls({ state: layerState, services, parts, source }) { return station ? [`station:${station.key}`] : []; }, + /** + * Track a satellite by NORAD id (camera follow + orbit path + highlight), + * same path as clicking its point. + * @param {string|number} noradId NORAD catalog number. + * @returns {boolean} True if tracking started. + */ trackById(noradId, { origin = 'programmatic' } = {}) { const id = Number(noradId); if ( diff --git a/src/layers/satellites/issCommand.js b/src/layers/satellites/issCommand.js index 15b34e1a64..3b2bdd0aa1 100644 --- a/src/layers/satellites/issCommand.js +++ b/src/layers/satellites/issCommand.js @@ -5,36 +5,9 @@ const unit = (v) => { return v.map((c) => c / n); }; -/** - * The Sun positions Manual offers, on the model's axes (port, zenith, - * forward), and whether the station is lit there. - * @returns {Array<{label: string, sun: number[], sunlit: boolean}>} - */ -export function issCommandSunPoses() { - return [ - { label: t('Overhead'), sun: [0, 1, 0], sunlit: true }, - { label: t('Ahead'), sun: unit([0, 0.05, 1]), sunlit: true }, - { label: t('Behind'), sun: unit([0, 0.05, -1]), sunlit: true }, - { label: t('Below'), sun: unit([0, -1, 0.05]), sunlit: true }, - { label: t('Port side'), sun: unit([0.8, 0.5, 0.3]), sunlit: true }, - { label: t('Starboard side'), sun: unit([-0.8, 0.5, 0.3]), sunlit: true }, - { label: t('Night (shadow)'), sun: [0, -1, 0], sunlit: false }, - ]; -} - /** Where "Zoom to the ISS" stops: the whole 109 m station fills the view. */ export const ISS_COMMAND_ZOOM_RANGE_M = 260; -/** - * The Automatic mode's status line. - * @param {boolean|null} sunlit Null while the model has not been placed yet. - * @returns {string} - */ -export function issCommandStatusText(sunlit) { - if (sunlit === null) return ''; - return sunlit ? t('Now: in sunlight') : t("Now: in the Earth's shadow"); -} - /** Beyond this the camera counts as far, and the zoom button is offered. */ export const ISS_COMMAND_FAR_M = 1000; diff --git a/src/layers/satellites/issCommand.test.mjs b/src/layers/satellites/issCommand.test.mjs index c285fed22c..262153d514 100644 --- a/src/layers/satellites/issCommand.test.mjs +++ b/src/layers/satellites/issCommand.test.mjs @@ -45,14 +45,6 @@ test('the zoom is offered only from far away', async () => { assert.equal(issCommandOffersZoom(150), false); }); -test('the status line says lit or in shadow, and nothing before the model is placed', async () => { - const { issCommandStatusText } = await import('./issCommand.js'); - assert.equal(issCommandStatusText(null), ''); - assert.notEqual(issCommandStatusText(true), issCommandStatusText(false)); - assert.ok(issCommandStatusText(true).length > 0); - assert.ok(issCommandStatusText(false).length > 0); -}); - test('an object docked to the ISS is the station too', async () => { const { issTrackedOnStation } = await import('./policy.js'); const NAUKA = 49044; diff --git a/src/ui/liveControls.js b/src/ui/liveControls.js index 711057c473..903037aee9 100644 --- a/src/ui/liveControls.js +++ b/src/ui/liveControls.js @@ -74,6 +74,8 @@ export class LiveControls { this.cockpitActive = documentRef?.body?.classList?.contains?.('cockpit-mode') === true; this.timer = null; + /** The view last published, as text: the 2 s refresh resends nothing new. */ + this.publishedKey = undefined; /** The stop held back for one tick after a clear (see `_onCleared`). */ this.clearGrace = null; this.listeners = new AbortController(); @@ -244,10 +246,18 @@ export class LiveControls { if (changed) this.actions.scheduleLayout?.(); } + /** Publish `view` unless it is the one published last. */ + _send(view) { + const key = JSON.stringify(view); + if (key === this.publishedKey) return; + this.publishedKey = key; + this.store.publish(view); + } + _publish() { if (this.destroyed) return; if (!this.subject || !this.offered.length) { - this.store.publish(null); + this._send(null); return; } const index = Math.max( @@ -255,7 +265,7 @@ export class LiveControls { this.offered.findIndex((stream) => stream.id === this.currentId), ); const current = this.offered[index]; - this.store.publish({ + this._send({ label: this.subject.label, streams: this.offered.map((stream) => ({ id: stream.id, diff --git a/src/ui/liveControls.test.mjs b/src/ui/liveControls.test.mjs index 8eecb2a774..1c374a61ff 100644 --- a/src/ui/liveControls.test.mjs +++ b/src/ui/liveControls.test.mjs @@ -428,3 +428,15 @@ test('destroy stops the stream, detaches the actions and publishes nothing', () f.select(); assert.equal(f.published.length, before, 'events after destroy are ignored'); }); + +test('the 2 s refresh publishes nothing when nothing changed', () => { + const f = fixture(); + f.setKeys(['station:test']); + f.select(); + const count = f.published.length; + for (const timer of f.running()) timer.callback(); + for (const timer of f.running()) timer.callback(); + assert.equal(f.published.length, count, 'the same view is not sent again'); + f.store.act('playLive'); + assert.ok(f.published.length > count, 'a change is'); +}); diff --git a/src/ui/styles/live.css b/src/ui/styles/live.css index 7986d63fa8..c7776b4a1b 100644 --- a/src/ui/styles/live.css +++ b/src/ui/styles/live.css @@ -113,6 +113,12 @@ .live-step .material-symbols-outlined { font-size: 18px; } +@media (pointer: coarse) { + .live-step { + min-width: 44px; + min-height: 44px; + } +} .live-step:hover, .live-step:focus-visible { border-color: var(--cockpit-accent, #00dcff); diff --git a/src/ui/views/panels/StationPanel.vue b/src/ui/views/panels/StationPanel.vue index 306bdd25d0..ea64a72520 100644 --- a/src/ui/views/panels/StationPanel.vue +++ b/src/ui/views/panels/StationPanel.vue @@ -1,7 +1,7 @@