From 1ce7e51c2220f2def54fdde852bcd1a943e781b0 Mon Sep 17 00:00:00 2001 From: Manjunath Paparaju Date: Mon, 16 Nov 2026 14:02:50 -0800 Subject: [PATCH] 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 --- src/data/entityContext.js | 10 +++++- src/data/militaryAwareness.test.mjs | 3 +- src/layers/awareness/panel.js | 7 +++- src/ui/cockpitTrackingController.js | 3 +- src/ui/contextLayerChanges.js | 15 +++++++++ src/ui/styles/entity-card.css | 22 ++++++------- src/ui/views/ContextView.vue | 44 ++++++++++++++++++++------ src/ui/views/panels/AwarenessPanel.vue | 5 +-- src/ui/views/panels/EntityCard.vue | 19 ++++++----- src/ui/views/panels/SpotConditions.vue | 24 ++++++++------ 10 files changed, 109 insertions(+), 43 deletions(-) diff --git a/src/data/entityContext.js b/src/data/entityContext.js index e351f71d5..dd38908e9 100644 --- a/src/data/entityContext.js +++ b/src/data/entityContext.js @@ -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}, vessels: {count: number, items: Array}, other: Array}} */ 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; diff --git a/src/data/militaryAwareness.test.mjs b/src/data/militaryAwareness.test.mjs index 6a913d33f..e9ce6901e 100644 --- a/src/data/militaryAwareness.test.mjs +++ b/src/data/militaryAwareness.test.mjs @@ -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', ); diff --git a/src/layers/awareness/panel.js b/src/layers/awareness/panel.js index 9d9bf75af..9ccda4e92 100644 --- a/src/layers/awareness/panel.js +++ b/src/layers/awareness/panel.js @@ -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(), diff --git a/src/ui/cockpitTrackingController.js b/src/ui/cockpitTrackingController.js index edbb61d0d..8e3868bb7 100644 --- a/src/ui/cockpitTrackingController.js +++ b/src/ui/cockpitTrackingController.js @@ -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; diff --git a/src/ui/contextLayerChanges.js b/src/ui/contextLayerChanges.js index 295242239..25ee7725c 100644 --- a/src/ui/contextLayerChanges.js +++ b/src/ui/contextLayerChanges.js @@ -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 diff --git a/src/ui/styles/entity-card.css b/src/ui/styles/entity-card.css index 6cfcb06f9..72bf72ab0 100644 --- a/src/ui/styles/entity-card.css +++ b/src/ui/styles/entity-card.css @@ -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; diff --git a/src/ui/views/ContextView.vue b/src/ui/views/ContextView.vue index 980ba990e..773cd329d 100644 --- a/src/ui/views/ContextView.vue +++ b/src/ui/views/ContextView.vue @@ -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(
- +