Files
gods-eye-view/src/ui/cockpitContextState.js
T
German Khokhlov 415f23739f Name the reporting provider in Contacts and Cockpit counts
The Cockpit Contact counts named fixed providers (OpenSky, adsb.lol,
AISStream) while the Layers panel and Contacts named the provider the last
snapshot reported, and the vessels layer kept that name out of getStats(),
so Contacts always said AISStream. Each cohort now carries the provider and
whether it answered as a fallback or from a stale snapshot, and both views
show it the way the Layers row does ("adsb.lol · FALLBACK").

Fixes HAL-721.
2026-11-03 16:26:55 +04:00

42 lines
1.2 KiB
JavaScript

/**
* The Cockpit Contact card's state as it first renders. It needs only the
* i18n module, so the controller and the view can both read it.
*/
import { t } from '../i18n/index.js';
/** Cohorts the card counts, in its order. */
const COCKPIT_CONTEXT_COHORTS = Object.freeze([
'flights',
'military',
'ais-live-vessels',
'military-installations',
]);
/**
* The card before any snapshot: navigation on, counts and readouts empty,
* weather off. The controller keeps it, changes it in place and publishes a
* copy; `CockpitContext` renders it.
* @returns {object}
*/
export function createContextState() {
return {
state: null,
subject: t('CONTACTS · 250 KM'),
canPrevious: true,
canNext: true,
cohorts: Object.fromEntries(
COCKPIT_CONTEXT_COHORTS.map((id) => [
id,
{ count: '—', unknown: false, source: '—' },
]),
),
nearest: { label: t('NO AVAILABLE EXAMPLE'), ariaLabel: null },
distance: { text: '—', ariaLabel: null },
direction: { angle: null, unknown: false },
bearing: '—',
uncertainty: t('AVAILABLE INPUTS ONLY · NOT AN ALL-CLEAR'),
updated: '--:--:--Z',
weather: false,
};
}