mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
feat(ui): show and hide the Cockpit surfaces from a store
The Cockpit controller publishes which surfaces are shown (the entry button and TR-3B chip, the HUD with its exit and reset buttons and briefing card, and the Contact card) and the views bind them. Focus moves to the exit button, and back to the entry, after Vue renders them. Layout scheduling counts the published presence as visible, so entry still lays out the cards. The Display portal restores only focus its move dropped. The Missions layer no longer hides the Contact card directly.
This commit is contained in:
1 parent
484243fe4b
commit
f279200af5
18 files changed
+422
-74
No files matched your search
@@ -16,9 +16,11 @@ import CockpitUtilityControls from './panels/CockpitUtilityControls.vue';
|
||||
|
||||
// The Cockpit HUD. The Cockpit controller presents the instruments, the
|
||||
// destination arrow and the vision selector on every HUD update; until it
|
||||
// does, they show the state they start in. The HUD's visibility, classes
|
||||
// and layout stay with the controller, and the controls keep its listeners.
|
||||
const { instruments, route, vision } = storeToRefs(useCockpitStore());
|
||||
// does, they show the state they start in. The controller also publishes
|
||||
// which surfaces are shown; the HUD's layout stays with it, and the controls
|
||||
// keep its listeners.
|
||||
const { presence, instruments, route, vision } = storeToRefs(useCockpitStore());
|
||||
const active = computed(() => Boolean(presence.value?.active));
|
||||
const initialInstruments = createInstrumentState();
|
||||
const initialRoute = createRouteState();
|
||||
const initialVision = createVisionState();
|
||||
@@ -41,7 +43,7 @@ const tickStyle = (tick) =>
|
||||
|
||||
<template>
|
||||
<!-- Aircraft first-person view. It can be entered from the visible view switcher. -->
|
||||
<section id="cockpit-hud" aria-label="Aircraft cockpit view" hidden data-i18n-aria-label :data-layer="hud.layer ?? undefined">
|
||||
<section id="cockpit-hud" aria-label="Aircraft cockpit view" :hidden="!active" v-class-toggle="{ 'signals-active': active, 'context-active': Boolean(presence?.context) }" data-i18n-aria-label :data-layer="hud.layer ?? undefined">
|
||||
<!-- One optical coordinate system: every targeting mark shares this center.
|
||||
Decorative only; telemetry and interactive panels remain separate. -->
|
||||
<svg class="cockpit-frame-lines" viewBox="0 0 1200 720" preserveAspectRatio="none" aria-hidden="true" focusable="false">
|
||||
@@ -186,11 +188,11 @@ const tickStyle = (tick) =>
|
||||
</section>
|
||||
|
||||
<nav id="view-switcher" aria-label="View switcher" data-i18n-aria-label>
|
||||
<button id="cockpit-reset-globe" type="button" aria-label="Reset cockpit to full globe view" title="Exit cockpit and return to full globe view" hidden data-i18n-aria-label data-i18n-title>
|
||||
<button id="cockpit-reset-globe" type="button" aria-label="Reset cockpit to full globe view" title="Exit cockpit and return to full globe view" :hidden="!active" data-i18n-aria-label data-i18n-title>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">public</span>
|
||||
<span data-i18n>RESET</span>
|
||||
</button>
|
||||
<button id="map-view-switch" type="button" aria-label="Exit cockpit view" aria-keyshortcuts="Escape C" title="Exit cockpit view" hidden data-i18n-aria-label data-i18n-title>
|
||||
<button id="map-view-switch" type="button" aria-label="Exit cockpit view" aria-keyshortcuts="Escape C" title="Exit cockpit view" :hidden="!active" data-i18n-aria-label data-i18n-title>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">close_fullscreen</span>
|
||||
<span data-i18n>EXIT COCKPIT</span>
|
||||
</button>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<script setup>
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { t } from '../../i18n/index.js';
|
||||
import { vClassToggle } from '../rail/classToggle.js';
|
||||
import { useCockpitStore } from '../stores/cockpit.js';
|
||||
import { useContextStore } from '../stores/context.js';
|
||||
import AwarenessPanel from './panels/AwarenessPanel.vue';
|
||||
import MissionDetail from './panels/MissionDetail.vue';
|
||||
@@ -10,6 +12,7 @@ import RadioPanel from './panels/RadioPanel.vue';
|
||||
// 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 { presence: cockpit } = storeToRefs(useCockpitStore());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -64,12 +67,12 @@ const { view: ctx } = storeToRefs(useContextStore());
|
||||
</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="Contact Context actions" data-i18n-aria-label>
|
||||
<button id="cockpit-entry" type="button" hidden>
|
||||
<button id="cockpit-entry" type="button" :hidden="!cockpit?.entryAvailable">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">flight</span>
|
||||
<span data-i18n>COCKPIT</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)" data-i18n>SEARCH NEARBY SITES</button>
|
||||
<button id="tr3b-toggle" class="tr3b-toggle" type="button" aria-pressed="false" hidden aria-label="Reclassify tracked contact as TR-3B" title="Reclassify as TR-3B" data-i18n-aria-label data-i18n-title>🛸</button>
|
||||
<button id="tr3b-toggle" class="tr3b-toggle" type="button" :aria-pressed="String(!!cockpit?.tr3b?.converted)" :hidden="!cockpit?.tr3b" aria-label="Reclassify tracked contact as TR-3B" :title="cockpit?.tr3b?.converted ? t('Restore real aircraft') : t('Reclassify as TR-3B')" data-i18n-aria-label>🛸</button>
|
||||
</div>
|
||||
<AwarenessPanel />
|
||||
</section>
|
||||
|
||||
@@ -10,7 +10,7 @@ import CockpitSignalList from './CockpitSignalList.vue';
|
||||
// cycle toggle, regional news and local conditions; until it does, the card
|
||||
// shows the state it starts in. The controls keep the controller's
|
||||
// listeners. The route card and the signal rows render themselves.
|
||||
const { brief } = storeToRefs(useCockpitStore());
|
||||
const { presence, brief } = storeToRefs(useCockpitStore());
|
||||
const initial = createBriefState();
|
||||
const b = computed(() => brief.value ?? initial);
|
||||
// The card's page and the region's answer, as state hooks on the card.
|
||||
@@ -32,7 +32,7 @@ function leaveSignals() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside id="cockpit-signal-stream" class="cockpit-signal-window" aria-label="Cockpit briefing carousel" hidden data-i18n-aria-label v-bind="streamState" ref="stream">
|
||||
<aside id="cockpit-signal-stream" class="cockpit-signal-window" aria-label="Cockpit briefing carousel" :hidden="!presence?.active" data-i18n-aria-label v-bind="streamState" ref="stream">
|
||||
<CockpitRoute />
|
||||
<header class="cockpit-signal-header">
|
||||
<div class="cockpit-brief-heading">
|
||||
|
||||
@@ -10,7 +10,7 @@ import { useCockpitStore } from '../../stores/cockpit.js';
|
||||
// navigation, cohort counts, nearest contact and weather toggle; until it
|
||||
// does, the card shows the state it starts in. Its visibility, collapse and
|
||||
// layout stay with the controller, and the controls keep its listeners.
|
||||
const { context } = storeToRefs(useCockpitStore());
|
||||
const { presence, context } = storeToRefs(useCockpitStore());
|
||||
const initial = createContextState();
|
||||
const c = computed(() => context.value ?? initial);
|
||||
const directionStyle = computed(() =>
|
||||
@@ -26,7 +26,7 @@ const weatherLabel = computed(() =>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside id="cockpit-context" class="cockpit-context-window" aria-label="Contact cockpit summary" hidden data-i18n-aria-label :data-state="c.state ?? undefined">
|
||||
<aside id="cockpit-context" class="cockpit-context-window" aria-label="Contact cockpit summary" :hidden="!presence?.context" data-i18n-aria-label :data-state="c.state ?? undefined">
|
||||
<header class="cockpit-context-header">
|
||||
<div>
|
||||
<span data-i18n class="cockpit-context-kicker">CONTACT</span>
|
||||
|
||||
Reference in new issue
Block a user