Files
gods-eye-view/src/ui/views/panels/CockpitRoute.vue
T
Sameh KhamisandManjunath Paparaju b875b5f469 Vue kit: the Cockpit's buttons and glyphs are kit controls
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]>
2026-11-19 10:46:39 -08:00

51 lines
1.8 KiB
Vue

<script setup>
import { storeToRefs } from 'pinia';
import { computed } from 'vue';
import { t } from '../../../i18n/index.js';
import { createRouteState } from '../../cockpitInstrumentState.js';
import { useCockpitStore } from '../../stores/cockpit.js';
import UiIcon from '../../kit/UiIcon.vue';
// The Cockpit flight plan card. The Cockpit controller presents the route's
// endpoints and whether a destination direction exists; until it does, the
// card stays hidden.
const { route } = storeToRefs(useCockpitStore());
const initial = createRouteState();
const r = computed(() => route.value ?? initial);
// A provider subject's card is titled by its provider, in the page's language.
const kicker = computed(() =>
r.value.kind === 'subject'
? r.value.title
: r.value.kind === 'vessel'
? t('REPORTED VOYAGE')
: t('ESTIMATED FLIGHT PLAN'),
);
const label = computed(() =>
r.value.kind === 'subject'
? r.value.title || undefined
: r.value.kind === 'vessel'
? t('Reported voyage')
: t('Estimated flight plan'),
);
</script>
<template>
<section id="cockpit-route" class="cockpit-route-card" :aria-label="label" :hidden="!r.visible">
<div class="cockpit-route-heading">
<span class="cockpit-route-kicker">{{ kicker }}</span>
<small id="cockpit-route-status">{{ r.status }}</small>
</div>
<div class="cockpit-route-endpoints">
<div v-if="r.kind !== 'vessel'" class="cockpit-route-airport">
<span>{{ t('FROM') }}</span>
<strong id="cockpit-route-from">{{ r.from }}</strong>
</div>
<UiIcon v-if="r.kind !== 'vessel'" name="east" class="cockpit-route-arrow" :size="null" />
<div class="cockpit-route-airport">
<span>{{ t('TO') }}</span>
<strong id="cockpit-route-to">{{ r.to }}</strong>
</div>
</div>
</section>
</template>