mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +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
@@ -6,7 +6,11 @@ import assert from 'node:assert/strict';
|
||||
import { createPinia } from 'pinia';
|
||||
import { createApp, nextTick } from 'vue';
|
||||
import { setLocale, t as translate } from '../i18n/index.js';
|
||||
import { publishContextView, updateContext } from './cockpitContext.js';
|
||||
import {
|
||||
publishContextView,
|
||||
showContextCard,
|
||||
updateContext,
|
||||
} from './cockpitContext.js';
|
||||
import { createContextState } from './cockpitContextState.js';
|
||||
import { syncWeatherToggle } from './cockpitInstruments.js';
|
||||
import { useCockpitStore } from './stores/cockpit.js';
|
||||
@@ -26,11 +30,13 @@ function fixture(t, snapshot = null) {
|
||||
// The Contact presenter needs only this much of the controller.
|
||||
const owner = {
|
||||
context: $('#cockpit-context'),
|
||||
hud: document.createElement('section'),
|
||||
presence: { context: false },
|
||||
contextView: createContextState(),
|
||||
contextLayoutStamp: null,
|
||||
publishContext: (view) => store.publishContext(view),
|
||||
publishContextView,
|
||||
publishPresenceView: () => store.publishPresence({ ...owner.presence }),
|
||||
showContextCard,
|
||||
pushCockpitSignal: (...args) => signals.push(args),
|
||||
updateCockpitSignals() {},
|
||||
scheduleContextLayout: () => layouts.push(true),
|
||||
@@ -119,7 +125,7 @@ test('a snapshot fills the card and keeps classes other code sets', async (t) =>
|
||||
const card = $('#cockpit-context');
|
||||
assert.equal(card.hidden, false);
|
||||
assert.equal(card.dataset.state, 'uncertain');
|
||||
assert.equal(owner.hud.classList.contains('context-active'), true);
|
||||
assert.equal(owner.presence.context, true);
|
||||
assert.match(
|
||||
text('#cockpit-context-subject'),
|
||||
/^RCH123 · 250\u00a0KM AIR\/SEA WINDOW$/,
|
||||
@@ -193,7 +199,7 @@ test('without a snapshot the card stands by, hidden', async (t) => {
|
||||
updateContext.call(owner, INFO, 0);
|
||||
await nextTick();
|
||||
assert.equal($('#cockpit-context').hidden, true);
|
||||
assert.equal(owner.hud.classList.contains('context-active'), false);
|
||||
assert.equal(owner.presence.context, false);
|
||||
assert.equal(signals.at(-1)[2], 'CONTEXT STANDBY');
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user