mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 01:32:19 +00:00
Turn the first-run launcher into a three-step welcome
Replace the single dense welcome card with three short steps: an introduction to the modes, where to start (Space Missions, Environmental or Explore manually, Explore selected by default), then quick tips (the place tip points at the search bar) and links. Next and Back keep the selection, and only Enter God mode runs a mission; double clicks, Enter repeats and clicks during a step change cannot launch one. Skip and ESC close the card for the session, as before. Drop the Live Contacts tile and the old voice tip. Space Missions switches on its layer, which opens its own panel, so no first-run choice enters a Context mode or opens the Context panel any more, and that path is gone. The last step links to the repository and Halfpixel's channels, each opening in a new tab without opener or referrer. Its GEV Stories card closes the welcome and opens the in-app Stories Explore view; the Stories announcement stays hidden, and unseen, until the card has closed and Stories has loaded. The dim layer behind the card is a click-through tint with no blur. Update the 13 catalogs, CURRENT-STATE, the first-run QA harness and its mutations, and the scripts that dismissed the old card. Add a changelog fragment. Co-authored-by: Sameh Khamis <[email protected]>
This commit is contained in:
1 parent
0421813e26
commit
e342149a09
27 files changed
+2807
-515
No files matched your search
+148
-114
@@ -537,20 +537,13 @@ test('the launcher yields on engage and waits when a surface is already up', ()
|
||||
// ── Per-mission behavior ─────────────────────────────────────────────────────
|
||||
|
||||
function missionSpy({
|
||||
contextOk = true,
|
||||
layerResult = () => true,
|
||||
globe = async () => ({ ok: true }),
|
||||
} = {}) {
|
||||
const calls = { contextModes: [], layerIds: [], globeFlights: 0 };
|
||||
const calls = { layerIds: [], globeFlights: 0 };
|
||||
return {
|
||||
calls,
|
||||
deps: {
|
||||
setContextMode: async (mode) => {
|
||||
calls.contextModes.push(mode);
|
||||
return contextOk
|
||||
? { ok: true, mode }
|
||||
: { ok: false, failedLayerIds: ['military-awareness'] };
|
||||
},
|
||||
setLayerEnabled: async (layerId) => {
|
||||
calls.layerIds.push(layerId);
|
||||
return layerResult(layerId);
|
||||
@@ -563,14 +556,14 @@ function missionSpy({
|
||||
};
|
||||
}
|
||||
|
||||
test('the menu is the four owner-ordered missions', () => {
|
||||
test('the menu is the three owner-ordered missions', () => {
|
||||
// INFRASTRUCTURE was removed after the owner playtested it: enabling all
|
||||
// three bundled layers at once put ~5,700 entities on a full-earth view and
|
||||
// tanked the frame rate. The layers stay reachable by hand and by voice; what
|
||||
// went is the one-click globe-scale dump. Restoring the tile needs the
|
||||
// globe-LOD declutter first.
|
||||
// globe-LOD declutter first. Live Contacts was dropped from the product, so
|
||||
// it is not offered as a starting mission either.
|
||||
assert.deepEqual(Object.keys(FIRST_RUN_MISSIONS), [
|
||||
'contacts',
|
||||
'space-missions',
|
||||
'environmental',
|
||||
'explore',
|
||||
@@ -580,27 +573,17 @@ test('the menu is the four owner-ordered missions', () => {
|
||||
undefined,
|
||||
'the infrastructure mission must be gone, not dormant',
|
||||
);
|
||||
});
|
||||
|
||||
test('Live Contacts goes through the one setContextMode facade', async () => {
|
||||
const spy = missionSpy();
|
||||
const outcome = await runFirstRunChoice('contacts', spy.deps);
|
||||
assert.equal(outcome.ok, true);
|
||||
assert.deepEqual(spy.calls.contextModes, ['contacts']);
|
||||
// A Context mission owns no layers and no camera of its own — the facade does.
|
||||
assert.deepEqual(spy.calls.layerIds, []);
|
||||
assert.equal(spy.calls.globeFlights, 0);
|
||||
assert.equal(
|
||||
FIRST_RUN_MISSIONS.contacts,
|
||||
undefined,
|
||||
'the contacts mission must be gone, not dormant',
|
||||
);
|
||||
});
|
||||
|
||||
test('Space Missions switches on its layer like a row click, without a flight', async () => {
|
||||
const spy = missionSpy();
|
||||
const outcome = await runFirstRunChoice('space-missions', spy.deps);
|
||||
assert.equal(outcome.ok, true);
|
||||
assert.deepEqual(
|
||||
spy.calls.contextModes,
|
||||
[],
|
||||
'Space Missions is not a Context mode',
|
||||
);
|
||||
assert.deepEqual(spy.calls.layerIds, ['rocket-launches']);
|
||||
assert.equal(spy.calls.globeFlights, 0, 'the layer frames the globe itself');
|
||||
|
||||
@@ -680,24 +663,9 @@ test('a refused layer fails the mission by name, and a stalled flight never does
|
||||
test('Explore manually touches nothing at all, and an unknown choice is inert', async () => {
|
||||
const spy = missionSpy();
|
||||
assert.equal((await runFirstRunChoice('explore', spy.deps)).ok, true);
|
||||
assert.deepEqual(spy.calls, {
|
||||
contextModes: [],
|
||||
layerIds: [],
|
||||
globeFlights: 0,
|
||||
});
|
||||
assert.deepEqual(spy.calls, { layerIds: [], globeFlights: 0 });
|
||||
assert.equal((await runFirstRunChoice('nope', spy.deps)).ok, false);
|
||||
assert.deepEqual(spy.calls, {
|
||||
contextModes: [],
|
||||
layerIds: [],
|
||||
globeFlights: 0,
|
||||
});
|
||||
});
|
||||
|
||||
test('a failed Context mission reports the layers the facade named', async () => {
|
||||
const spy = missionSpy({ contextOk: false });
|
||||
const outcome = await runFirstRunChoice('contacts', spy.deps);
|
||||
assert.equal(outcome.ok, false);
|
||||
assert.deepEqual(outcome.result.failedLayerIds, ['military-awareness']);
|
||||
assert.deepEqual(spy.calls, { layerIds: [], globeFlights: 0 });
|
||||
});
|
||||
|
||||
test('the fires/quakes tile name is switchable from one constant', () => {
|
||||
@@ -748,23 +716,10 @@ test('no mission writes a preference the visitor did not choose by picking it',
|
||||
);
|
||||
}
|
||||
|
||||
// The only durable panel write is the Context reveal, and only on the Context
|
||||
// mission — the globe missions open no panel at all, and Space Missions'
|
||||
// panel opens the way its layer row's switch opens it.
|
||||
const panelWrites = code.match(/setPanelCollapsed/g) || [];
|
||||
assert.equal(
|
||||
panelWrites.length,
|
||||
1,
|
||||
'exactly one panel reveal, on the Context path',
|
||||
);
|
||||
const contextPath = code.slice(
|
||||
code.indexOf('setContextMode: async (mode)'),
|
||||
code.indexOf('setLayerEnabled:'),
|
||||
);
|
||||
assert.match(
|
||||
contextPath,
|
||||
/result\?\.ok[\s\S]*?setPanelCollapsed\?\.\('global-context-panel', false, \{\s*explicit: true,?\s*\}\)/,
|
||||
);
|
||||
// No mission writes panel chrome: the globe missions open no panel at all,
|
||||
// and Space Missions' panel opens the way its layer row's switch opens it.
|
||||
assert.doesNotMatch(code, /setPanelCollapsed/);
|
||||
assert.doesNotMatch(code, /setContextMode/);
|
||||
});
|
||||
|
||||
test('the decision table is written down where the next editor will read it', () => {
|
||||
@@ -801,56 +756,19 @@ test('markup, startup ordering and accessibility remain pinned', async () => {
|
||||
html,
|
||||
/id="first-run-launcher" role="dialog"[^>]*aria-labelledby="first-run-title"[^>]*hidden/,
|
||||
);
|
||||
assert.equal((html.match(/data-first-run-choice=/g) || []).length, 4);
|
||||
assert.equal((html.match(/data-first-run-choice=/g) || []).length, 0);
|
||||
assert.match(html, /data-first-run-next/);
|
||||
assert.ok(
|
||||
html.includes(
|
||||
'<p id="first-run-description">It feels like a forbidden cockpit—then you realize the sources are public and the data is real.</p>',
|
||||
),
|
||||
'the maintainer-authored first-run line stays verbatim',
|
||||
);
|
||||
assert.match(
|
||||
html,
|
||||
/data-first-run-status[^>]*role="status"[^>]*aria-live="polite"/,
|
||||
);
|
||||
assert.match(html, /<input type="checkbox" data-first-run-suppress\s*\/?>/);
|
||||
assert.match(html, /<strong data-first-run-environmental-title>/);
|
||||
// Subcopy must name BOTH feeds the tile turns on — a tile that promised only
|
||||
// half of what it does is the defect this replaced. Only the VISIBLE <small>
|
||||
// text counts; the comment beside it naturally says the words too.
|
||||
const envTile = html.slice(
|
||||
html.indexOf('data-first-run-choice="environmental"'),
|
||||
);
|
||||
const visible = envTile.slice(
|
||||
envTile.indexOf('<small>'),
|
||||
envTile.indexOf('</small>'),
|
||||
);
|
||||
assert.match(visible, /earthquakes/i);
|
||||
assert.match(
|
||||
visible,
|
||||
/fires?/i,
|
||||
'the tile must promise the fires it enables',
|
||||
);
|
||||
|
||||
// The card's one persuasive line is OWNER-AUTHORED and pinned verbatim,
|
||||
// unspaced em dash included. This is copy, not prose to be improved in a
|
||||
// passing edit — changing it needs the owner, not a nicer-sounding rewrite.
|
||||
assert.ok(
|
||||
html.includes(
|
||||
'<p id="first-run-description">It feels like a forbidden cockpit' +
|
||||
'—then you realize the sources are public and the data is real.</p>',
|
||||
),
|
||||
'the owner-authored first-run line must ship exactly as written',
|
||||
);
|
||||
|
||||
// Menu order is the owner's, read straight off the markup.
|
||||
const order = [...html.matchAll(/data-first-run-choice="([a-z-]+)"/g)].map(
|
||||
(match) => match[1],
|
||||
);
|
||||
assert.deepEqual(order, [
|
||||
'contacts',
|
||||
'space-missions',
|
||||
'environmental',
|
||||
'explore',
|
||||
]);
|
||||
assert.doesNotMatch(
|
||||
html,
|
||||
/data-first-run-choice="infrastructure"/,
|
||||
'the removed tile must leave no markup behind',
|
||||
);
|
||||
|
||||
assert.match(startup, /styleManager\.initialRestorePromise/);
|
||||
assert.ok(
|
||||
@@ -905,40 +823,156 @@ test('markup, startup ordering and accessibility remain pinned', async () => {
|
||||
assert.match(choicesBlock, /overflow-y: auto;/);
|
||||
});
|
||||
|
||||
test('the header text keeps clear of the centred step dots', () => {
|
||||
const css = fs.readFileSync(
|
||||
new URL('./ui/styles/first-run.css', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
// Above 620px the dots are absolutely centred over the header row, so the
|
||||
// kicker and Skip must stop short of them; long locales then wrap.
|
||||
assert.match(css, /\.first-run-dots \{\s*position: absolute;\s*left: 50%;/);
|
||||
assert.match(
|
||||
css,
|
||||
/@media \(min-width: 621px\) \{\s*\.first-run-kicker,\s*\.first-run-dismiss \{\s*max-width: calc\(50% - 2\.4rem\);\s*\}\s*\}/,
|
||||
);
|
||||
assert.match(
|
||||
css,
|
||||
/@media \(max-width: 620px\) \{\s*\.first-run-dots \{\s*position: static;/,
|
||||
);
|
||||
});
|
||||
|
||||
test('reduced motion stops every first-run animation, however specific', () => {
|
||||
const css = fs.readFileSync(
|
||||
new URL('./ui/styles/first-run.css', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
// Every rule that starts an infinite animation must be matched by a
|
||||
// reduced-motion rule at least as specific, or the animation keeps running.
|
||||
const reduced = [
|
||||
...css.matchAll(
|
||||
/@media \(prefers-reduced-motion: reduce\) \{([\s\S]*?)\n\}/g,
|
||||
),
|
||||
]
|
||||
.map((m) => m[1])
|
||||
.join('\n');
|
||||
const squash = (selector) => selector.replace(/\s+/g, ' ').trim();
|
||||
const reducedSelectors = new Set(
|
||||
[...reduced.matchAll(/([^{}]+)\{[^}]*animation: none/g)].flatMap((m) =>
|
||||
m[1].split(/,(?![^(]*\))/).map(squash),
|
||||
),
|
||||
);
|
||||
const animated = [
|
||||
...css.matchAll(/([^{}@]+)\{[^}]*animation: [^;]*infinite/g),
|
||||
]
|
||||
.flatMap((m) => m[1].split(/,(?![^(]*\))/).map(squash))
|
||||
.filter((selector) => !selector.startsWith('/*'));
|
||||
assert.ok(animated.length > 5, 'found the animated rules');
|
||||
const covered = (selector) => {
|
||||
if (reducedSelectors.has(selector)) return true;
|
||||
// An :is() group in the reduced block covers each of its members.
|
||||
return [...reducedSelectors].some((reducedSelector) => {
|
||||
const group = reducedSelector.match(/^(.*) :is\(([^)]*)\)$/);
|
||||
return (
|
||||
group &&
|
||||
group[2]
|
||||
.split(',')
|
||||
.map((part) => `${group[1]} ${part.trim()}`)
|
||||
.includes(selector)
|
||||
);
|
||||
});
|
||||
};
|
||||
const missing = animated.filter((selector) => !covered(selector));
|
||||
assert.deepEqual(missing, [], 'animations reduced motion leaves running');
|
||||
});
|
||||
|
||||
test('the welcome backdrop tints the globe without blurring it', () => {
|
||||
const css = fs.readFileSync(
|
||||
new URL('./ui/styles/first-run.css', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const backdrop = css.match(/\.first-run-backdrop \{([^}]*)\}/)?.[1] || '';
|
||||
assert.match(backdrop, /background: rgba\(3, 8, 14, 0\.28\);/);
|
||||
assert.match(backdrop, /pointer-events: none;/, 'click-through');
|
||||
assert.doesNotMatch(backdrop, /backdrop-filter/);
|
||||
});
|
||||
|
||||
test('every outbound first-run link opens without opener or referrer', () => {
|
||||
const view = fs.readFileSync(
|
||||
new URL('./ui/views/WelcomeView.vue', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const links = view.match(/<a [^>]*target="_blank"[^>]*>/g) || [];
|
||||
assert.ok(links.length >= 7, 'the source and Halfpixel chips are outbound');
|
||||
for (const link of links) {
|
||||
assert.match(link, /rel="noopener noreferrer"/, link);
|
||||
}
|
||||
});
|
||||
|
||||
test('the Stories announcement waits behind the welcome card', () => {
|
||||
const css = fs.readFileSync(
|
||||
new URL('./ui/styles/first-run.css', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
// Hidden, not consumed: the popup keeps its unseen state and appears once
|
||||
// the card is dismissed.
|
||||
assert.match(
|
||||
css,
|
||||
/body:has\(#first-run-launcher\) #gev-stories #hPop,\s*body\.first-run-opening-stories #gev-stories #hPop \{\s*visibility: hidden;\s*pointer-events: none;\s*\}/,
|
||||
);
|
||||
// The selector only works while Stories still renders the popup as #hPop
|
||||
// inside #gev-stories.
|
||||
const stories = fs.readFileSync(
|
||||
new URL('./ui/views/StoriesView.vue', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
const root = stories.indexOf('<div id="gev-stories"');
|
||||
const popup = stories.indexOf('id="hPop"');
|
||||
assert.ok(root >= 0, 'StoriesView renders #gev-stories');
|
||||
assert.ok(popup > root, 'StoriesView renders #hPop inside #gev-stories');
|
||||
});
|
||||
|
||||
test('the card closes without a keyboard: the ESC hint is a button, kept on phones', async () => {
|
||||
const html = await renderApplicationHtml(
|
||||
fs.readFileSync(new URL('../index.html', import.meta.url), 'utf8'),
|
||||
);
|
||||
// The whole stylesheet, so a hide rule added in any other file is caught too.
|
||||
const css = readStylesheet(new URL('../style.css', import.meta.url));
|
||||
const footer = html.slice(
|
||||
html.indexOf('class="first-run-footer"'),
|
||||
html.indexOf('data-first-run-status'),
|
||||
const header = html.slice(
|
||||
html.indexOf('class="first-run-header"'),
|
||||
html.indexOf('id="first-run-title"'),
|
||||
);
|
||||
assert.match(
|
||||
footer,
|
||||
header,
|
||||
/<button type="button" class="first-run-dismiss" data-first-run-dismiss>/,
|
||||
);
|
||||
assert.match(footer, />ESC to dismiss</);
|
||||
assert.match(footer, />DISMISS</);
|
||||
assert.match(header, />SKIP · ESC</);
|
||||
assert.match(header, />SKIP</);
|
||||
// It closes the way ESC does, through the one dismiss path, so the session
|
||||
// flag and focus handling are the same: firstRunLauncherView.test.mjs.
|
||||
// Phones used to hide the hint, leaving no way out but picking a mission.
|
||||
assert.doesNotMatch(css, /first-run-footer > span:last-child/);
|
||||
assert.doesNotMatch(css, /\.first-run-dismiss\s*\{[^}]*display:\s*none/);
|
||||
// A 44px touch target that does not add to the footer row's height.
|
||||
// A 44px touch target that does not add to the header row's height.
|
||||
assert.match(
|
||||
css,
|
||||
/\.first-run-dismiss::before \{[^}]*position: absolute;[^}]*height: 44px;/,
|
||||
);
|
||||
assert.doesNotMatch(css, /\.first-run-dismiss \{[^}]*min-height/);
|
||||
// Touch screens read DISMISS rather than a key they do not have.
|
||||
// Touch screens read SKIP rather than a key they do not have.
|
||||
assert.match(
|
||||
css,
|
||||
/@media \(hover: none\) and \(pointer: coarse\) \{\s*\.first-run-dismiss-key \{\s*display: none;/,
|
||||
);
|
||||
});
|
||||
|
||||
test('a short landscape phone keeps the card inside the viewport', () => {
|
||||
const css = readStylesheet(new URL('../style.css', import.meta.url));
|
||||
// Above the tab bar, never taller than the space left between it and the top.
|
||||
assert.match(
|
||||
css,
|
||||
/body\.mobile-shell #first-run-launcher \{[^}]*bottom: 5\.8rem;[^}]*max-height: calc\(100dvh - 6\.55rem\);/,
|
||||
);
|
||||
});
|
||||
|
||||
test('the launcher keeps focus, restores it, and never disables the focused button', () => {
|
||||
const module = fs.readFileSync(
|
||||
new URL('./firstRunExperience.js', import.meta.url),
|
||||
|
||||
Reference in new issue
Block a user