mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
Every hand-written button in the Cockpit HUD (CockpitView, the utility strip, the briefing and Contact cards, the signal rows, the orbital view and the bridge radar) is a ghost UiButton that keeps its id, classes, data and aria attributes, title and listeners, so the Cockpit controller and the cockpit stylesheets still find it. Radio's Enable, the briefing's Auto and the Contact card's Weather are pressed toggles written as :pressed="Boolean(...)". Every Material Symbols span (the rim pointers, reticle, heading caret, vision and card chevrons, panel glyphs, the contact and route arrows, the rail and view switcher glyphs) is a UiIcon with :size="null", so the cockpit rules still size it. The orbital view's focus hand-off reads each UiButton ref's $el. The heading caret's rule now reads `.cockpit-compass .cockpit-heading-caret` so it still outranks kit.css's `.ui-icon` display and line height, which load after cockpit.css. The Cockpit markup test reads the Reset and Exit buttons' attributes in any order. src/ui/kit/cockpitControls.test.mjs pins it: no hand-written button, Material span, select, checkbox or range in the Cockpit views, the kit counts per file, the pressed toggles and the caret rule. Co-authored-by: Manjunath Paparaju <[email protected]>
77 lines
5.3 KiB
Vue
77 lines
5.3 KiB
Vue
<script setup>
|
|
import { storeToRefs } from 'pinia';
|
|
import { computed } from 'vue';
|
|
import { t } from '../../../i18n/index.js';
|
|
import { createContextState } from '../../cockpitContextState.js';
|
|
import { vClassToggle } from '../../rail/classToggle.js';
|
|
import { useCockpitStore } from '../../stores/cockpit.js';
|
|
import UiButton from '../../kit/UiButton.vue';
|
|
import UiIcon from '../../kit/UiIcon.vue';
|
|
|
|
// The Cockpit Contact card. The Cockpit controller presents its scope,
|
|
// navigation, cohort counts, nearest contact and weather toggle; until it
|
|
// does, the card shows the state it starts in. Its visibility and collapse
|
|
// render from the presence; its layout stays with the controller, and the
|
|
// controls keep its listeners.
|
|
const { presence, context } = storeToRefs(useCockpitStore());
|
|
const initial = createContextState();
|
|
const c = computed(() => context.value ?? initial);
|
|
const directionStyle = computed(() =>
|
|
c.value.direction.angle === null
|
|
? undefined
|
|
: { transform: `rotate(${c.value.direction.angle}deg)` },
|
|
);
|
|
const collapsed = computed(() => !!presence.value?.contextCollapsed);
|
|
const weatherLabel = computed(() =>
|
|
c.value.weather
|
|
? t('Disable cockpit weather effects')
|
|
: t('Enable cockpit weather effects'),
|
|
);
|
|
</script>
|
|
|
|
<template>
|
|
<aside id="cockpit-context" class="cockpit-context-window" :aria-label="t('Contact cockpit summary')" :hidden="!presence?.context" :data-state="c.state ?? undefined" :data-collapsed="presence ? String(collapsed) : undefined">
|
|
<header class="cockpit-card-header cockpit-context-header">
|
|
<div>
|
|
<span class="cockpit-card-kicker cockpit-context-kicker">{{ t('CONTACT') }}</span>
|
|
<strong id="cockpit-context-subject">{{ c.subject }}</strong>
|
|
</div>
|
|
<nav class="cockpit-card-actions cockpit-context-actions" :aria-label="t('Contact navigation')">
|
|
<UiButton id="cockpit-context-previous" :disabled="!c.canPrevious" :aria-label="t('Previous — prior visited contact in the 250 km window')" :title="t('Previous — prior visited contact in the 250 km window')">
|
|
<UiIcon name="skip_previous" :size="null" />
|
|
</UiButton>
|
|
<UiButton id="cockpit-context-next" :disabled="!c.canNext" :aria-label="t('Next — nearest unvisited contact in the 250 km window')" :title="t('Next — nearest unvisited contact in the 250 km window')">
|
|
<UiIcon name="skip_next" :size="null" />
|
|
</UiButton>
|
|
<UiButton id="cockpit-context-toggle" :aria-label="collapsed ? t('Expand Contact panel') : t('Collapse Contact panel')" :aria-expanded="String(!collapsed)" :title="collapsed ? t('Expand contact panel') : t('Collapse contact panel')">
|
|
<UiIcon :name="collapsed ? 'chevron_right' : 'chevron_left'" :size="null" />
|
|
</UiButton>
|
|
</nav>
|
|
<span class="cockpit-context-qualifier">{{ t('CONTEXT ONLY') }}</span>
|
|
</header>
|
|
<div class="cockpit-context-cohorts" role="list" :aria-label="t('Nearby cohort counts')">
|
|
<div v-class-toggle="{ unknown: c.cohorts.flights.unknown }" role="listitem" data-context-cohort="flights"><span>{{ t('FLT') }}</span><strong>{{ c.cohorts.flights.count }}</strong><small translate="no" :title="c.cohorts.flights.source">{{ c.cohorts.flights.source }}</small></div>
|
|
<div v-class-toggle="{ unknown: c.cohorts.military.unknown }" role="listitem" data-context-cohort="military"><span>{{ t('MIL') }}</span><strong>{{ c.cohorts.military.count }}</strong><small translate="no" :title="c.cohorts.military.source">{{ c.cohorts.military.source }}</small></div>
|
|
<div v-class-toggle="{ unknown: c.cohorts['ais-live-vessels'].unknown }" role="listitem" data-context-cohort="ais-live-vessels"><span translate="no">AIS</span><strong>{{ c.cohorts['ais-live-vessels'].count }}</strong><small translate="no" :title="c.cohorts['ais-live-vessels'].source">{{ c.cohorts['ais-live-vessels'].source }}</small></div>
|
|
<div v-class-toggle="{ unknown: c.cohorts['military-installations'].unknown }" role="listitem" data-context-cohort="military-installations"><span>{{ t('SITE') }}</span><strong>{{ c.cohorts['military-installations'].count }}</strong><small translate="no" :title="c.cohorts['military-installations'].source">{{ c.cohorts['military-installations'].source }}</small></div>
|
|
</div>
|
|
<div class="cockpit-context-nearest">
|
|
<UiIcon id="cockpit-context-direction" v-class-toggle="{ unknown: c.direction.unknown }" name="navigation" :size="null" :style="directionStyle" />
|
|
<div>
|
|
<small>{{ t('NEAREST OBSERVED / MAPPED') }}</small>
|
|
<strong id="cockpit-context-nearest-label" :aria-label="c.nearest.ariaLabel ?? undefined">{{ c.nearest.label }}</strong>
|
|
</div>
|
|
<span id="cockpit-context-bearing">{{ c.bearing }}</span>
|
|
<span id="cockpit-context-distance" :aria-label="c.distance.ariaLabel ?? undefined">{{ c.distance.text }}</span>
|
|
</div>
|
|
<footer class="cockpit-context-footer">
|
|
<span id="cockpit-context-uncertainty">{{ c.uncertainty }}</span>
|
|
<UiButton id="cockpit-weather-toggle" class="cockpit-context-weather" :aria-label="weatherLabel" :pressed="Boolean(c.weather)" :title="weatherLabel">
|
|
<span>{{ t('WX') }}</span>
|
|
<strong id="cockpit-weather-state">{{ c.weather ? t('ON') : t('OFF') }}</strong>
|
|
</UiButton>
|
|
<time id="cockpit-context-updated">{{ c.updated }}</time>
|
|
</footer>
|
|
</aside>
|
|
</template>
|