mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The launches layer no longer builds the roster or the selected mission panel as HTML strings in #space-mission-panel-host. It presents both as a plain view and publishes it through subscribePanel(); MissionRoster and MissionDetail render it from the gev-context store and call the layer's panel commands. Replay controls are presented the same way. The roster keeps keyboard focus on the same mission across refreshes, or continues beyond the list when the mission departs, and the row under the pointer takes the preview back on its next movement. Lines a null view rebuilds are translated through t(). Disposing the shell clears the Contacts and Space Missions views.
72 lines
2.1 KiB
JavaScript
72 lines
2.1 KiB
JavaScript
// A launch without a Launch Library status gets our 'Unknown'. The record keeps
|
|
// it English; the mission panel translates it and shows provider statuses as sent.
|
|
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { setLocale } from '../../i18n/index.js';
|
|
import {
|
|
launchStatusAllowsOrbit,
|
|
normalizeRocketLaunches,
|
|
} from '../../data/rocketLaunches.js';
|
|
import { UNKNOWN_LAUNCH_STATUS } from './model.js';
|
|
import { createPanel } from './panel.js';
|
|
|
|
const NOW = new Date('2026-07-27T00:00:00Z');
|
|
|
|
function shownStatus(status) {
|
|
const state = {
|
|
_selectedLaunchId: 'mission-1',
|
|
_launches: [
|
|
{
|
|
id: 'mission-1',
|
|
name: 'Example',
|
|
status,
|
|
payloads: [],
|
|
recoveryStages: [],
|
|
},
|
|
],
|
|
_replayTracks: new Map(),
|
|
};
|
|
return createPanel({
|
|
state,
|
|
parts: {
|
|
overlays: { shortMissionLabel: (name) => name },
|
|
policyHelpers: { missionPathPresentation: () => ({}) },
|
|
replay: { presentReplay: () => ({}) },
|
|
},
|
|
}).presentMission().status;
|
|
}
|
|
|
|
test('a launch without a status keeps the English fallback in its record', () => {
|
|
const [launch] = normalizeRocketLaunches(
|
|
{
|
|
results: [
|
|
{
|
|
id: 'no-status',
|
|
name: 'Test Flight',
|
|
net: '2026-07-20T10:00:00Z',
|
|
pad: {
|
|
name: 'Pad A',
|
|
location: { name: 'Test Range', coordinates: '12.5,45.5' },
|
|
},
|
|
},
|
|
],
|
|
},
|
|
NOW,
|
|
);
|
|
assert.equal(UNKNOWN_LAUNCH_STATUS, 'Unknown');
|
|
assert.equal(launch.status, 'Unknown');
|
|
assert.equal(launchStatusAllowsOrbit(launch.status), true);
|
|
});
|
|
|
|
test('the mission panel translates only the fallback status', (t) => {
|
|
t.after(() => setLocale('en'));
|
|
setLocale('en');
|
|
assert.equal(shownStatus(UNKNOWN_LAUNCH_STATUS), 'Unknown');
|
|
setLocale('ru');
|
|
assert.equal(shownStatus(UNKNOWN_LAUNCH_STATUS), 'Неизвестно');
|
|
assert.equal(shownStatus('Go for Launch'), 'Go for Launch');
|
|
setLocale('es');
|
|
assert.equal(shownStatus(UNKNOWN_LAUNCH_STATUS), 'Desconocido');
|
|
assert.equal(shownStatus('Launch Successful'), 'Launch Successful');
|
|
});
|