mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 09:12:18 +00:00
Merge remote-tracking branch 'origin/main' into sprites/kinds-history-live
This commit is contained in:
commit
a1bcce0f63
54 files changed
+1674
-345
No files matched your search
@@ -857,9 +857,12 @@ export function createGhostMapsLayer({
|
||||
title:
|
||||
days === null
|
||||
? t('Show markers of every age')
|
||||
: t('Maximum event age: {days}d; undated markers are kept', {
|
||||
days: formatNumber(days),
|
||||
}),
|
||||
: tn(
|
||||
days,
|
||||
'Maximum event age: {days}d; undated markers are kept',
|
||||
'Maximum event age: {days}d; undated markers are kept',
|
||||
{ days: formatNumber(days) },
|
||||
),
|
||||
active: days === _ageDays,
|
||||
onClick: () => setAgeDays(days),
|
||||
})),
|
||||
@@ -894,7 +897,7 @@ export function createGhostMapsLayer({
|
||||
};
|
||||
}),
|
||||
legend: [],
|
||||
info: `${_ageDays === null ? t('All markers') : t('Event age: {days}d · undated kept', { days: formatNumber(_ageDays) })} · ${info}`,
|
||||
info: `${_ageDays === null ? t('All markers') : tn(_ageDays, 'Event age: {days}d · undated kept', 'Event age: {days}d · undated kept', { days: formatNumber(_ageDays) })} · ${info}`,
|
||||
infoTitle: t(
|
||||
'S2 Underground publishes these KMZ products to GitHub. New uploads are detected within seconds and replace the previous edition automatically. Click a marker for its report.',
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { setLocale } from '../../i18n/index.js';
|
||||
import { createGhostMapsLayer } from './index.js';
|
||||
import { bindFakeDraw } from '../../testSupport/fakeDrawPort.mjs';
|
||||
import { GHOSTMAPS_PRODUCTS, GHOSTMAPS_LATEST_DROP } from './catalog.js';
|
||||
@@ -310,6 +311,35 @@ test('age controls default to seven days and widening restores filtered and expi
|
||||
assert.equal(ageChip(layer, null).active, true);
|
||||
});
|
||||
|
||||
test('the event age agrees with its number of days', async (t) => {
|
||||
t.after(() => setLocale('en'));
|
||||
const { layer, viewer } = fixture(t, { reports: [{ name: 'Undated' }] });
|
||||
await layer.update(viewer);
|
||||
const info = () =>
|
||||
layer.getRowControls().info.split(' · ').slice(0, 2).join(' · ');
|
||||
assert.equal(
|
||||
ageChip(layer, 1).title,
|
||||
'Maximum event age: 1d; undated markers are kept',
|
||||
);
|
||||
setLocale('de');
|
||||
assert.equal(
|
||||
ageChip(layer, 1).title,
|
||||
'Maximales Ereignisalter: 1 Tag; undatierte Markierungen bleiben erhalten',
|
||||
);
|
||||
assert.equal(
|
||||
ageChip(layer, 7).title,
|
||||
'Maximales Ereignisalter: 7 Tage; undatierte Markierungen bleiben erhalten',
|
||||
);
|
||||
assert.equal(info(), 'Ereignisalter: 7 Tage · undatierte bleiben');
|
||||
await ageChip(layer, 1).onClick();
|
||||
assert.equal(info(), 'Ereignisalter: 1 Tag · undatierte bleiben');
|
||||
setLocale('es');
|
||||
assert.equal(
|
||||
info(),
|
||||
'Antigüedad: 1 día · se conservan los marcadores sin fecha',
|
||||
);
|
||||
});
|
||||
|
||||
test('age preferences persist independently of product choices and reject invalid storage', async (t) => {
|
||||
const values = new Map([['gev.ghostmaps.products', '["cip"]']]);
|
||||
const storage = {
|
||||
|
||||
@@ -69,3 +69,38 @@ test('the mission panel translates only the fallback status', (t) => {
|
||||
assert.equal(shownStatus(UNKNOWN_LAUNCH_STATUS), 'Desconocido');
|
||||
assert.equal(shownStatus('Launch Successful'), 'Launch Successful');
|
||||
});
|
||||
|
||||
test('a confirmed landing position is worded apart from the CONFIRMED sightings chip', (t) => {
|
||||
t.after(() => setLocale('en'));
|
||||
const position = () =>
|
||||
createPanel({
|
||||
state: {
|
||||
_selectedLaunchId: 'mission-1',
|
||||
_launches: [
|
||||
{
|
||||
id: 'mission-1',
|
||||
name: 'Example',
|
||||
status: 'Launch Successful',
|
||||
payloads: [],
|
||||
recoveryStages: [
|
||||
{
|
||||
name: 'B1080',
|
||||
endpoint: { lat: 28.41, lon: -80.6, accuracy: 'CONFIRMED' },
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
_replayTracks: new Map(),
|
||||
},
|
||||
parts: {
|
||||
overlays: { shortMissionLabel: (name) => name },
|
||||
policyHelpers: { missionPathPresentation: () => ({}) },
|
||||
replay: { presentReplay: () => ({}) },
|
||||
},
|
||||
}).presentMission().stages[0].position;
|
||||
assert.match(position(), / · CONFIRMED$/);
|
||||
// One landing, singular: sv BEKRÄFTAD, where the sightings chip says
|
||||
// BEKRÄFTADE.
|
||||
setLocale('sv');
|
||||
assert.match(position(), / · BEKRÄFTAD$/);
|
||||
});
|
||||
@@ -544,7 +544,7 @@ test('retention never revives an incumbent card after the observation window exp
|
||||
test('all heights and the sampled fallback use the same sightings-in-view count label', () => {
|
||||
const h = harness();
|
||||
h.state.renderedRows = [sighting];
|
||||
assert.equal(h.layer.getStats().countLabel, '1 sightings in view');
|
||||
assert.equal(h.layer.getStats().countLabel, '1 sighting in view');
|
||||
h.state.sightingCount = 2000;
|
||||
assert.equal(h.layer.getStats().count, 2000);
|
||||
assert.equal(
|
||||
@@ -562,6 +562,32 @@ test('all heights and the sampled fallback use the same sightings-in-view count
|
||||
}
|
||||
});
|
||||
|
||||
test('the sightings count takes the plural form of its number', (t) => {
|
||||
t.after(() => setLocale('en'));
|
||||
const h = harness();
|
||||
const label = (count) => {
|
||||
h.state.sightingCount = count;
|
||||
return h.layer.getStats().countLabel;
|
||||
};
|
||||
setLocale('ru');
|
||||
assert.equal(label(1), '1 наблюдение в кадре');
|
||||
assert.equal(label(3), '3 наблюдения в кадре');
|
||||
assert.equal(label(5), '5 наблюдений в кадре');
|
||||
setLocale('de');
|
||||
assert.equal(label(1), '1 Beobachtung im Bild');
|
||||
assert.equal(label(2000), '2.000 Beobachtungen im Bild');
|
||||
});
|
||||
|
||||
test('the CONFIRMED chip names the sightings, apart from a confirmed launch landing', (t) => {
|
||||
t.after(() => setLocale('en'));
|
||||
const h = harness();
|
||||
assert.equal(h.chip('quality-confirmed').label, 'CONFIRMED');
|
||||
setLocale('sv');
|
||||
assert.equal(h.chip('quality-confirmed').label, 'BEKRÄFTADE');
|
||||
setLocale('es');
|
||||
assert.equal(h.chip('quality-confirmed').label, 'CONFIRMADOS');
|
||||
});
|
||||
|
||||
test('a stale fallback with a failed-refresh deadline remains DEGRADED, retryable and dated to the cached data', async () => {
|
||||
const h = harness({
|
||||
getSnapshotDetail: async () => ({
|
||||
|
||||
+9
-5
@@ -1,4 +1,4 @@
|
||||
import { t, formatNumber, translateKnown } from '../../i18n/index.js';
|
||||
import { t, tn, formatNumber, translateKnown } from '../../i18n/index.js';
|
||||
import { msg } from '../../i18n/marker.js';
|
||||
import { translateFeedError } from '../../ui/statusText.js';
|
||||
import { wildlifeIconicGroup } from './model.js';
|
||||
@@ -138,7 +138,8 @@ export function createControls({ state, services, parts }) {
|
||||
const chips = [
|
||||
chip({
|
||||
id: WILDLIFE_CONFIRMED_CHIP_ID,
|
||||
label: t('CONFIRMED'),
|
||||
// The sightings, plural; a launch landing is CONFIRMED alone.
|
||||
label: t('CONFIRMED', { context: 'sightings filter' }),
|
||||
title: t('Show only community-confirmed (research-grade) sightings'),
|
||||
params: {
|
||||
confirmed: confirmedFailed ? state.confirmed : !state.confirmed,
|
||||
@@ -215,9 +216,12 @@ export function createControls({ state, services, parts }) {
|
||||
stale: state.stale,
|
||||
loading,
|
||||
refreshing,
|
||||
countLabel: t('{count} sightings in view', {
|
||||
count: formatNumber(count),
|
||||
}),
|
||||
countLabel: tn(
|
||||
count,
|
||||
'{count} sighting in view',
|
||||
'{count} sightings in view',
|
||||
{ count: formatNumber(count) },
|
||||
),
|
||||
loadingLabel: loading
|
||||
? t('loading...')
|
||||
: refreshing
|
||||
|
||||
@@ -1936,7 +1936,7 @@ test('unavailable grids fail closed to visible sampled sprites without a global
|
||||
assert.equal(h.clicks.collection.values[0].id, 'wildlife:inat:1');
|
||||
assert.ok(h.clicks.collection.values[0].size[0] * 0.5 >= 8);
|
||||
assert.equal(h.layer.getStats().count, 1);
|
||||
assert.match(h.layer.getStats().countLabel, /sightings in view/);
|
||||
assert.equal(h.layer.getStats().countLabel, '1 sighting in view');
|
||||
assert.equal(h.layer.getStats().partial, undefined);
|
||||
assert.equal(layerFeedState(h.layer.getStats()), 'degraded');
|
||||
assert.match(h.layer.getStats().error, /Malformed iNaturalist grid response/);
|
||||
@@ -1973,7 +1973,7 @@ test('an oversized view coarsens to a complete grid within the six-tile cap', as
|
||||
await h.update();
|
||||
assert.equal(h.clicks.collection.values.length, 1);
|
||||
assert.equal(h.clicks.collection.values[0].id, 'wildlife:inat:1');
|
||||
assert.match(h.layer.getStats().countLabel, /sightings in view/);
|
||||
assert.match(h.layer.getStats().countLabel, /sightings? in view/);
|
||||
assert.equal(layerFeedState(h.layer.getStats()), 'nominal');
|
||||
h.layer.destroy();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user