Files
gods-eye-view/src/ui/views/panels/MissionRoster.vue
T
Manjunath PaparajuandSameh Khamis 0a6fd5f43f Make Space Missions an ordinary layer with its own panel
Space Missions no longer runs as a Context mode. The launches layer owns
its Satellites dependency, including the rule that a Satellites off
asked for after Space Missions was switched on ends it (request order
decides), and a small controller connects the layer to its own panel and
store. Context no longer isolates, snapshots or restores Space Missions
or Satellites, so Contacts and Space Missions run together in either
order, and scene playback no longer exits an isolating mode. Settled by
the owner: Contacts leaves Satellites as it is, and only a person's or
voice Satellites off ends Space Missions; a scene, story, preset or
other programmatic off does not.

Turning the layer on by hand or by voice, choosing it at first run, or
picking a mission on the globe opens the Space Missions panel, and on a
phone its Missions sheet. Asking voice to open the panel while the layer
is off is refused with a reason, and voice never opens it while the
Cockpit owns the screen. With no Context mode on, a voice Context off
switches Space Missions off. A failed Satellites restore no longer cuts
the layer's teardown short. Mission labels on the globe select their
mission. The layer names a failed first index load itself, so the
Context toast no longer imports Space Missions code.

Also carries the satellites request ordering and
DataLayerManager.waitForLayerIdle, the share token for the panel, voice
panel ids, Cockpit folding the panel away and the phone tab ellipsis.
The panel shares the rail gutters and hover border of the other side
panels.

On top of the Omnibar: "open space missions panel" reaches the new
panel, and Open Context no longer answers to "missions".

Co-authored-by: Sameh Khamis <[email protected]>
2026-11-18 16:03:51 -08:00

80 lines
4.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<script setup>
import { storeToRefs } from 'pinia';
import { onBeforeUpdate, onUpdated, ref } from 'vue';
import { t } from '../../../i18n/index.js';
import { useSpaceMissionsStore } from '../../stores/spaceMissions.js';
import UiEmpty from '../../kit/UiEmpty.vue';
// The Space Missions roster. The launches layer presents it; until it does,
// the list shows its loading line. Hover and keyboard focus drive the
// layer's preview, and a click selects the mission.
const { roster, layer } = storeToRefs(useSpaceMissionsStore());
const root = ref(null);
const CONTINUATION = '[data-mission-roster-focus-continuation]';
const rosterIndex = (el) => {
const item = el?.closest?.('[data-mission-roster-index]');
return item && root.value?.contains(item) ? Number(item.dataset.missionRosterIndex) : null;
};
// A changed roster resets the layer's preview. The old list rebuilt its
// rows, so the next pointer movement entered the row under the pointer; a
// row Vue keeps re-enters on its next movement the same way.
let pointerStale = false;
function move(index) {
if (!pointerStale) return;
pointerStale = false;
layer.value?.rosterPointerEnter(index);
}
function enter(index) {
pointerStale = false;
layer.value?.rosterPointerEnter(index);
}
function blur(event) {
layer.value?.rosterBlur(rosterIndex(event.relatedTarget));
}
// A refresh keeps keyboard focus on the same mission by identity: browsers
// drop focus from a node Vue moves or removes, so it is found again by id,
// or continues beyond the list when the mission departed. A changed roster
// resets the layer's preview, so a mission still focused takes it back.
let focusedId = null;
onBeforeUpdate(() => {
const active = document.activeElement;
focusedId = root.value?.contains(active) ? active.closest?.('[data-mission-roster-id]')?.dataset.missionRosterId ?? null : null;
});
onUpdated(() => {
pointerStale = true;
const id = focusedId;
focusedId = null;
const list = root.value;
if (!id || !list) return;
const active = document.activeElement;
if (!list.contains(active)) {
const retained = [...list.querySelectorAll('[data-mission-roster-id]')].find((item) => item.dataset.missionRosterId === id);
(retained || list.querySelector(CONTINUATION))?.focus({ preventScroll: true });
}
const index = rosterIndex(document.activeElement);
if (index !== null) layer.value?.rosterFocus(index);
});
</script>
<template>
<div id="space-mission-roster" ref="root" class="space-mission-roster" :aria-label="t('Available Space Missions')">
<div class="space-mission-roster-header">
<div>
<strong>{{ t('AVAILABLE MISSIONS') }}</strong>
<span>{{ t('SELECT A MISSION TO INSPECT') }}</span>
</div>
<output data-mission-roster-count>{{ roster ? roster.count : '—' }}</output>
</div>
<div class="space-mission-roster-list ui-scroll" data-mission-roster-list>
<UiEmpty v-if="!roster" class="space-mission-roster-empty" :title="t('LOADING 30-DAY MISSION INDEX')" />
<UiEmpty v-else-if="!roster.entries.length" class="space-mission-roster-empty" :title="roster.empty" />
<button v-for="entry in roster?.entries" v-else :key="entry.id" type="button" class="space-mission-roster-item" :data-mission-roster-index="entry.index" :data-mission-roster-id="entry.id" :aria-label="entry.ariaLabel" @click="layer?.selectMissionAt(entry.index)" @mouseenter="enter(entry.index)" @mousemove="move(entry.index)" @mouseleave="layer?.rosterPointerLeave()" @focus="layer?.rosterFocus(entry.index)" @blur="blur"><span class="space-mission-roster-marker" :style="{ '--mission-roster-color': entry.color }" aria-hidden="true"></span><span class="space-mission-roster-copy"><strong>{{ entry.label }}</strong><small>{{ entry.provider }} · {{ entry.date }}</small></span><span class="space-mission-roster-chevron" aria-hidden="true">›</span></button>
</div>
<p class="space-mission-roster-focus-continuation" tabindex="-1" data-mission-roster-focus-continuation>{{ t('TAB PREVIEWS · ENTER / SPACE SELECTS') }}</p>
</div>
</template>