mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 02:02:21 +00:00
Vue kit: the command dock's and Context's buttons and glyphs are kit controls
The command dock's six style buttons, its two tray toggles, Location's collapse and the search toggle are ghost UiButtons. The style buttons are pressed toggles with `active` as their pressed class (Normal is pressed until a style is published), so they now carry aria-pressed. The Context panel's two tabs, Contacts, the cockpit entry and SEARCH NEARBY SITES are ghost UiButtons; the tabs and Contacts stay role="tab" controls with aria-selected and their own active class. The view context it shows while nothing is picked (an off layer's worldwide tile, an item's row, the place and layer chips and Ask GEV) is on the kit too; the worldwide tile is a div or a UiButton rather than a dynamic component. Every Material glyph in the three templates is a UiIcon with :size="null", so the site rules still size them; an item's motion glyph keeps role="img" and its name, with the kit's aria-hidden taken off. src/ui/kit/commandDockControls.test.mjs pins it; the markup tests that matched the old button source or class text read the kit's markup, and docs/VUE-MIGRATION.md describes the surface. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
e705fdea82
commit
f9ca76df98
11 files changed
+223
-62
No files matched your search
@@ -194,12 +194,12 @@ test('Cockpit vision cycle exposes every map preset exactly once', () => {
|
||||
|
||||
test('Contacts uses the approved radar icon', () => {
|
||||
const button = html.match(
|
||||
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
);
|
||||
assert.ok(button, 'Contacts button is missing');
|
||||
assert.match(
|
||||
button[0],
|
||||
/material-symbols-outlined" aria-hidden="true">radar<\/span>/,
|
||||
/material-symbols-outlined"[^>]*aria-hidden="true">radar<\/span>/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1231,7 +1231,7 @@ test('Cockpit Contact navigation omits the redundant Focus camera action', () =>
|
||||
|
||||
test('Global Context names its mixed contact cycle without changing the stable mode id', () => {
|
||||
const match = html.match(
|
||||
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
);
|
||||
assert.ok(match, 'Global Context contacts button is missing');
|
||||
assert.match(match[0], />CONTACTS</);
|
||||
|
||||
@@ -25,12 +25,12 @@ const css = readStylesheet(new URL('../style.css', import.meta.url));
|
||||
|
||||
test('Contacts stays in the keyboard sequence and Space Missions owns its rail item', () => {
|
||||
const button = html.match(
|
||||
/<button id="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
/<button\b[^>]*\bid="global-context-flights-btn"[\s\S]*?<\/button>/,
|
||||
)?.[0];
|
||||
assert.ok(button, 'Contacts control is missing');
|
||||
assert.match(button, /role="tab"/);
|
||||
assert.match(button, /tabindex="0"/);
|
||||
const tag = contextView.match(/<button id="global-context-flights-btn"[^>]*>/)?.[0];
|
||||
const tag = contextView.match(/<UiButton id="global-context-flights-btn"[^>]*>/)?.[0];
|
||||
assert.ok(tag, 'Contacts control is missing from the view');
|
||||
assert.doesNotMatch(tag, /:tabindex|:disabled|\sdisabled/);
|
||||
assert.doesNotMatch(html, /id="global-context-missions-btn"/);
|
||||
@@ -111,7 +111,7 @@ test('Context async action buttons remain focused while busy', () => {
|
||||
assert.match(init, /if \(this\._installationsSearchBusy\) return;/);
|
||||
assert.doesNotMatch(init, /\.disabled\s*=\s*true/);
|
||||
const search = contextView.match(
|
||||
/<button id="installations-search-btn"[^>]*>/,
|
||||
/<UiButton id="installations-search-btn"[^>]*>/,
|
||||
)?.[0];
|
||||
assert.ok(search, 'nearby sites search is missing');
|
||||
assert.doesNotMatch(search, /:disabled|\sdisabled/);
|
||||
|
||||
@@ -294,7 +294,7 @@ test('Location markup provides one named native disclosure linked to its popover
|
||||
assert.match(locationToggleMarkup[2], /class="location-toolbar-label"/);
|
||||
assert.doesNotMatch(locationToggleMarkup[2], /<button\b/);
|
||||
assert.match(locationMarkup.slice(locationToggleMarkup.index + locationToggleMarkup[0].length),
|
||||
/^\s*<button class="panel-collapse-btn" data-collapse-target="location-bar"/);
|
||||
/^\s*<button type="button" class="[^"]*\bpanel-collapse-btn\b[^"]*"[^>]*\sdata-collapse-target="location-bar"/);
|
||||
assert.match(locationMarkup, /<div id="location-bar-popover" class="dock-popover-content">/);
|
||||
});
|
||||
|
||||
|
||||
@@ -349,7 +349,7 @@ test('the Visual Presets tray owns Map Source and the retired left panel is abse
|
||||
);
|
||||
assert.match(
|
||||
html,
|
||||
/<button id="control-panel-toggle"[\s\S]*?data-dock-toggle-target="control-panel"[\s\S]*?aria-controls="control-panel-popover"/,
|
||||
/<button\b[^>]*\bid="control-panel-toggle"[\s\S]*?data-dock-toggle-target="control-panel"[\s\S]*?aria-controls="control-panel-popover"/,
|
||||
'the compact wing must expose a semantic keyboard disclosure',
|
||||
);
|
||||
const panels = readFileSync(
|
||||
|
||||
@@ -58,7 +58,10 @@ test('before ContextControls renders, the switch shows its initial markup', (t)
|
||||
);
|
||||
assert.equal(panel.hasAttribute('data-context-mode'), false);
|
||||
const tab = $('global-context-flights-btn');
|
||||
assert.equal(tab.className, 'context-mode-button');
|
||||
assert.equal(
|
||||
tab.className,
|
||||
'ui-button ui-focus ui-button--ghost ui-button--accent context-mode-button',
|
||||
);
|
||||
assert.equal(tab.getAttribute('aria-selected'), 'false');
|
||||
assert.equal(tab.getAttribute('tabindex'), '0');
|
||||
assert.equal(tab.hasAttribute('aria-busy'), false);
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
// The command dock's and the Context panel's buttons and Material glyphs are
|
||||
// the kit's: neither the dock, the Context view nor the view context it
|
||||
// shows while nothing is picked hand-writes a <button> or a Material Symbols
|
||||
// span. The dock's style buttons are pressed toggles with `active`, its
|
||||
// glyphs (◯ ▦ 🌙 🌡️ ✦ ◐, the search 🔎 and the collapse +) are text
|
||||
// characters, not Material symbols, and stay plain text. Context's tabs and
|
||||
// its Contacts mode button are `role="tab"` controls: they say they are
|
||||
// chosen with `aria-selected` and keep their own `active` class, never
|
||||
// `aria-pressed`.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
/** A view's template block: everything outside script, style and comments. */
|
||||
function template(file) {
|
||||
const source = readFileSync(
|
||||
new URL(`../views/${file}`, import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
return source
|
||||
.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '')
|
||||
.replace(/<!--[\s\S]*?-->/g, '');
|
||||
}
|
||||
// A tag's attributes, read past quoted values so a handler's `=>` does not
|
||||
// end the tag early.
|
||||
const ATTRS = String.raw`(?:[^>"']|"[^"]*"|'[^']*')*`;
|
||||
const tag = (pattern, flags = '') =>
|
||||
new RegExp(pattern.replaceAll('ATTRS', ATTRS), flags);
|
||||
const tags = (markup, name) =>
|
||||
markup.match(tag(String.raw`<${name}\bATTRS>`, 'g')) ?? [];
|
||||
|
||||
const dock = template('CommandDockView.vue');
|
||||
const context = template('ContextView.vue');
|
||||
const inView = template('panels/ViewContext.vue');
|
||||
const views = {
|
||||
// The six style buttons, the two tray toggles and their pins, the map
|
||||
// source chips, Location's collapse, its landmark and city pills and the
|
||||
// search toggle.
|
||||
'CommandDockView.vue': { markup: dock, buttons: 15, icons: 0, closes: 0 },
|
||||
// Search and Expand in the header, the two tabs, Contacts, the cockpit
|
||||
// entry, SEARCH NEARBY SITES and the TR-3B chip.
|
||||
'ContextView.vue': { markup: context, buttons: 8, icons: 7, closes: 0 },
|
||||
// An off layer's worldwide tile, an item's row, the place and layer chips
|
||||
// and Ask GEV; a layer's Turn off is a UiCloseButton. The glyphs: the
|
||||
// header's eye, a worldwide tile's (on and off), a layer group's, an
|
||||
// item's motion and the layer chips' add.
|
||||
'panels/ViewContext.vue': { markup: inView, buttons: 5, icons: 6, closes: 1 },
|
||||
};
|
||||
|
||||
test('the dock and Context hand-write no button; each is a UiButton', () => {
|
||||
for (const [file, { markup, buttons, closes }] of Object.entries(views)) {
|
||||
assert.deepEqual(markup.match(/<button\b/gi) ?? [], [], file);
|
||||
assert.deepEqual(markup.match(/<component\b/gi) ?? [], [], file);
|
||||
assert.equal(tags(markup, 'UiButton').length, buttons, file);
|
||||
assert.equal(tags(markup, 'UiCloseButton').length, closes, file);
|
||||
}
|
||||
});
|
||||
|
||||
test('the style buttons are pressed toggles with active', () => {
|
||||
assert.doesNotMatch(dock, /v-class-toggle="\{[^"]*\bactive\b/);
|
||||
const styles = tags(dock, 'UiButton').filter((b) =>
|
||||
/class="style-btn"/.test(b),
|
||||
);
|
||||
assert.deepEqual(
|
||||
styles.map((b) => b.match(/data-style="(\w+)"/)[1]),
|
||||
['normal', 'retro', 'surveillance', 'thermal', 'anime', 'noir'],
|
||||
);
|
||||
for (const button of styles) {
|
||||
const name = button.match(/data-style="(\w+)"/)[1];
|
||||
assert.match(button, /\spressed-class="active"/, name);
|
||||
// Normal stays the pressed one until a style is published.
|
||||
assert.match(
|
||||
button,
|
||||
name === 'normal'
|
||||
? /\s:pressed="!style \|\| style\.name === 'normal'"/
|
||||
: new RegExp(String.raw`\s:pressed="style\?\.name === '${name}'"`),
|
||||
name,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('no tag hand-writes aria-pressed; the pressed toggles take :pressed', () => {
|
||||
for (const [file, { markup }] of Object.entries(views))
|
||||
assert.doesNotMatch(
|
||||
markup,
|
||||
tag(String.raw`<\w+\bATTRS\s:?aria-pressed`),
|
||||
file,
|
||||
);
|
||||
const pressed = (markup) =>
|
||||
tags(markup, 'UiButton').filter((b) => /\s:pressed=/.test(b)).length;
|
||||
// The six styles, two pins, map sources, landmarks and cities.
|
||||
assert.equal(pressed(dock), 11);
|
||||
// Search, Expand and TR-3B.
|
||||
assert.equal(pressed(context), 3);
|
||||
assert.equal(pressed(inView), 0);
|
||||
});
|
||||
|
||||
test("Context's tabs say they are chosen, not pressed", () => {
|
||||
const tabs = tags(context, 'UiButton').filter((b) => /\srole="tab"/.test(b));
|
||||
assert.equal(tabs.length, 3);
|
||||
for (const button of tabs) {
|
||||
assert.match(button, /\s:aria-selected=/);
|
||||
assert.doesNotMatch(button, /\s:pressed=/);
|
||||
assert.match(button, /\s(?::class|v-class-toggle)="\{ active: /);
|
||||
}
|
||||
});
|
||||
|
||||
test('they hand-write no Material glyph; each is a UiIcon', () => {
|
||||
for (const [file, { markup, icons }] of Object.entries(views)) {
|
||||
assert.deepEqual(
|
||||
markup.match(/material-symbols-outlined/g) ?? [],
|
||||
[],
|
||||
file,
|
||||
);
|
||||
const found = tags(markup, 'UiIcon');
|
||||
assert.equal(found.length, icons, file);
|
||||
// Without it the kit writes an 18px size that beats the site rules.
|
||||
for (const icon of found) assert.match(icon, /\s:size="null"/, file);
|
||||
}
|
||||
// An item's motion glyph is an image with its own name, not decoration.
|
||||
const [motion] = tags(inView, 'UiIcon').filter((i) =>
|
||||
/view-context__row-motion/.test(i),
|
||||
);
|
||||
assert.match(motion, /\srole="img"/);
|
||||
assert.match(motion, /\s:aria-label=/);
|
||||
assert.match(motion, /\s:aria-hidden="null"/);
|
||||
});
|
||||
@@ -72,45 +72,45 @@ function selectMapSource(chip) {
|
||||
<div v-if="slot === 'control'" id="control-panel" v-panel-state="'control-panel'" class="panel-collapsible collapsed">
|
||||
<div class="panel-glow"></div>
|
||||
<div class="panel-inner">
|
||||
<button id="control-panel-toggle" class="panel-header dock-tray-toggle" type="button"
|
||||
<UiButton id="control-panel-toggle" class="panel-header dock-tray-toggle"
|
||||
data-dock-toggle-target="control-panel" :aria-expanded="String(panels['control-panel']?.collapsed === false)"
|
||||
aria-controls="control-panel-popover" :aria-label="trayWords('control-panel', t('VISUAL PRESETS'), t('Expand Visual Presets'))" :title="trayWords('control-panel', t('VISUAL PRESETS'), undefined)">
|
||||
<span class="panel-title"><span class="dock-label-icon dock-label-icon-presets" aria-hidden="true"></span>{{ t('VISUAL PRESETS') }}</span>
|
||||
<span class="panel-divider"></span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<div id="control-panel-popover" class="dock-popover-content">
|
||||
<UiButton class="dock-pin-btn" data-pin-target="control-panel" :label="t('Pin visual presets')" :title="t('Keep visual presets open')" :pressed="!!panels['control-panel']?.pinned" @click="pin($event, 'control-panel')"><img src="/pin.svg" alt="" /></UiButton>
|
||||
<div id="style-buttons" class="button-grid">
|
||||
<button class="style-btn active" data-style="normal" @click="display.act('setStyle', 'normal')" v-class-toggle="{ ...(style && { active: style.name === 'normal' }) }" :title="t('Show the globe without a visual filter.')">
|
||||
<UiButton class="style-btn" data-style="normal" :pressed="!style || style.name === 'normal'" pressed-class="active" @click="display.act('setStyle', 'normal')" :title="t('Show the globe without a visual filter.')">
|
||||
<span class="btn-icon">◯</span>
|
||||
<span class="btn-label">{{ t('Normal') }}</span>
|
||||
<span class="btn-key">1</span>
|
||||
</button>
|
||||
<button class="style-btn" data-style="retro" @click="display.act('setStyle', 'retro')" v-class-toggle="{ ...(style && { active: style.name === 'retro' }) }" :title="t('Emulate a green phosphor CRT with scanlines and screen curvature.')">
|
||||
</UiButton>
|
||||
<UiButton class="style-btn" data-style="retro" :pressed="style?.name === 'retro'" pressed-class="active" @click="display.act('setStyle', 'retro')" :title="t('Emulate a green phosphor CRT with scanlines and screen curvature.')">
|
||||
<span class="btn-icon">▦</span>
|
||||
<span class="btn-label">{{ t('CRT') }}</span>
|
||||
<span class="btn-key">2</span>
|
||||
</button>
|
||||
<button class="style-btn" data-style="surveillance" @click="display.act('setStyle', 'surveillance')" v-class-toggle="{ ...(style && { active: style.name === 'surveillance' }) }" :title="t('Simulate night-vision goggles with green intensification and a tube vignette.')">
|
||||
</UiButton>
|
||||
<UiButton class="style-btn" data-style="surveillance" :pressed="style?.name === 'surveillance'" pressed-class="active" @click="display.act('setStyle', 'surveillance')" :title="t('Simulate night-vision goggles with green intensification and a tube vignette.')">
|
||||
<span class="btn-icon">🌙</span>
|
||||
<span class="btn-label">{{ t('NVG') }}</span>
|
||||
<span class="btn-key">3</span>
|
||||
</button>
|
||||
<button class="style-btn" data-style="thermal" @click="display.act('setStyle', 'thermal')" v-class-toggle="{ ...(style && { active: style.name === 'thermal' }) }" :title="t('Simulate FLIR-style thermal contrast. Turn up Ironbow for color.')">
|
||||
</UiButton>
|
||||
<UiButton class="style-btn" data-style="thermal" :pressed="style?.name === 'thermal'" pressed-class="active" @click="display.act('setStyle', 'thermal')" :title="t('Simulate FLIR-style thermal contrast. Turn up Ironbow for color.')">
|
||||
<span class="btn-icon">🌡️</span>
|
||||
<span class="btn-label">{{ t('FLIR') }}</span>
|
||||
<span class="btn-key">4</span>
|
||||
</button>
|
||||
<button class="style-btn" data-style="anime" @click="display.act('setStyle', 'anime')" v-class-toggle="{ ...(style && { active: style.name === 'anime' }) }" :title="t('Apply bright cel-shaded color and illustrated outlines.')">
|
||||
</UiButton>
|
||||
<UiButton class="style-btn" data-style="anime" :pressed="style?.name === 'anime'" pressed-class="active" @click="display.act('setStyle', 'anime')" :title="t('Apply bright cel-shaded color and illustrated outlines.')">
|
||||
<span class="btn-icon">✦</span>
|
||||
<span class="btn-label">{{ t('Anime') }}</span>
|
||||
<span class="btn-key">5</span>
|
||||
</button>
|
||||
<button class="style-btn" data-style="noir" @click="display.act('setStyle', 'noir')" v-class-toggle="{ ...(style && { active: style.name === 'noir' }) }" :title="t('Apply high-contrast monochrome film-noir grading.')">
|
||||
</UiButton>
|
||||
<UiButton class="style-btn" data-style="noir" :pressed="style?.name === 'noir'" pressed-class="active" @click="display.act('setStyle', 'noir')" :title="t('Apply high-contrast monochrome film-noir grading.')">
|
||||
<span class="btn-icon">◐</span>
|
||||
<span class="btn-label">{{ t('Noir') }}</span>
|
||||
<span class="btn-key">6</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
<section class="map-source-section" aria-labelledby="map-source-label">
|
||||
<div class="map-source-heading">
|
||||
@@ -134,10 +134,10 @@ function selectMapSource(chip) {
|
||||
<div class="panel-glow"></div>
|
||||
<div class="location-inner">
|
||||
<div class="location-toolbar">
|
||||
<button id="location-bar-toggle" class="dock-tray-toggle" type="button" data-dock-toggle-target="location-bar" aria-controls="location-bar-popover" :aria-expanded="String(panels['location-bar']?.collapsed === false)" :aria-label="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))" :title="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))">
|
||||
<UiButton id="location-bar-toggle" class="dock-tray-toggle" data-dock-toggle-target="location-bar" aria-controls="location-bar-popover" :aria-expanded="String(panels['location-bar']?.collapsed === false)" :aria-label="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))" :title="trayWords('location-bar', t('LOCATION'), t('Expand LOCATION'))">
|
||||
<span class="location-toolbar-label"><span class="dock-label-icon dock-label-icon-location" aria-hidden="true"></span>{{ t('LOCATION') }}</span>
|
||||
</button>
|
||||
<button class="panel-collapse-btn" data-collapse-target="location-bar" :title="t('Collapse panel')" @click="chrome.act('toggle', 'location-bar')">+</button>
|
||||
</UiButton>
|
||||
<UiButton class="panel-collapse-btn" data-collapse-target="location-bar" :title="t('Collapse panel')" @click="chrome.act('toggle', 'location-bar')">+</UiButton>
|
||||
</div>
|
||||
<div id="location-mini-status" class="location-mini-status" aria-live="polite">
|
||||
<div id="location-mini-city" class="location-mini-city">{{ loc ? loc.status.city : t('📍 Location: --') }}</div>
|
||||
@@ -150,9 +150,9 @@ function selectMapSource(chip) {
|
||||
<div class="location-city-row">
|
||||
<div id="location-pills" class="location-pills"><UiButton v-for="city in loc?.cities" :key="city.id" class="location-pill" :pressed="Boolean(city.active)" pressed-class="active" :data-location-id="city.id" @click="locationControls?.chooseCity(city.id)">{{ city.label }}</UiButton></div>
|
||||
<div class="location-search-wrap">
|
||||
<button id="search-toggle" class="search-toggle-btn" :title="t('Search any location')" @click="locationControls?.toggleSearch()">
|
||||
<UiButton id="search-toggle" class="search-toggle-btn" :title="t('Search any location')" @click="locationControls?.toggleSearch()">
|
||||
<span>🔎</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
<input type="text" id="location-search" v-class-toggle="{ expanded: !!loc?.searchExpanded, searching: !!loc?.searching }" :placeholder="t('Search any location...')" autocomplete="off" spellcheck="false" :aria-label="t('Search location by name or coordinates')" :aria-invalid="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'true' : null" :aria-describedby="loc?.searchOrigin !== 'omnibar' && loc?.searchError ? 'location-search-error' : null" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -193,17 +193,17 @@ watch(
|
||||
<div class="cyber-panel-body ui-scroll" data-rail-scroller>
|
||||
<UiSearchField v-if="contextSearchOpen" ref="searchInput" v-model="contextSearchText" class="context-search" role="search" input-class="context-search__input" :label="searchHint" :placeholder="searchHint" autocomplete="off" spellcheck="false" :clear-label="t('Clear search')" clear-class="context-search__clear" @escape="closeContextSearch" />
|
||||
<div v-if="availableTabs.length" class="context-tabs" role="tablist" :aria-label="t('Context tabs')">
|
||||
<button id="context-tab-btn-view" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">visibility</span><span class="context-tabs__label">{{ t('Inspector') }}</span>
|
||||
</button>
|
||||
<button id="context-tab-btn-props" type="button" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">tune</span><span class="context-tabs__label">{{ t('Properties') }}</span>
|
||||
</button>
|
||||
<UiButton id="context-tab-btn-view" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'view' }" :aria-selected="String(activeTab === 'view')" aria-controls="context-tab-view" :tabindex="activeTab === 'view' ? 0 : -1" @click="activeTab = 'view'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<UiIcon name="visibility" :size="null" /><span class="context-tabs__label">{{ t('Inspector') }}</span>
|
||||
</UiButton>
|
||||
<UiButton id="context-tab-btn-props" role="tab" class="context-tabs__tab" :class="{ active: activeTab === 'props' }" :aria-selected="String(activeTab === 'props')" aria-controls="context-tab-props" :tabindex="activeTab === 'props' ? 0 : -1" @click="activeTab = 'props'" @keydown.left.prevent="switchTab" @keydown.right.prevent="switchTab">
|
||||
<UiIcon name="tune" :size="null" /><span class="context-tabs__label">{{ t('Properties') }}</span>
|
||||
</UiButton>
|
||||
</div>
|
||||
<!-- Properties: settings of the layers that are on, one section each. -->
|
||||
<div id="context-tab-props" class="context-props" :hidden="activeTab !== 'props'" role="tabpanel" aria-labelledby="context-tab-btn-props">
|
||||
<section v-for="tab in LAYER_TABS" v-show="isShown(tab.id)" :key="tab.id" class="context-props__section">
|
||||
<h4 class="context-props__heading"><span class="material-symbols-outlined" aria-hidden="true">{{ tab.icon }}</span>{{ t(tab.label) }}</h4>
|
||||
<h4 class="context-props__heading"><UiIcon :name="tab.icon" :size="null" />{{ t(tab.label) }}</h4>
|
||||
<ul v-if="affects(tab.id).length" class="context-props__layers">
|
||||
<li v-for="layer in affects(tab.id)" :key="layer.id"><i :style="{ background: layer.color }" aria-hidden="true"></i>{{ layer.name }}</li>
|
||||
</ul>
|
||||
@@ -212,10 +212,10 @@ watch(
|
||||
</div>
|
||||
<RadioPanel />
|
||||
<div class="global-context-modes" role="tablist" :aria-label="t('Context mode')">
|
||||
<button id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" type="button" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">radar</span>
|
||||
<UiButton id="global-context-flights-btn" class="context-mode-button" v-class-toggle="{ active: ctx?.flightsActive }" role="tab" tabindex="0" :aria-selected="String(ctx?.flightsActive ?? false)" :aria-disabled="ctx && String(ctx.busy)" :aria-busy="ctx && String(ctx.busy)" aria-controls="context-flights-view" :aria-label="t('CONTACTS')" :title="t('Cycles the nearest contacts of whatever type you select — planes, vessels, installations. Satellites track independently.')">
|
||||
<UiIcon name="radar" :size="null" />
|
||||
<span>{{ t('CONTACTS') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
<div id="context-mode-standby" class="context-mode-standby" :hidden="ctx?.enabled">
|
||||
<strong>{{ t('SELECT CONTEXT') }}</strong>
|
||||
@@ -223,11 +223,11 @@ watch(
|
||||
</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="t('Contact Context actions')">
|
||||
<button id="cockpit-entry" type="button" :hidden="!cockpit?.entryAvailable">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ entry.icon }}</span>
|
||||
<UiButton id="cockpit-entry" :hidden="!cockpit?.entryAvailable">
|
||||
<UiIcon :name="entry.icon" :size="null" />
|
||||
<span>{{ entry.label }}</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)">{{ t('SEARCH NEARBY SITES') }}</button>
|
||||
</UiButton>
|
||||
<UiButton id="installations-search-btn" class="panel-layer-toggle" :aria-disabled="ctx && String(ctx.installationsBusy)" :aria-busy="ctx && String(ctx.installationsBusy)">{{ t('SEARCH NEARBY SITES') }}</UiButton>
|
||||
<UiButton id="tr3b-toggle" class="tr3b-toggle" :pressed="!!cockpit?.tr3b?.converted" :hidden="!cockpit?.tr3b" :aria-label="t('Reclassify tracked contact as TR-3B')" :title="cockpit?.tr3b?.converted ? t('Restore real aircraft') : t('Reclassify as TR-3B')">🛸</UiButton>
|
||||
</div>
|
||||
<AwarenessPanel v-if="!contactsMatchCard" />
|
||||
|
||||
@@ -10,7 +10,9 @@ import { shownLayerName } from '../../layerNames.js';
|
||||
import { entityKind } from '../../../data/entityContext.js';
|
||||
import SpotConditions from './SpotConditions.vue';
|
||||
import SunDial from './SunDial.vue';
|
||||
import UiButton from '../../kit/UiButton.vue';
|
||||
import UiCloseButton from '../../kit/UiCloseButton.vue';
|
||||
import UiIcon from '../../kit/UiIcon.vue';
|
||||
import AltitudeGraph from './AltitudeGraph.vue';
|
||||
|
||||
// What the Context panel shows while nothing is picked: where the camera is
|
||||
@@ -284,7 +286,7 @@ const distance = (km) =>
|
||||
<h3 v-if="globeView" class="view-context__title">{{ t('Globe view') }}</h3>
|
||||
<template v-else>
|
||||
<header class="view-context__head">
|
||||
<span class="material-symbols-outlined view-context__icon" aria-hidden="true">visibility</span>
|
||||
<UiIcon class="view-context__icon" name="visibility" :size="null" />
|
||||
<div class="view-context__kind">
|
||||
<span>{{ t('In view') }}</span>
|
||||
<span class="view-context__sub">{{ t('Nothing selected') }}</span>
|
||||
@@ -298,11 +300,18 @@ const distance = (km) =>
|
||||
<div v-if="globeView && worldTiles.length" class="view-context__world">
|
||||
<h4>{{ t('Worldwide now') }}</h4>
|
||||
<div class="view-context__world-grid">
|
||||
<component :is="tile.on ? 'div' : 'button'" v-for="tile in worldTiles" :key="tile.id" :type="tile.on ? undefined : 'button'" class="view-context__world-tile" :class="{ 'is-off': !tile.on }" :title="tile.on ? undefined : t('Turn on {name}', { name: tile.name })" @click="tile.on ? undefined : turnOn(tile)">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ tile.icon }}</span>
|
||||
<strong>{{ tile.on ? (tile.count === null ? '…' : formatNumber(tile.count)) : t('Off') }}</strong>
|
||||
<span>{{ tile.name }}</span>
|
||||
</component>
|
||||
<template v-for="tile in worldTiles" :key="tile.id">
|
||||
<div v-if="tile.on" class="view-context__world-tile">
|
||||
<UiIcon :name="tile.icon" :size="null" />
|
||||
<strong>{{ tile.count === null ? '…' : formatNumber(tile.count) }}</strong>
|
||||
<span>{{ tile.name }}</span>
|
||||
</div>
|
||||
<UiButton v-else class="view-context__world-tile is-off" :title="t('Turn on {name}', { name: tile.name })" @click="turnOn(tile)">
|
||||
<UiIcon :name="tile.icon" :size="null" />
|
||||
<strong>{{ t('Off') }}</strong>
|
||||
<span>{{ tile.name }}</span>
|
||||
</UiButton>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -356,24 +365,28 @@ const distance = (km) =>
|
||||
<p class="view-context__total">{{ totalLine }}</p>
|
||||
<div v-for="group in groups" :key="group.layerId" class="view-context__group">
|
||||
<h4>
|
||||
<span class="material-symbols-outlined" aria-hidden="true">{{ group.icon }}</span>
|
||||
<UiIcon :name="group.icon" :size="null" />
|
||||
<span>{{ shownLayerName(group.layerName, group.layerId) }}</span>
|
||||
<span class="view-context__count">{{ group.count }}</span>
|
||||
</h4>
|
||||
<ul>
|
||||
<li v-for="item in group.items" :key="item.key">
|
||||
<button type="button" @click="store.select(item.identity, { fly: true })">
|
||||
<span
|
||||
<UiButton @click="store.select(item.identity, { fly: true })">
|
||||
<!-- A motion glyph is an image with its own name, not decoration. -->
|
||||
<UiIcon
|
||||
v-if="motionOf(item)"
|
||||
class="material-symbols-outlined view-context__row-motion"
|
||||
class="view-context__row-motion"
|
||||
:name="motionOf(item).icon"
|
||||
:size="null"
|
||||
:data-motion="item.identity.record.motion"
|
||||
:title="motionOf(item).label()"
|
||||
role="img"
|
||||
:aria-label="motionOf(item).label()"
|
||||
>{{ motionOf(item).icon }}</span>
|
||||
:aria-hidden="null"
|
||||
/>
|
||||
<span class="view-context__row-title">{{ item.title }}</span>
|
||||
<span class="view-context__row-meta">{{ distance(item.distanceKm) }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -387,7 +400,7 @@ const distance = (km) =>
|
||||
<div v-if="shownTowns.length" class="view-context__towns">
|
||||
<h4>{{ t('Places in view') }}</h4>
|
||||
<div class="view-context__chips">
|
||||
<button v-for="town in shownTowns" :key="town.name" type="button" @click="goToTown(town)">{{ town.name }}</button>
|
||||
<UiButton v-for="town in shownTowns" :key="town.name" @click="goToTown(town)">{{ town.name }}</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -396,16 +409,16 @@ const distance = (km) =>
|
||||
<div v-if="offLayers.length && !globeView" class="view-context__towns">
|
||||
<h4>{{ t('Show here') }}</h4>
|
||||
<div class="view-context__chips">
|
||||
<button v-for="layer in offLayers" :key="layer.id" type="button" class="view-context__chip--layer" @click="turnOn(layer)">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">add</span>{{ layer.name }}
|
||||
</button>
|
||||
<UiButton v-for="layer in offLayers" :key="layer.id" class="view-context__chip--layer" @click="turnOn(layer)">
|
||||
<UiIcon name="add" :size="null" />{{ layer.name }}
|
||||
</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="view-context__actions">
|
||||
<button type="button" class="entity-card__action entity-card__action--ask" @click="store.askAboutView(groups)">
|
||||
<UiButton class="entity-card__action entity-card__action--ask" @click="store.askAboutView(groups)">
|
||||
<svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true"><path d="M4 5h16v11H9l-5 4z" /></svg>{{ t("Ask GEV what's here") }}
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user