Merge branch 'main' into fix/cockpit-subject-camera-hud

This commit is contained in:
German Khokhlov authored and GitHub committed 2026-11-19 00:28:46 +04:00
commit ee0440e813
363 files changed
+13745 -1912

No files matched your search

+11 -1
View File
@@ -106,6 +106,9 @@ export class StyleManager extends ShellFacade {
* @param {object} [options]
* @param {boolean} [options.localePicker=true] - false removes the language
* picker, for a host that offers its own language choice.
* @param {{lon: number, lat: number, height: number, heading?: number,
* pitch?: number}|null} [options.homeView] - where the title's logo goes
* back to (degrees): the view the app started from.
*/
constructor(
viewer,
@@ -116,6 +119,7 @@ export class StyleManager extends ShellFacade {
requestServices,
initialShareCode = null,
localePicker = true,
homeView = null,
} = {},
) {
super();
@@ -341,6 +345,7 @@ export class StyleManager extends ShellFacade {
this._locationNavigation = new LocationNavigation({
viewer,
placeSearch,
homeView,
navigation: this._navigation,
readCockpit: () => this.cockpitView,
services: {
@@ -1717,7 +1722,12 @@ export class StyleManager extends ShellFacade {
const store = useGlobeActionsStore(applicationPinia());
if (this._resetToken) store.detach(this._resetToken);
this._resetToken = controls
? store.connect({ reset: () => controls.reset() })
? store.connect({
reset: () => controls.reset(),
home: () => {
if (!this._disposed) void this.returnToStart();
},
})
: null;
// A reset under way as the controls are replaced stays on the buttons.
if (this._resetToken && this._globeResetting != null)
+40
View File
@@ -7,6 +7,7 @@ import assert from 'node:assert/strict';
import { createPinia } from 'pinia';
import { createApp, defineComponent, h, nextTick } from 'vue';
import { CockpitViewController } from './cockpitController.js';
import { setLocale } from '../i18n/index.js';
import { useCockpitStore } from './stores/cockpit.js';
import CockpitView from './views/CockpitView.vue';
import ContextView from './views/ContextView.vue';
@@ -413,6 +414,33 @@ test('the bridge radar shows nearby ships without its own and steps its range',
assert.ok(!$('#cockpit-radar') || $('#cockpit-radar').hidden);
});
test('the radar range and ring spacing agree with their distance (ru)', async (t) => {
const { $, cockpit } = fixture(t);
t.after(() => setLocale('en'));
setLocale('ru');
cockpit.enter();
await settle();
const shown = () => [
$('#cockpit-radar-range').textContent.trim(),
$('.cockpit-radar-rings').textContent.trim(),
];
// The ring spacing is a fraction at the short ranges: Intl.PluralRules
// gives 0.75 and 1.5 the form of their own.
const expected = [
['3 МОР. МИЛИ', 'КОЛЬЦА 0,75 МОР. МИЛИ'],
['6 МОР. МИЛЬ', 'КОЛЬЦА 1,5 МОР. МИЛИ'],
['12 МОР. МИЛЬ', 'КОЛЬЦА 3 МОР. МИЛИ'],
['24 МОР. МИЛИ', 'КОЛЬЦА 6 МОР. МИЛЬ'],
];
for (const [index, labels] of expected.entries()) {
if (index) {
$('#cockpit-radar-range').click();
await settle();
}
assert.deepEqual(shown(), labels);
}
});
test('contact navigation does not jump ship from the bridge', async (t) => {
const { cockpit, navigations } = fixture(t);
cockpit.enter();
@@ -1276,6 +1304,18 @@ test('a ship with no true heading is held, and labelled, on its course', async (
signals.some(([, , , detail]) => /COURSE 095°/.test(detail)),
JSON.stringify(signals),
);
// A ship's course has a word of its own: pt RUMO, an aircraft's CURSO.
t.after(() => setLocale('en'));
setLocale('pt');
signals.length = 0;
cockpit.exit();
await settle();
cockpit.enter();
await settle();
assert.ok(
signals.some(([, , , detail]) => /· RUMO 095°$/.test(detail)),
JSON.stringify(signals),
);
});
test('both entries name the subject the same way', async () => {
+5 -2
View File
@@ -1,5 +1,5 @@
/** Instrument values, routes and vision controls for the Cockpit controller. */
import { formatNumber, t } from '../i18n/index.js';
import { formatNumber, t, tn } from '../i18n/index.js';
import {
COCKPIT_VISION_MODES,
normalizeCockpitVisionMode,
@@ -526,7 +526,10 @@ export function updateRadar(info) {
);
this.publishRadar({
...picture,
rangeLabel: t('{range} NM', { range: formatNumber(rangeNm) }),
// A plural, as the ring spacing is: ru «3 МОР. МИЛИ», «12 МОР. МИЛЬ».
rangeLabel: tn(rangeNm, '{range} NM', '{range} NM', {
range: formatNumber(rangeNm),
}),
});
}
+13
View File
@@ -24,6 +24,7 @@ import {
fakeInput,
} from '../input/testDoubles.mjs';
import { CockpitViewController } from './cockpitController.js';
import { setLocale, t as translate } from '../i18n/index.js';
import { useCockpitStore } from './stores/cockpit.js';
import { useHudStore } from './stores/hud.js';
import CockpitView from './views/CockpitView.vue';
@@ -572,6 +573,18 @@ test('a site row turns the camera onto it, holds it, and reads its off-nadir ang
assert.match(held.className, /^track actionable$/);
assert.match(held.detail, /^FOCUS · BASE · OFF-NADIR/);
assert.equal(siteRow(scene, 'alpha').getAttribute('aria-label'), 'Release the camera from Camp Alpha');
// The held site's FOCUS is a status, worded apart from the FOCUS command.
t.after(() => setLocale('en'));
setLocale('es');
await refreshRows(scene);
const heldEs = rows(scene).find((row) => row.target?.id === SITES.alpha.id);
assert.match(heldEs.detail, /^ENFOQUE · /);
assert.match(
$('#cockpit-orbital-focus').textContent,
/^ENFOQUE · /,
'the card names the held site with the same word',
);
assert.equal(translate('FOCUS'), 'ENFOCAR', 'the command keeps its verb');
});
test('another site row switches the focus; the held site row ends it', async (t) => {
+2 -1
View File
@@ -132,7 +132,8 @@ function siteRows(info, { settled = true } = {}) {
}),
});
const words = [installationClassLabel(site.class), angle];
if (focused) words.unshift(t('FOCUS'));
// A status, as on the focus card, not the command: es «ENFOQUE», not «ENFOCAR».
if (focused) words.unshift(t('FOCUS', { context: 'site status' }));
return {
key: `site:${site.id}`,
// The held site reads as the subject does.
+14
View File
@@ -7,6 +7,7 @@ import assert from 'node:assert/strict';
import { createPinia } from 'pinia';
import { createApp, defineComponent, h, nextTick } from 'vue';
import { CockpitViewController } from './cockpitController.js';
import { setLocale } from '../i18n/index.js';
import { useCockpitStore } from './stores/cockpit.js';
import CockpitView from './views/CockpitView.vue';
import ContextView from './views/ContextView.vue';
@@ -260,3 +261,16 @@ test('entering asks for a panel layout before Vue shows the cards', async (t) =>
await new Promise((resolve) => setTimeout(resolve, 50));
assert.deepEqual(laid, ['context', 'signals']);
});
test('an aircraft is acquired on its CURSO in Portuguese; a ship keeps RUMO', async (t) => {
const { cockpit } = fixture(t);
t.after(() => setLocale('en'));
setLocale('pt');
const signals = [];
cockpit.pushCockpitSignal = (...args) => signals.push(args);
cockpit.enter();
await nextTick();
const acquired = signals.find(([key]) => key === 'track');
assert.ok(acquired, JSON.stringify(signals));
assert.equal(acquired[3], 'UAL123 · CURSO 092°');
});
+3 -1
View File
@@ -686,9 +686,11 @@ export function enter({ kind = null } = {}) {
'track',
t('TRACK ACQUIRED'),
// A ship with no true heading is held on its course over ground; one
// with neither is named without a direction.
// with neither is named without a direction. A ship's course has a
// word of its own: pt «RUMO», where an aircraft's is «CURSO».
info.trackSource === 'course'
? t('{label} · COURSE {heading}°', {
context: 'vessel',
label: info.name,
heading: trackHeading,
})
+2 -1
View File
@@ -1,5 +1,6 @@
import { t } from '../i18n/index.js';
import { spaceMissionsIndexFailure } from './contextActions.js';
import { translateStatusMessage } from './statusText.js';
import { shouldExpandGlobalContextPanel } from '../rightRailPolicy.js';
export function _initGlobalContextPanel() {
@@ -112,7 +113,7 @@ export function _initGlobalContextPanel() {
if (this.destroyed || searched === false) return false;
const stats = this.installations.getStats?.();
this.showToast(
stats?.statusMessage ||
(stats?.statusMessage && translateStatusMessage(stats.statusMessage)) ||
(stats?.status === 'zoom-in'
? t('Zoom in to search mapped installations')
: t('Nearby installations refreshed')),
+32
View File
@@ -48,3 +48,35 @@ test('the FPS readout sits in the title bar, hidden until the backquote key', as
await nextTick();
assert.equal(readout(), null);
});
test('the title logo is a button that asks for the way back to live at the start view', async (t) => {
document.body.replaceChildren();
const pinia = createPinia();
const app = createApp(SceneChromeView).use(pinia);
app.mount(document.body.appendChild(document.createElement('div')));
t.after(() => app.unmount());
const { useGlobeActionsStore } = await import('./stores/globeActions.js');
const calls = [];
useGlobeActionsStore(pinia).connect({ home: () => calls.push('home') });
const logo = document.querySelector('#title-bar h1 > button.title-logo');
assert.ok(logo, 'the logo is the title heading’s button');
assert.equal(
logo.getAttribute('aria-label'),
'Back to live at the starting view',
);
assert.ok(logo.hasAttribute('data-logo-gaze'));
logo.click();
assert.deepEqual(calls, ['home']);
});
test('the title heading keeps its own name beside the logo button', async (t) => {
document.body.replaceChildren();
const app = createApp(SceneChromeView).use(createPinia());
app.mount(document.body.appendChild(document.createElement('div')));
t.after(() => app.unmount());
const heading = document.querySelector('#title-bar h1');
const named = document.getElementById(
heading.getAttribute('aria-labelledby'),
);
assert.equal(named.textContent.replace(/\s+/g, ' ').trim(), "GOD'S EYE VIEW");
});
+9
View File
@@ -158,6 +158,15 @@ export class LayerBindings {
});
this._weatherShellModules.push(news);
}
// Bike share flies into a covered city from its marker the same way.
const bikeshare = this._dataManager?.layers?.get('bikeshare')?.module;
if (typeof bikeshare?.attachShellServices === 'function') {
bikeshare.attachShellServices({
runNavigation: (navigate) =>
this.runImmediateNavigation('bike share', navigate),
});
this._weatherShellModules.push(bikeshare);
}
}
_persistAwarenessSelection(event, cleared = false) {
+25 -7
View File
@@ -3,6 +3,7 @@ import { stopFollowing } from '../data/followed.js';
import { t } from '../i18n/index.js';
import { createStateChannel } from '../app/stateChannel.js';
import { LocationControls } from './location.js';
import { worldClock } from '../time/worldClock.js';
/** Own destination selection, lookup, orbit and world-jump lifetime. */
export class LocationNavigation {
@@ -14,10 +15,11 @@ export class LocationNavigation {
navigation,
readCockpit,
operations,
homeView = null,
}) {
Object.assign(
this,
{ viewer, placeSearch, services, navigation, readCockpit },
{ viewer, placeSearch, services, navigation, readCockpit, homeView },
elements,
operations,
);
@@ -315,7 +317,24 @@ export class LocationNavigation {
}
}
resetToGlobeView() {
/**
* Back to live, at the view the app started from (the logo): the world
* clock goes live and the camera flies to the start view as the globe reset
* does, letting go of whatever it follows.
*/
returnToStart() {
if (!this._disposed) worldClock.goLive();
if (!this.homeView) return this.resetToGlobeView();
// A globe reset under way flies elsewhere: this one replaces it.
this._cancelGlobeReset?.();
return this.resetToGlobeView({ view: this.homeView });
}
/**
* Fly out to the full globe over the current spot, or to `view` (the start
* view's shape: `{ lon, lat, height, heading?, pitch? }`, degrees).
*/
resetToGlobeView({ view = null } = {}) {
const {
GLOBE_VIEW,
flyToGlobeView,
@@ -374,6 +393,7 @@ export class LocationNavigation {
camera?.release();
this._beginWorldJumpTransition();
const heightM = view?.height ?? GLOBE_VIEW.heightM;
let resolveReset;
const resetPromise = new Promise((resolve) => {
resolveReset = resolve;
@@ -391,7 +411,7 @@ export class LocationNavigation {
ok: !cancelled,
action: 'zoom_to_globe',
cancelled,
heightKm: Math.round(GLOBE_VIEW.heightM / 1000),
heightKm: Math.round(heightM / 1000),
centeredOn: {
latitude: Number.isFinite(pose?.lat)
? Number(pose.lat.toFixed(2))
@@ -409,15 +429,13 @@ export class LocationNavigation {
this._cancelGlobeReset = () => finish(true);
timer = window.setTimeout(() => {
const height = findCamera(this.viewer)?.pose().height;
finish(
!Number.isFinite(height) ||
Math.abs(height - GLOBE_VIEW.heightM) > 1000,
);
finish(!Number.isFinite(height) || Math.abs(height - heightM) > 1000);
}, 4200);
this._publishGlobeResetting?.(true);
const target = flyToGlobeView(this.viewer, {
onComplete: () => finish(false),
onCancel: () => finish(true),
...(view ? { view } : {}),
});
if (!target) finish(true);
return resetPromise;
+34 -11
View File
@@ -1,6 +1,6 @@
<script setup>
import { computed } from 'vue';
import { t } from '../../i18n/index.js';
import { formatNumber, t, tn } from '../../i18n/index.js';
import UiButton from '../kit/UiButton.vue';
import UiEmpty from '../kit/UiEmpty.vue';
import UiSelect from '../kit/UiSelect.js';
@@ -63,9 +63,15 @@ const categoryOptions = computed(() => [
const windowOptions = computed(() =>
(props.view?.windowChoices ?? []).map((hours) => ({
value: String(hours),
label: t('Last {hours} h', { hours }),
label: lastHours(hours),
})),
);
// The window offers 1 h, so every hour count is a plural: es «Última 1 h».
function lastHours(hours) {
return tn(hours, 'Last {hours} h', 'Last {hours} h', {
hours: formatNumber(hours),
});
}
// The longest choice is the server's whole window, kept as no choice.
const chooseWindow = (hours) =>
setFilter('hours', hours === props.view?.windowChoices?.[0] ? null : hours);
@@ -109,7 +115,16 @@ const clear = () => props.onParams({ clear: true });
<section
v-if="view"
class="news-readout"
:aria-label="t('News, last {hours} hours', { hours: view.windowHours })"
:aria-label="
tn(
view.windowHours,
'News, last {hours} hour',
'News, last {hours} hours',
{
hours: formatNumber(view.windowHours),
},
)
"
>
<UiSelect
v-if="windowOptions.length > 1"
@@ -120,7 +135,7 @@ const clear = () => props.onParams({ clear: true });
@update:model-value="chooseWindow(Number($event))"
/>
<p v-else class="news-readout__window ui-mono">{{
t('Last {hours} h', { hours: view.windowHours })
lastHours(view.windowHours)
}}</p>
<div
class="news-readout__sections"
@@ -196,9 +211,12 @@ const clear = () => props.onParams({ clear: true });
v-else-if="!view.inView.items.length && !view.inView.loading"
class="news-readout__empty"
:title="
t('Nothing reported near here in the last {hours} h', {
hours: view.windowHours,
})
tn(
view.windowHours,
'Nothing reported near here in the last {hours} h',
'Nothing reported near here in the last {hours} h',
{ hours: formatNumber(view.windowHours) },
)
"
/>
<ol
@@ -223,7 +241,9 @@ const clear = () => props.onParams({ clear: true });
class="news-readout__section"
:aria-label="t('Latest news')"
>
<h3 class="news-readout__head ui-mono">{{ t('Latest') }}</h3>
<h3 class="news-readout__head ui-mono">{{
t('Latest', { context: 'news list' })
}}</h3>
<UiEmpty
v-if="view.key"
class="news-readout__empty"
@@ -247,9 +267,12 @@ const clear = () => props.onParams({ clear: true });
v-else-if="!view.loading && !view.error"
class="news-readout__empty"
:title="
t('No news matches these filters in the last {hours} h', {
hours: view.windowHours,
})
tn(
view.windowHours,
'No news matches these filters in the last {hours} h',
'No news matches these filters in the last {hours} h',
{ hours: formatNumber(view.windowHours) },
)
"
/>
<div class="news-readout__footer">
+49
View File
@@ -1,6 +1,7 @@
import '../testSupport/registerDom.mjs';
import test from 'node:test';
import assert from 'node:assert/strict';
import { setLocale } from '../i18n/index.js';
import { createNewsPanel } from './newsPanel.js';
import {
NEWS_CATEGORIES,
@@ -385,6 +386,54 @@ test('the window choice offers shorter windows; the longest is the server window
assert.deepEqual(calls.at(-1)[1], { filters: { hours: null } });
});
test('the time window agrees with its number of hours', (t) => {
t.after(() => setLocale('en'));
setLocale('es');
const { news, panel } = fixture();
news.update(view({ windowHours: 24, windowChoices: [24, 12, 6, 3, 1] }));
const choice = panel.querySelector(
'select.news-readout__window-choice, .news-readout__window-choice select',
);
assert.deepEqual(
[...choice.options].map((option) => option.textContent),
['Últimas 24 h', 'Últimas 12 h', 'Últimas 6 h', 'Últimas 3 h', 'Última 1 h'],
);
news.update(view({ windowHours: 1, items: [], hasMore: false }));
assert.equal(
panel.querySelector('.news-readout__window').textContent,
'Última 1 h',
);
assert.equal(
panel.querySelector('.news-readout').getAttribute('aria-label'),
'Noticias de la última 1 hora',
);
assert.match(
panel.textContent,
/En la última 1 h no hay noticias que coincidan con estos filtros/,
);
setLocale('ru');
news.update(view({ windowHours: 1, items: [], hasMore: false }));
assert.equal(
panel.querySelector('.news-readout').getAttribute('aria-label'),
'Новости за последний 1 час',
);
news.update(view({ windowHours: 12, items: [], hasMore: false }));
assert.equal(
panel.querySelector('.news-readout').getAttribute('aria-label'),
'Новости за последние 12 часов',
);
news.destroy();
});
test('the Latest news heading agrees with the news it heads (fr)', (t) => {
t.after(() => setLocale('en'));
setLocale('fr');
const { news, panel } = fixture();
news.update(view());
assert.equal(panel.querySelector('.news-readout__head').textContent, 'Dernières');
news.destroy();
});
test('the panel names the window the server serves', () => {
const { news, panel } = fixture();
news.update(view({ windowHours: 12 }));
+3
View File
@@ -48,6 +48,8 @@ export class SceneControls {
this.run('renameShot', sceneId, shotId, title),
load: (sceneId, shotId) => this.run('load', sceneId, shotId),
remove: (sceneId, shotId) => this.deleteShot(sceneId, shotId),
move: (sceneId, shotId, index) =>
this.run('moveShot', sceneId, shotId, index),
create: () => this.createScene(),
deleteScene: () => this.deleteSelectedScene(),
stories: () => this.run('stories'),
@@ -110,6 +112,7 @@ export class SceneControls {
'shot-captured',
'shot-updated',
'shot-renamed',
'shot-moved',
'shot-deleted',
'project-imported',
].includes(type)
+78 -4
View File
@@ -98,6 +98,7 @@ function fixture() {
'download',
'load',
'deleteShot',
'moveShot',
].map((name) => [
name,
(...args) => {
@@ -219,22 +220,30 @@ test('Scene controls dispatch panel and shot-row actions, and rows outlive repub
await nextTick();
const row = f.elements.shots.children[0];
const label = f.label();
const load = row.children[0].children[1].children[0];
const [up, down, del] = row.children[0].children[1].children;
f.elements.capture.click();
f.elements.start.click();
// A click on the row goes to the shot: selected and loaded.
label.click();
label.dispatchEvent(new Event('dblclick'));
await nextTick();
label.children[0].value = 'Renamed';
// A click in the name being typed goes nowhere.
label.children[0].click();
label.children[0].dispatchEvent(new Event('blur'));
load.click();
assert.deepEqual(f.calls, [
['capture'],
['start', 'scene-a'],
['selectShot', 'shot-a'],
['renameShot', 'scene-a', 'shot-a', 'Renamed'],
['load', 'scene-a', 'shot-a'],
['renameShot', 'scene-a', 'shot-a', 'Renamed'],
]);
// A lone shot has nowhere to move; the buttons never load it.
assert.equal(up.disabled, true);
assert.equal(down.disabled, true);
window.confirm = () => false;
del.click();
assert.equal(f.calls.length, 5);
f.owner.renderShotList();
await nextTick();
assertSameNode(f.elements.shots.children[0], row);
@@ -246,7 +255,10 @@ test('Scene controls dispatch panel and shot-row actions, and rows outlive repub
f.owner.destroy();
await nextTick();
f.label().click();
assert.deepEqual(f.calls.at(-1), ['selectShot', 'shot-a']);
assert.deepEqual(f.calls.slice(-2), [
['selectShot', 'shot-a'],
['load', 'scene-a', 'shot-a'],
]);
newer.destroy();
await nextTick();
assert.equal(f.elements.shots.children.length, 0);
@@ -255,6 +267,68 @@ test('Scene controls dispatch panel and shot-row actions, and rows outlive repub
}
});
test('a shot row goes to its shot from the keyboard, and its up and down buttons swap it with a neighbour', async () => {
const f = fixture();
try {
f.state.scenes[0].shots.push(
{ id: 'shot-b', title: 'Shot B', durationSec: 4, holdSec: 0 },
{ id: 'shot-c', title: 'Shot C', durationSec: 4, holdSec: 0 },
);
f.owner.renderShotList();
await nextTick();
const rows = () => [...f.elements.shots.children];
const buttons = (index) => rows()[index].querySelectorAll('button');
const label = (index) => rows()[index].querySelector('.scene-shot-label');
// The title is the row's keyboard control, described by its summary.
const second = label(1);
assert.equal(second.getAttribute('role'), 'button');
assert.equal(second.getAttribute('tabindex'), '0');
const meta = document.getElementById(
second.getAttribute('aria-describedby'),
);
assert.ok(meta.classList.contains('scene-shot-meta'));
for (const key of ['Enter', ' '])
second.dispatchEvent(
Object.assign(new Event('keydown', { bubbles: true }), { key }),
);
second.dispatchEvent(
Object.assign(new Event('keydown', { bubbles: true }), { key: 'a' }),
);
assert.deepEqual(f.calls, [
['selectShot', 'shot-b'],
['load', 'scene-a', 'shot-b'],
['selectShot', 'shot-b'],
['load', 'scene-a', 'shot-b'],
]);
// Up and down, labelled, disabled at the ends; neither loads the shot.
f.calls.length = 0;
const [firstUp, firstDown] = buttons(0);
assert.equal(firstUp.getAttribute('aria-label'), 'Move up');
assert.equal(firstDown.getAttribute('aria-label'), 'Move down');
assert.equal(firstUp.disabled, true);
assert.equal(firstDown.disabled, false);
assert.equal(buttons(2)[1].disabled, true);
assert.equal(buttons(2)[0].disabled, false);
buttons(1)[0].click();
buttons(1)[1].click();
assert.deepEqual(f.calls, [
['moveShot', 'scene-a', 'shot-b', 0],
['moveShot', 'scene-a', 'shot-b', 2],
]);
// Not while the scene plays.
f.state.running = true;
f.owner.setButtons(true);
await nextTick();
assert.ok(rows().every((_, index) => buttons(index)[0].disabled));
assert.ok(rows().every((_, index) => buttons(index)[1].disabled));
} finally {
f.restore();
}
});
test('Scene Escape and recording presentation follow playback and release on destruction', async () => {
const f = fixture();
const escape = () =>
+5
View File
@@ -1294,6 +1294,11 @@ export class ShellFacade {
return this._locationNavigation.resetToGlobeView(...args);
}
/** Back to live, at the view the app started from (the title's logo). */
returnToStart() {
return this._locationNavigation.returnToStart();
}
/**
* Displays a temporary toast notification for 2 seconds.
* @param {string} message - Text to show in the toast.
+26 -2
View File
@@ -3,6 +3,7 @@ import test from 'node:test';
import { LocationNavigation } from './locationNavigation.js';
import { LayerBindings } from './layerBindings.js';
import { bindRenderer } from '../render/rendererOf.js';
import { worldClock } from '../time/worldClock.js';
function replaceWindow(t, value) {
const previous = Object.getOwnPropertyDescriptor(globalThis, 'window');
@@ -13,12 +14,13 @@ function replaceWindow(t, value) {
});
}
function location(t) {
function location(t, { homeView = null } = {}) {
t.mock.timers.enable({ apis: ['setTimeout'] });
replaceWindow(t, { setTimeout });
const calls = [];
let hooks;
const owner = new LocationNavigation({
homeView,
viewer: { camera: {
cancelFlight() {}, lookAtTransform() {},
positionCartographic: { latitude: 0, longitude: 0, height: 20000000 },
@@ -26,7 +28,11 @@ function location(t) {
services: {
OrbitController: class { stop() { calls.push('orbit-stop'); } },
GLOBE_VIEW: { heightM: 20000000 },
flyToGlobeView(_viewer, callbacks) { hooks = callbacks; return {}; },
flyToGlobeView(_viewer, callbacks) {
hooks = callbacks;
calls.push(callbacks.view ? `fly ${callbacks.view.lat},${callbacks.view.lon}` : 'fly here');
return {};
},
interruptCameraMotion() {},
militaryAwarenessLayer: {}, satellitesLayer: {}, rocketLaunchesLayer: {},
trafficLayer: {
@@ -60,6 +66,24 @@ test('shell disposal settles a pending globe reset once and revokes its timeout'
assert.equal((await owner.resetToGlobeView()).cancelled, true);
});
test('the logo goes live and flies to the home view, replacing a globe reset under way', async (t) => {
const { owner, calls, readHooks } = location(t, {
homeView: { lon: -82.5, lat: 35, height: 23000000 },
});
worldClock.seek(Date.now() - 3 * 3600 * 1000);
assert.equal(worldClock.isLive(), false);
const reset = owner.resetToGlobeView();
const home = owner.returnToStart();
assert.notEqual(home, reset);
assert.equal((await reset).cancelled, true);
assert.equal(worldClock.isLive(), true);
assert.deepEqual(calls.filter((c) => c.startsWith('fly')), ['fly here', 'fly 35,-82.5']);
readHooks().onComplete();
assert.equal((await home).cancelled, false);
assert.equal((await home).heightKm, 23000);
owner.destroy();
});
test('world jump completion cannot revive navigation after shell disposal', (t) => {
const { owner, calls } = location(t);
let complete;
+49 -1
View File
@@ -242,9 +242,57 @@ const STATUS_PIECE_PATTERNS = [
],
];
// Shapes of installationFeedback() (data/installationFeedback.js), which stays
// English for the analyst. Keep them in step with its wording.
const MAPPED_SITE_PATTERNS = [
[
/^(.+) — retrying in (\d+)s$/,
([, reason, seconds]) =>
t('{reason} — retrying in {seconds}s', {
reason: translateKnown(reason),
seconds,
}),
],
[
/^(.+) — retry pending$/,
([, reason]) =>
t('{reason} — retry pending', { reason: translateKnown(reason) }),
],
[/^No mapped sites in view$/, () => t('No mapped sites in view')],
[
/^(\d+) mapped sites? in view$/,
([, count]) =>
tn(
Number(count),
'{count} mapped site in view',
'{count} mapped sites in view',
),
],
[
/^No mapped sites within (\d+) km of the contact$/,
([, km]) =>
t('No mapped sites within {km} km of the contact', {
km: formatNumber(Number(km)),
}),
],
[
/^(\d+) mapped sites? within (\d+) km of the contact$/,
([, count, km]) =>
tn(
Number(count),
'{count} mapped site within {km} km of the contact',
'{count} mapped sites within {km} km of the contact',
{ km: formatNumber(Number(km)) },
),
],
];
// First match wins.
const STATUS_SHAPES = [...STATUS_PIECE_PATTERNS, ...MAPPED_SITE_PATTERNS];
/** A status piece by its shape in the UI language, or null. */
function statusPatternText(piece) {
for (const [pattern, format] of STATUS_PIECE_PATTERNS) {
for (const [pattern, format] of STATUS_SHAPES) {
const match = pattern.exec(piece);
if (match) return format(match);
}
+2
View File
@@ -8,6 +8,8 @@ import { computed, markRaw, shallowRef } from 'vue';
* @property {(sceneId: string, shotId: string, title: string) => void} rename
* @property {(sceneId: string, shotId: string) => void} load
* @property {(sceneId: string, shotId: string) => void} remove
* @property {(sceneId: string, shotId: string, index: number) => void} move
* Move a shot to `index` in its scene's playback order.
* @property {(file: File) => Promise<void>|void} importFile A chosen file.
* @property {() => void} create, deleteScene, stories, thumb, capture, update,
* start, stop, next, export, download The panel's buttons.
+17
View File
@@ -632,6 +632,23 @@ body.cockpit-mode #cockpit-cloud-effects.active {
filter: drop-shadow(0 0 12px rgba(0, 246, 255, 0.5));
}
/* The logo is a button: back to live at the start view. */
#title-bar button.title-logo {
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
cursor: pointer;
pointer-events: auto;
}
#title-bar button.title-logo:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 4px;
border-radius: 8px;
}
#title-bar .title-logo::before,
#title-bar .title-logo::after {
--radio-broadcast-opacity: 0.28;
+17
View File
@@ -345,6 +345,7 @@ html:not([lang='en']) #scene-panel .scene-controls .scene-btn {
}
.scene-shot-row {
cursor: pointer;
border: 1px solid rgba(255, 255, 255, 0.12);
border-radius: 9px;
padding: 8px 10px;
@@ -398,6 +399,11 @@ html:not([lang='en']) #scene-panel .scene-controls .scene-btn {
color: var(--scene-quiet);
}
.scene-shot-label:focus-visible {
outline: 1px solid var(--accent);
outline-offset: 2px;
}
.scene-shot-row.active .scene-shot-label::before {
color: var(--accent);
}
@@ -422,9 +428,20 @@ html:not([lang='en']) #scene-panel .scene-controls .scene-btn {
.scene-shot-actions {
display: flex;
align-items: center;
gap: 6px;
}
/* Up and down: the glyph as tall as DEL's word. */
.scene-shot-move {
padding: 3px 4px;
}
.scene-shot-move .ui-icon {
display: block;
line-height: 1;
}
.scene-progress {
margin-top: 8px;
width: 100%;
+1 -1
View File
@@ -86,7 +86,7 @@ async function importChosen(event) {
<UiButton id="scene-update-shot-btn" type="button" :disabled="off('update')" @click="scenes.act('update')" class="gev-action-button scene-btn" :title="t('Replace the selected shot with the current view')">{{ t('UPDATE SHOT') }}</UiButton>
</div>
<SceneShotList />
<p class="scene-shot-hint">{{ t('Click a shot to select it, double-click to rename.') }}</p>
<p class="scene-shot-hint">{{ t('Click a shot to go to it, double-click to rename.') }}</p>
<p class="scene-step-heading">{{ t('PREVIEW') }}</p>
<div class="scene-controls">
<UiButton variant="primary" id="scene-start-btn" type="button" class="gev-action-button scene-btn scene-btn-primary" :title="t('Play from this scene through the rest of the project')" :disabled="off('start')" @click="scenes.act('start')">{{ scene?.playLabel ?? t('PLAY', { context: 'scene' }) }}</UiButton>
+4 -1
View File
@@ -18,9 +18,12 @@ import ScreenAnnotations from './panels/ScreenAnnotations.vue';
import AwarenessDirection from './panels/AwarenessDirection.vue';
import UiButton from '../kit/UiButton.vue';
import GlobeActions from './panels/GlobeActions.vue';
import { useGlobeActionsStore } from '../stores/globeActions.js';
import RenderFailure from './panels/RenderFailure.vue';
import WorldTimeline from './panels/WorldTimeline.vue';
// The title's logo goes back to live at the start view, as the shell answers it.
const globeActions = useGlobeActionsStore();
// The ACTIVE STYLE corner shows the style VisualSettings publishes.
const { style } = storeToRefs(useDisplayStore());
// The status chips, toast and FPS readout show what ShellFeedback,
@@ -74,7 +77,7 @@ const vToastText = {
<!-- Title -->
<div id="title-bar">
<div class="title-glow"></div>
<h1><span class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" aria-hidden="true"><img src="/logo.svg" alt="" /></span> <span translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<h1 aria-labelledby="title-wordmark"><button type="button" class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></button> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<p class="subtitle scene-text-holdout">{{ t('NO PLACE LEFT BEHIND') }}</p>
<div v-if="fps" class="frame-rate-readout scene-text-holdout" :hidden="!fps.visible" :title="t('Rendered globe frames per second · toggle with `')">{{ fps.text }}</div>
</div>
+65 -12
View File
@@ -4,14 +4,19 @@ import { storeToRefs } from 'pinia';
import { t } from '../../i18n/index.js';
import { describeShot } from '../scenePresentation.js';
import UiButton from '../kit/UiButton.vue';
import UiIcon from '../kit/UiIcon.vue';
import { useSceneStore } from '../stores/scenes.js';
import UiEmpty from '../kit/UiEmpty.vue';
// The selected scene's shots. Rows keep their identity across selection so a
// click followed by a double-click lands on the same label.
// click followed by a double-click lands on the same label. A click anywhere
// on a row (or Enter or Space on its title) goes to the shot: it is selected
// and loaded. The row's buttons move it up or down, or delete it.
const store = useSceneStore();
const { scenes, selectedSceneId, selectedShotId, attached } =
const { scenes, selectedSceneId, selectedShotId, attached, panel } =
storeToRefs(store);
const running = computed(() => !!panel.value?.running);
const list = ref(null);
const scene = computed(
() => scenes.value.find((item) => item.id === selectedSceneId.value) ?? null,
);
@@ -41,6 +46,38 @@ function act(name, shot, ...args) {
if (scene.value) store.act(name, scene.value.id, shot.id, ...args);
}
/** What on a row is not for going to the shot: its buttons and the name being typed. */
const NOT_GOING = '.scene-shot-actions, .scene-shot-rename';
/** Go to a shot: select it and load its look, layers and camera. */
function go(shot, event) {
if (isEditing(shot) || !scene.value || event?.target?.closest?.(NOT_GOING))
return;
store.act('select', shot.id);
act('load', shot);
}
function onLabelKey(shot, event) {
if (event.key !== 'Enter' && event.key !== ' ') return;
event.preventDefault();
go(shot);
}
/**
* Swap a shot with its neighbour (`step` -1 up, 1 down). The focus stays on
* the button pressed, or moves to the other one once the shot reaches an end.
*/
async function move(shot, index, step) {
act('move', shot, index + step);
await nextTick();
const row = [...(list.value?.children ?? [])].find(
(item) => item.dataset.sceneShotId === shot.id,
);
const [up, down] = row?.querySelectorAll('.scene-shot-move') ?? [];
const pressed = step < 0 ? up : down;
(pressed && !pressed.disabled ? pressed : step < 0 ? down : up)?.focus();
}
async function startRename(shot) {
if (isEditing(shot) || !scene.value) return;
editing.value = { sceneId: scene.value.id, shotId: shot.id };
@@ -72,7 +109,7 @@ function onRenameKey(shot, event) {
</script>
<template>
<div id="scene-shot-list" class="scene-shot-list ui-scroll">
<div id="scene-shot-list" ref="list" class="scene-shot-list ui-scroll">
<template v-if="attached">
<UiEmpty
v-if="!scene?.shots.length"
@@ -81,17 +118,22 @@ function onRenameKey(shot, event) {
/>
<template v-else>
<div
v-for="shot in scene.shots"
v-for="(shot, index) in scene.shots"
:key="shot.id"
class="scene-shot-row"
:class="{ active: shot.id === selectedShotId }"
:data-scene-shot-id="shot.id"
@click="go(shot, $event)"
>
<div class="scene-shot-top">
<div
class="scene-shot-label"
:title="t('Double-click to rename')"
@click="store.act('select', shot.id)"
:role="isEditing(shot) ? undefined : 'button'"
:tabindex="isEditing(shot) ? undefined : 0"
:aria-current="shot.id === selectedShotId ? 'true' : undefined"
:aria-describedby="`scene-shot-meta-${shot.id}`"
:title="t('Go to this shot. Double-click to rename.')"
@keydown="onLabelKey(shot, $event)"
@dblclick="startRename(shot)"
><input
v-if="isEditing(shot)"
@@ -103,12 +145,21 @@ function onRenameKey(shot, event) {
@blur="finishRename(shot, $event.target, true)"
/><template v-else>{{ shownTitle(shot) }}</template></div
>
<div class="scene-shot-actions">
<div class="scene-shot-actions" @dblclick.stop>
<UiButton
class="gev-action-button gev-action-button--compact scene-shot-btn"
@click="act('load', shot)"
>{{ t('LOAD') }}</UiButton
>
class="gev-action-button gev-action-button--compact scene-shot-btn scene-shot-move"
:label="t('Move up')"
:disabled="running || index === 0"
@click="move(shot, index, -1)"
><UiIcon name="arrow_upward" :size="12"
/></UiButton>
<UiButton
class="gev-action-button gev-action-button--compact scene-shot-btn scene-shot-move"
:label="t('Move down')"
:disabled="running || index === scene.shots.length - 1"
@click="move(shot, index, 1)"
><UiIcon name="arrow_downward" :size="12"
/></UiButton>
<UiButton
tone="alert"
class="gev-action-button gev-action-button--danger gev-action-button--compact scene-shot-btn scene-shot-danger"
@@ -117,7 +168,9 @@ function onRenameKey(shot, event) {
>
</div>
</div>
<div class="scene-shot-meta">{{ describeShot(shot) }}</div>
<div :id="`scene-shot-meta-${shot.id}`" class="scene-shot-meta">
{{ describeShot(shot) }}
</div>
</div>
</template>
</template>
+3 -1
View File
@@ -118,9 +118,11 @@ const ringFractions = computed(() =>
? radar.value.ringsNm.map((ring) => ring / radar.value.rangeNm)
: [],
);
// The spacing is a fraction at the shorter ranges (0.75, 1.5 NM), which
// Intl.PluralRules gives a form of its own: ru «0,75 МОР. МИЛИ».
const ringLabel = computed(() =>
radar.value?.ringsNm.length
? t('RINGS {spacing} NM', {
? tn(radar.value.ringsNm[0], 'RINGS {spacing} NM', 'RINGS {spacing} NM', {
spacing: formatNumber(radar.value.ringsNm[0]),
})
: '',
@@ -163,6 +163,20 @@ test('filters narrow the list as the viewer types and picks', async (t_) => {
assert.deepEqual(shownIds(), ['nasa-eonet-events']);
});
test('the shown count agrees with its number (he)', async (t_) => {
const { owner } = mount(t_);
setLocale('he');
owner.open();
await settle();
const status = () => $('.data-library-status').textContent.trim();
assert.match(status(), /^מוצגים\s+\S*3\S*\s+מתוך/);
const search = $('#data-library input[type="search"]');
search.value = 'eonet';
search.dispatchEvent(new Event('input'));
await settle();
assert.match(status(), /^מוצג\s+\S*1\S*\s+מתוך/);
});
test('Add becomes Remove on the same focused button; Zoom closes first', async (t_) => {
const { owner, library } = mount(t_);
owner.open();
+11 -5
View File
@@ -1,7 +1,7 @@
<script setup>
import { storeToRefs } from 'pinia';
import { computed, nextTick, useTemplateRef, watch } from 'vue';
import { t, tn } from '../../../i18n/index.js';
import { formatNumber, t, tn } from '../../../i18n/index.js';
import UiButton from '../../kit/UiButton.vue';
import UiSelect from '../../kit/UiSelect.js';
import {
@@ -53,12 +53,18 @@ watch(
const tiles = computed(() => libraryStatTiles(props.view.summary));
const themes = computed(() => libraryThemeOptions());
// The words for the shown entries agree with their count: he «מוצג 1».
const status = computed(() =>
props.view.ready
? t('Showing {shown} of {total}', {
shown: props.view.shown.length,
total: props.view.total,
})
? tn(
props.view.shown.length,
'Showing {shown} of {total}',
'Showing {shown} of {total}',
{
shown: formatNumber(props.view.shown.length),
total: formatNumber(props.view.total),
},
)
: t('Checking what this instance serves…'),
);
const resetText = computed(() => {
+7 -1
View File
@@ -216,7 +216,13 @@ test('cyclone readout retains advisory, position, intensity, geometry, coverage,
assert.equal(f.find((n) => n.className === 'rail-card-ramp').hidden, true);
view.destroy();
});
test('identical updates write nothing and status keeps its line through loading and empty text', () => {
test('identical updates write nothing and status keeps its line through loading and empty text', (t) => {
// Ages read in whole minutes: a real clock crossing a minute between the two
// updates would rightly rewrite them.
t.mock.timers.enable({
apis: ['Date'],
now: Date.parse('2026-09-22T01:17:00Z'),
});
const f = fixture();
const view = createWeatherPanel(f);
for (const entries of [