Bring Contacts, Space Missions and Radio back into Context

The Context panel's main tab shows the mode row again, with Contacts
(nearby sites search, the TR-3B toggle and the Awareness list) and Space
Missions (the roster and launch replay); only the Properties tab hides
them. Radio shows while its layer is on, and turning Radio or Launches on
opens Context. When Contacts follows the aircraft the card shows, its list
sits inside the card in a compact form and the card leaves out the flights
and vessels Contacts already lists. The card's Enter Cockpit replaces the
Contacts button, and leaving the cockpit returns focus to it.

Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
Manjunath PaparajuandSameh Khamis authored and Sameh Khamis committed 2026-11-16 14:59:18 -08:00
1 parent 6e03871d5a
commit 1ce7e51c22
10 files changed
+109 -43

No files matched your search

+9 -1
View File
@@ -1142,12 +1142,19 @@ export function nearbyEntities(
* @param {number} [options.radiusKm]
* @param {number} [options.limit] Rows per group.
* @param {string} [options.excludeKey] A record to leave out (the selected one).
* @param {string[]} [options.excludeLayers] Layers already presented by another section.
* @returns {{flights: {count: number, items: Array<object>}, vessels: {count: number, items: Array<object>}, other: Array<object>}}
*/
export function nearbyByKind(
dataManager,
here,
{ radiusKm = 250, limit = 4, excludeKey = '', query = '' } = {},
{
radiusKm = 250,
limit = 4,
excludeKey = '',
excludeLayers = [],
query = '',
} = {},
) {
const needle = text(query).toLowerCase();
const groups = {
@@ -1160,6 +1167,7 @@ export function nearbyByKind(
const found = { aircraft: [], vessel: [] };
const other = [];
for (const layer of enabledLayers(dataManager)) {
if (excludeLayers.includes(layer.id)) continue;
const kind = entityKind(layer.id).kind;
const group = found[kind];
let closest = null;
+2 -1
View File
@@ -1370,8 +1370,9 @@ test('a cached Context subject re-reads its label when enrichment lands after se
/N123AB/,
'the rendered Context panel must show the registration without a position change',
);
// `subjectIdentity` is the subject's id for matching, never shown.
assert.doesNotMatch(
JSON.stringify(repainted.view),
JSON.stringify({ ...repainted.view, subjectIdentity: undefined }),
/ae1fa4/,
'the hex must be gone from the panel',
);
+6 -1
View File
@@ -222,9 +222,14 @@ export function createPanel({ state: layerState, parts }) {
ensurePanel();
layerState.panelRenders += 1;
const { subject, cohorts } = layerState.results;
const windowLabel = t('{distance} FLIGHT / VESSEL WINDOW', {
distance: presentAwarenessDistance(AWARENESS_RADIUS_M),
});
publish({
kind: 'results',
subject: `${subject.label} · ${t('{distance} FLIGHT / VESSEL WINDOW', { distance: presentAwarenessDistance(AWARENESS_RADIUS_M) })}`,
subject: `${subject.label} · ${windowLabel}`,
subjectIdentity: { layerId: subject.layerId, id: subject.id },
subjectLabel: subject.label,
subjectNames: presentNames(subject.memberNames),
photo: presentPhoto(subject),
navigation: presentNavigation(),
+2 -1
View File
@@ -809,10 +809,11 @@ export function exit({ restoreTracking = true } = {}) {
this.services.satellitesLayer?.refocusTrackedById?.(satelliteSubject);
}
this.syncEntry();
// Back to whichever entry was used: the Contacts button or the readout's.
// Return to the card or readout control that opened Cockpit.
const readoutEntry = document.getElementById('cockpit-entry-readout');
const restoreTarget =
this.entryFocusOrigin === this.entry ||
this.entryFocusOrigin?.hasAttribute('data-entity-cockpit-entry') ||
(readoutEntry && this.entryFocusOrigin === readoutEntry)
? this.entryFocusOrigin
: this.entry || this.entryFocusOrigin;
+15
View File
@@ -249,6 +249,21 @@ export function _handleContextLayerChange(change) {
);
}
}
if (
change.type === 'visibility' &&
change.enabled &&
change.origin === 'user' &&
!this.cockpitView?.active &&
(change.layerId === 'radio' || change.layerId === 'rocket-launches')
) {
// Context's panel shows its main tab for them (ContextView listens).
globalThis.dispatchEvent?.(new Event('gev:context-show-view'));
this.actions.setPanelCollapsed('global-context-panel', false, {
explicit: true,
});
if (change.layerId === 'radio')
this.actions.setPanelCollapsed('radio-panel', false, { explicit: true });
}
// Turning off the layer the view rides ends it; every other layer may be
// turned on or off freely during a session.
const riddenLayerId = this.cockpitView?.active
+11 -11
View File
@@ -325,20 +325,20 @@
}
}
/* Context is one card for whatever is picked: the old Contacts and Space
Missions modes and the Radio strip are out of it. Their markup stays, as
their controls still find their buttons by id, but none of it shows. */
#global-context-panel
:is(
.global-context-modes,
#context-mode-standby,
#context-flights-view,
#context-missions-view,
#radio-panel
) {
/* Radio can move between Context's two body hosts. Keep its visibility
tied to the Inspector and layer state in either location. */
#global-context-panel[data-context-tab='props']
:is(.global-context-modes, .context-mode-view, #radio-panel),
#global-context-panel #radio-panel:not(.radio-enabled),
#global-context-panel #context-mode-standby,
#global-context-panel #cockpit-entry {
display: none !important;
}
#global-context-panel .global-context-actions:has(#tr3b-toggle:not([hidden])) {
grid-template-columns: minmax(0, 1fr) auto;
}
/* ── In view: what the panel shows while nothing is picked ───────────── */
.view-context {
margin: 0 0 0.75rem;
+35 -9
View File
@@ -25,7 +25,7 @@ import { closeContextSearch, contextSearchOpen, contextSearchText } from '../con
// ContextControls presents the mode switch and the nearby sites search and
// publishes them; until it does, the panel shows its initial markup.
const { view: ctx } = storeToRefs(useContextStore());
const { view: ctx, awareness } = storeToRefs(useContextStore());
const { presence: cockpit } = storeToRefs(useCockpitStore());
// The entry names the subject it would ride (cockpitEntryFace).
const entry = computed(() =>
@@ -39,6 +39,26 @@ const sceneRuntime = computed(() => scenePanel.value?.runtime ?? '');
// Context is one card for whatever was picked; until something is, it says how.
const entityCards = useEntityCardStore();
const { card: entityCard } = storeToRefs(entityCards);
const contactsSubject = computed(() =>
ctx.value?.flightsActive ? awareness.value?.subjectIdentity : null,
);
const contactsMatchCard = computed(() => {
const card = entityCard.value;
const subject = contactsSubject.value;
return Boolean(
card?.kind === 'aircraft' &&
subject?.layerId === card.layerId &&
String(subject.id) === String(card.identity.id),
);
});
watch(
[() => contactsSubject.value?.layerId, () => contactsSubject.value?.id],
([layerId, id]) => {
if (!['flights', 'military'].includes(layerId) || !id || contactsMatchCard.value) return;
// Contacts has already picked whom to follow. Only update the Inspector.
entityCards.select({ layerId, id, label: awareness.value?.subjectLabel }, { follow: false });
},
);
// Layer tabs: settings for the layers that are on, beside the card.
let layerTimer = null;
@@ -55,12 +75,16 @@ const setPane = (id) => (el) => {
if (target instanceof HTMLElement && target.parentElement !== el) el.appendChild(target);
}
};
// Turning Radio or Launches on asks for the main tab, where they show.
const showView = () => (activeTab.value = 'view');
onMounted(() => {
globalThis.addEventListener?.('gev:context-show-view', showView);
contextReady.value = true;
readLayers();
layerTimer = setInterval(readLayers, 1500);
});
onBeforeUnmount(() => {
globalThis.removeEventListener?.('gev:context-show-view', showView);
clearInterval(layerTimer);
contextReady.value = false;
});
@@ -134,7 +158,7 @@ watch(
<template #badge><span id="recent-imagery-panel-count" :aria-label="t('Imagery days in the box')"></span></template>
<div id="recent-imagery-panel-body" class="ui-scroll" data-rail-scroller></div>
</RailPanel>
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :title="t('CONTEXT')" sideways scroll rail-scroller>
<RailPanel id="global-context-panel" start-collapsed v-class-toggle="{ ...(ctx && { 'context-enabled': ctx.enabled }) }" :data-context-mode="ctx?.mode" :data-context-tab="activeTab" :title="t('CONTEXT')" sideways scroll rail-scroller>
<template #actions>
<button type="button" class="context-dock-btn" :aria-pressed="String(contextSearchOpen)" :aria-label="contextSearchOpen ? t('Close Context search') : t('Search in Context')" :title="contextSearchOpen ? t('Close search') : t('Search in Context')" @click="toggleSearch">
<span class="material-symbols-outlined" aria-hidden="true">search</span>
@@ -169,10 +193,7 @@ watch(
<div :id="`context-tab-${tab.id}`" :ref="setPane(tab.id)" class="context-tab-pane"></div>
</section>
</div>
<div v-show="activeTab === 'view'" :class="{ 'context-searching': contextSearchOpen && contextSearchText.trim() }">
<EntityCard />
<ViewContext v-if="!entityCard" />
</div>
<RadioPanel />
<div class="global-context-modes" role="tablist" :aria-label="t('Context mode')">
<button id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" type="button" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
<span class="material-symbols-outlined" aria-hidden="true">radar</span>
@@ -189,14 +210,14 @@ watch(
</div>
<section id="context-flights-view" class="context-mode-view" role="tabpanel" aria-labelledby="global-context-flights-btn" :hidden="!ctx?.flightsActive">
<div class="global-context-actions" :aria-label="t('Contact Context actions')">
<button id="cockpit-entry" type="button" :hidden="!cockpit?.entryAvailable">
<button id="cockpit-entry" type="button" :hidden="!cockpit?.entryAvailable" aria-hidden="true" tabindex="-1">
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
<span>{{ entry.label }}</span>
</button>
<button id="installations-search-btn" class="panel-layer-toggle" type="button" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</button>
<UiButton id="tr3b-toggle" class="tr3b-toggle" :pressed="!!cockpit?.tr3b?.converted" :hidden="!cockpit?.tr3b" :aria-label="t('Reclassify tracked contact as TR-3B')" :title="cockpit?.tr3b?.converted ? t('Restore real aircraft') : t('Reclassify as TR-3B')">🛸</UiButton>
</div>
<AwarenessPanel />
<AwarenessPanel v-if="!contactsMatchCard" />
</section>
<section id="context-missions-view" class="context-mode-view" role="tabpanel" aria-labelledby="global-context-missions-btn" :hidden="!ctx?.missionsActive">
<div id="space-mission-panel-host">
@@ -204,7 +225,12 @@ watch(
<MissionDetail />
</div>
</section>
<RadioPanel />
<div v-show="activeTab === 'view'" :class="{ 'context-searching': contextSearchOpen && contextSearchText.trim() }">
<EntityCard :with-contacts="contactsMatchCard">
<AwarenessPanel v-if="contactsMatchCard" compact />
</EntityCard>
<ViewContext v-if="!entityCard" />
</div>
</div>
</RailPanel>
<BhoteKoshiPanel />
+3 -2
View File
@@ -8,6 +8,7 @@ import AwarenessNames from './AwarenessNames.vue';
// The Contacts panel inside Context. The Contacts layer publishes its view
// (standby, results or empty); until it does, the panel shows its initial
// markup. Buttons call the layer's navigation as the person's own.
const props = defineProps({ compact: Boolean });
const { awareness: view, awarenessLayer: layer } = storeToRefs(useContextStore());
const user = { origin: 'user' };
const root = ref(null);
@@ -58,8 +59,8 @@ onUpdated(() => {
<span>{{ view.text }}</span>
</div>
<template v-else-if="view.kind === 'results'">
<div class="military-awareness-subject">{{ view.subject }}</div>
<a v-if="view.photo && view.photo.src !== failedPhoto" class="military-awareness-photo" :href="view.photo.link" target="_blank" rel="noopener">
<div v-if="!props.compact" class="military-awareness-subject">{{ view.subject }}</div>
<a v-if="!props.compact && view.photo && view.photo.src !== failedPhoto" class="military-awareness-photo" :href="view.photo.link" target="_blank" rel="noopener">
<img :src="view.photo.src" :width="view.photo.width ?? undefined" :height="view.photo.height ?? undefined" alt="" @error="fail" />
<small v-if="view.photo.credit">{{ view.photo.credit }}</small>
</a>
+11 -8
View File
@@ -14,6 +14,10 @@ import { countryName, nearestCity } from '../../../data/wikidataCities.js';
// The Context panel's card for one thing on the map: what it is, its facts,
// links, actions, and what else is near it. It reads from the entity card
// store, which the globe click, the omnibar and the nearby list all fill.
const props = defineProps({
/** Contacts follows this same aircraft, and its list sits inside the card. */
withContacts: Boolean,
});
const store = useEntityCardStore();
const { card, lost, tick } = storeToRefs(store);
// Cameras carry only an id; the CCTV panel's store knows the picked one's name.
@@ -221,9 +225,9 @@ watch(
<div class="entity-hero" :data-hero="heroKind">
<CctvPreview v-if="heroKind === 'camera'" :camera-id="card.identity?.id || ''" />
<!-- No imagery for it yet: its icon, with its headline figures beside it. -->
<div v-else class="entity-hero__placeholder" :class="{ 'entity-hero__placeholder--bare': !tiles.length }">
<div v-else class="entity-hero__placeholder" :class="{ 'entity-hero__placeholder--bare': props.withContacts || !tiles.length }">
<span class="material-symbols-outlined entity-hero__glyph" aria-hidden="true">{{ card.icon }}</span>
<div v-if="tiles.length" class="entity-hero__figures">
<div v-if="!props.withContacts && tiles.length" class="entity-hero__figures">
<div v-for="fact in tiles" :key="fact.field" class="entity-hero__figure">
<strong>{{ factFigure(fact).number }}<small v-if="factFigure(fact).unit">{{ factFigure(fact).unit }}</small></strong>
<span>{{ factLabel(fact) }}</span>
@@ -270,7 +274,7 @@ watch(
<span>{{ routePlaces.from }}</span>
<span>{{ routePlaces.to }}</span>
</p>
<AltitudeGraph v-if="altitudeGraphed" :key="`altitude:${card.key}`" :altitude-m="lost ? null : card.altitudeM" :tick="tick" />
<AltitudeGraph v-if="altitudeGraphed" v-show="!props.withContacts" :key="`altitude:${card.key}`" :altitude-m="lost ? null : card.altitudeM" :tick="tick" />
<p
v-if="card.route && !card.route.verified"
class="entity-card__route-note"
@@ -279,7 +283,7 @@ watch(
<span class="material-symbols-outlined" aria-hidden="true">warning</span>{{ t('Scheduled · unverified: does not match where the plane is') }}
</p>
<div v-if="tiles.length && heroKind !== 'none' && !contextNeedle" class="entity-card__tiles" :style="{ gridTemplateColumns: `repeat(${tiles.length}, minmax(0, 1fr))` }">
<div v-if="!props.withContacts && tiles.length && heroKind !== 'none' && !contextNeedle" class="entity-card__tiles" :style="{ gridTemplateColumns: `repeat(${tiles.length}, minmax(0, 1fr))` }">
<div v-for="fact in tiles" :key="fact.field" class="entity-card__tile">
<span>{{ factLabel(fact) }}</span>
<strong>{{ factFigure(fact).number }}<small v-if="factFigure(fact).unit">{{ factFigure(fact).unit }}</small></strong>
@@ -303,7 +307,7 @@ watch(
<div class="entity-card__actions">
<!-- On an aircraft or a satellite, Cockpit leads: it is the action people come for. -->
<button v-if="store.canCockpit()" type="button" class="entity-card__action entity-card__action--primary" @click="store.cockpit()">
<button v-if="store.canCockpit()" type="button" class="entity-card__action entity-card__action--primary" data-entity-cockpit-entry @click="store.cockpit()">
<span class="material-symbols-outlined" aria-hidden="true">{{ card.layerId === 'satellites' ? 'satellite_alt' : 'flight' }}</span>{{ card.layerId === 'satellites' ? t('Enter orbital view') : t('Enter Cockpit') }}
</button>
<div class="entity-card__action-row">
@@ -319,9 +323,8 @@ watch(
</button>
</div>
<!-- The same blocks for every item, in one order: weather and local
time, then flights, vessels and hazards within the Context radius. -->
<SpotConditions v-if="Number.isFinite(card.lat) && Number.isFinite(card.lon)" :key="card.key" entity :lat="card.lat" :lon="card.lon" :exclude-key="card.key" :settle-km="settleKm" />
<slot />
<SpotConditions v-if="Number.isFinite(card.lat) && Number.isFinite(card.lon)" :key="card.key" entity :lat="card.lat" :lon="card.lon" :exclude-key="card.key" :settle-km="settleKm" :with-contacts="props.withContacts" />
<p v-if="source" class="entity-card__source">
<span>{{ t('Source') }}</span> {{ source }}<template v-if="ageText"> · {{ ageText }}</template>
+15 -9
View File
@@ -24,6 +24,7 @@ const props = defineProps({
lon: { type: Number, required: true },
/** Show the standard blocks for a selected item. */
entity: { type: Boolean, default: false },
withContacts: Boolean,
/** The selected item's own key, left out of the nearby lists. */
excludeKey: { type: String, default: '' },
/** How far the spot moves before the weather and hazards are read again. */
@@ -111,7 +112,8 @@ const shownHazards = computed(() =>
hazards.value.filter((hazard) => matchesContextSearch(hazard.title, hazard.detail, hazardLayers.value[hazard.kind]?.name)).slice(0, searching.value ? 12 : 5),
);
// The standard nearby lists for a selected item, from the layers that are on.
// The merged card gets these cohorts and their coverage from Awareness.
const CONTACT_LAYERS = ['flights', 'military', 'ais-live-vessels', 'military-installations'];
const groups = computed(() => {
void tick.value;
if (!props.entity) return null;
@@ -119,17 +121,21 @@ const groups = computed(() => {
radiusKm: radiusKm.value,
limit: searching.value ? 12 : 4,
excludeKey: props.excludeKey,
excludeLayers: props.withContacts ? CONTACT_LAYERS : undefined,
query: contextNeedle.value,
});
});
const trafficBlocks = computed(() =>
groups.value
? [
{ id: 'flights', icon: 'flight', title: t('Flights within {radius}', { radius: radiusText.value }), none: t('No flights within {radius} from the layers that are on.', { radius: radiusText.value }), ...groups.value.flights },
{ id: 'vessels', icon: 'directions_boat', title: t('Vessels within {radius}', { radius: radiusText.value }), none: t('No vessels within {radius} from the layers that are on.', { radius: radiusText.value }), ...groups.value.vessels },
]
: [],
);
const trafficBlocks = computed(() => {
if (!groups.value) return [];
if (props.withContacts)
return groups.value.flights.count
? [{ id: 'local-adsb', icon: 'flight', title: t('Local ADS-B'), ...groups.value.flights }]
: [];
return [
{ id: 'flights', icon: 'flight', title: t('Flights within {radius}', { radius: radiusText.value }), none: t('No flights within {radius} from the layers that are on.', { radius: radiusText.value }), ...groups.value.flights },
{ id: 'vessels', icon: 'directions_boat', title: t('Vessels within {radius}', { radius: radiusText.value }), none: t('No vessels within {radius} from the layers that are on.', { radius: radiusText.value }), ...groups.value.vessels },
];
});
// Local solar time at the spot, from its longitude: no time zone lookup.
const localTime = computed(() => {