mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Vue kit: the welcome card's buttons are UiButtons and its glyphs UiIcons
SKIP, the three start tiles, BROWSE STORIES, BACK and the main NEXT / ENTER GOD MODE action are ghost UiButtons; the start tiles are pressed toggles, and the others keep aria-disabled so they stay focusable while the card is busy. The tile, tip, Stories and arrow glyphs are UiIcons sized by first-run.css. God mode's preview globe and callouts stay inline SVG drawings. A guard test pins it, the dismiss markup pin allows the kit classes, and the first-run mutation anchors follow the new tile markup. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
2004cad9d0
commit
5301a0af8d
6 files changed
+73
-25
No files matched your search
@@ -89,6 +89,14 @@ tilt-map button, whose owners still write their state into the DOM. Core's
|
||||
pressable chips and pills (rail card chips, map sources, cities and places)
|
||||
are `UiButton`s too; `UiChip` is a non-interactive label chip, used by
|
||||
the voice card.
|
||||
The welcome card's buttons (SKIP, the three start tiles, BROWSE STORIES,
|
||||
BACK and the main NEXT / ENTER GOD MODE action) are ghost `UiButton`s:
|
||||
the start tiles are pressed toggles, and all but SKIP keep `aria-disabled`
|
||||
rather than `disabled`, so they stay focusable while the card is busy. Its
|
||||
tile, tip, Stories and arrow glyphs are `UiIcon`s with `:size="null"`, so
|
||||
first-run.css still sizes them (`src/ui/kit/welcomeControls.test.mjs` pins
|
||||
it). God mode's preview globe and callouts stay inline SVG drawings, and
|
||||
its outbound links stay links.
|
||||
`UiSelect` renders the bare native select (Core's labels sit outside it or
|
||||
come as an `aria-label`) with `v-model`, `options` and `disabled`;
|
||||
options that carry their own attributes come through the slot, a caller's
|
||||
|
||||
@@ -1343,6 +1343,7 @@
|
||||
"src/ui/kit/UiDialog.vue",
|
||||
"src/ui/kit/UiDialog.test.mjs",
|
||||
"src/ui/kit/dialogs.test.mjs",
|
||||
"src/ui/kit/welcomeControls.test.mjs",
|
||||
"src/ui/styles/chip.css",
|
||||
"src/ui/styles/empty-state.css",
|
||||
"src/ui/rail/RailChips.vue",
|
||||
|
||||
@@ -444,14 +444,14 @@ const MUTATIONS = [
|
||||
{
|
||||
defect: 'a mission tile is dropped from the menu',
|
||||
file: 'html',
|
||||
from: ' <button type="button" data-first-run-start="space-missions"',
|
||||
to: ' <button type="button" data-first-run-start-disabled="space-missions"',
|
||||
from: ' <UiButton data-first-run-start="space-missions"',
|
||||
to: ' <UiButton data-first-run-start-disabled="space-missions"',
|
||||
},
|
||||
{
|
||||
defect: "the menu order stops matching the owner's",
|
||||
file: 'html',
|
||||
from: '<button type="button" data-first-run-start="environmental"',
|
||||
to: '<button type="button" data-first-run-start="zzz-environmental"',
|
||||
from: '<UiButton data-first-run-start="environmental"',
|
||||
to: '<UiButton data-first-run-start="zzz-environmental"',
|
||||
},
|
||||
{
|
||||
defect: 'the "don\'t show again" checkbox loses its hook',
|
||||
|
||||
@@ -946,7 +946,7 @@ test('the card closes without a keyboard: the ESC hint is a button, kept on phon
|
||||
);
|
||||
assert.match(
|
||||
header,
|
||||
/<button type="button" class="first-run-dismiss" data-first-run-dismiss>/,
|
||||
/<button type="button" class="[^"]*\bfirst-run-dismiss\b[^"]*" data-first-run-dismiss>/,
|
||||
);
|
||||
assert.match(header, />SKIP · ESC</);
|
||||
assert.match(header, />SKIP</);
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// The welcome card's buttons and Material glyphs are the kit's: its template
|
||||
// hand-writes no <button> and no Material Symbols span, and its one box is a
|
||||
// UiCheckbox. Its two inline SVGs (God mode's globe and its callouts) are
|
||||
// drawings, not glyphs, and its outbound links stay links.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
|
||||
const source = readFileSync(
|
||||
new URL('../views/WelcomeView.vue', import.meta.url),
|
||||
'utf8',
|
||||
);
|
||||
/** The template block: everything outside script and style. */
|
||||
const template = source.replace(/<(script|style)\b[\s\S]*?<\/\1\s*>/g, '');
|
||||
|
||||
test('the welcome card hand-writes no button; each is a UiButton', () => {
|
||||
assert.deepEqual(template.match(/<button\b/gi) ?? [], []);
|
||||
// SKIP, the three start tiles, BROWSE STORIES, BACK and the main action.
|
||||
assert.equal(template.match(/<UiButton\b/g)?.length, 7);
|
||||
assert.equal(template.match(/<UiCheckbox\b/g)?.length, 1);
|
||||
});
|
||||
|
||||
test('the welcome card hand-writes no Material glyph; each is a UiIcon', () => {
|
||||
assert.deepEqual(template.match(/material-symbols-outlined/g) ?? [], []);
|
||||
const icons = template.match(/<UiIcon\b[^>]*>/g) ?? [];
|
||||
// The three tiles, the three tips, the Stories card and the main arrow.
|
||||
assert.equal(icons.length, 8);
|
||||
// Without it the kit writes an 18px size that beats first-run.css's rules.
|
||||
for (const icon of icons) assert.match(icon, /:size="null"/);
|
||||
});
|
||||
|
||||
test('the only inline SVGs are God mode preview drawings', () => {
|
||||
const svgs = [...template.matchAll(/<svg\b[^>]*>/g)].map((m) => m[0]);
|
||||
assert.equal(svgs.length, 2);
|
||||
assert.match(svgs[0], /class="first-run-globe"/);
|
||||
assert.match(svgs[1], /class="first-run-callouts"/);
|
||||
});
|
||||
@@ -3,7 +3,9 @@ import { storeToRefs } from 'pinia';
|
||||
import { nextTick, ref, watch } from 'vue';
|
||||
import { msg, t } from '../../i18n/index.js';
|
||||
import { FIRST_RUN_LINKS, environmentalLabel } from '../../firstRunCopy.js';
|
||||
import UiButton from '../kit/UiButton.vue';
|
||||
import UiCheckbox from '../kit/UiCheckbox.vue';
|
||||
import UiIcon from '../kit/UiIcon.vue';
|
||||
import { useFirstRunStore } from '../stores/firstRun.js';
|
||||
import { useStoriesStore } from '../stores/stories.js';
|
||||
|
||||
@@ -165,10 +167,10 @@ function onSuppress(event) {
|
||||
<!-- A button, not just a hint: phones and tablets have no ESC key. It
|
||||
closes exactly as ESC does, for this session only. Touch screens
|
||||
see SKIP; a keyboard sees SKIP · ESC (first-run.css). -->
|
||||
<button type="button" class="first-run-dismiss" data-first-run-dismiss @click="controls?.dismiss()">
|
||||
<UiButton class="first-run-dismiss" data-first-run-dismiss @click="controls?.dismiss()">
|
||||
<span class="first-run-dismiss-key">{{ t('SKIP · ESC') }}</span>
|
||||
<span class="first-run-dismiss-touch">{{ t('SKIP') }}</span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</header>
|
||||
<h2 id="first-run-title">{{ t(TITLES[step - 1]) }}</h2>
|
||||
<p class="first-run-step-announcement" role="status" aria-live="polite" aria-atomic="true">{{ t(TITLES[step - 1]) }}</p>
|
||||
@@ -207,22 +209,22 @@ function onSuppress(event) {
|
||||
<section class="first-run-section" aria-labelledby="first-run-start-heading">
|
||||
<h3 id="first-run-start-heading" class="first-run-section-title">{{ t('Start with') }}</h3>
|
||||
<div class="first-run-missions first-run-missions--tiles" role="group" aria-labelledby="first-run-start-heading">
|
||||
<button type="button" data-first-run-start="space-missions" :aria-pressed="String(start === 'space-missions')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('space-missions')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">rocket_launch</span>
|
||||
<UiButton data-first-run-start="space-missions" :pressed="start === 'space-missions'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('space-missions')">
|
||||
<UiIcon name="rocket_launch" :size="null" />
|
||||
<span><strong>{{ t('SPACE MISSIONS') }}</strong><small>{{ t('Launches, spacecraft and orbital context') }}</small></span>
|
||||
</button>
|
||||
<button type="button" data-first-run-start="environmental" :aria-pressed="String(start === 'environmental')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('environmental')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">local_fire_department</span>
|
||||
</UiButton>
|
||||
<UiButton data-first-run-start="environmental" :pressed="start === 'environmental'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('environmental')">
|
||||
<UiIcon name="local_fire_department" :size="null" />
|
||||
<!-- The title is ENVIRONMENTAL_LABEL_CHOICE's label once initialized. -->
|
||||
<!-- Subcopy names BOTH feeds this tile turns on, because the launcher
|
||||
optimizes for the fully configured experience (owner ruling,
|
||||
2026-08-23) — see the mission table in src/firstRunExperience.js. -->
|
||||
<span><strong data-first-run-environmental-title>{{ launcher?.environmentalTitle ?? environmentalLabel().title }}</strong><small>{{ launcher?.environmentalSub ?? t(ENVIRONMENTAL_SUB) }}</small></span>
|
||||
</button>
|
||||
<button type="button" data-first-run-start="explore" :aria-pressed="String(start === 'explore')" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('explore')">
|
||||
<span class="material-symbols-outlined" aria-hidden="true">public</span>
|
||||
</UiButton>
|
||||
<UiButton data-first-run-start="explore" :pressed="start === 'explore'" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="selectStart('explore')">
|
||||
<UiIcon name="public" :size="null" />
|
||||
<span><strong>{{ t('EXPLORE MANUALLY') }}</strong><small>{{ t('Begin with a clean globe') }}</small></span>
|
||||
</button>
|
||||
</UiButton>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -230,17 +232,17 @@ function onSuppress(event) {
|
||||
<div v-else key="3" class="first-run-step">
|
||||
<ul class="first-run-tips">
|
||||
<li class="first-run-tip first-run-tip--search">
|
||||
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">search</span><i class="first-run-tip-caret"></i></span>
|
||||
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="search" :size="null" /><i class="first-run-tip-caret"></i></span>
|
||||
<strong>{{ t('Search places') }}</strong>
|
||||
<small>{{ t('Type a place into the search bar.') }}</small>
|
||||
</li>
|
||||
<li class="first-run-tip first-run-tip--layers">
|
||||
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">layers</span><i class="first-run-tip-dot"></i></span>
|
||||
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="layers" :size="null" /><i class="first-run-tip-dot"></i></span>
|
||||
<strong>{{ t('Turn on layers') }}</strong>
|
||||
<small>{{ t('Turn layers on to see flights, ships, cameras, weather and more.') }}</small>
|
||||
</li>
|
||||
<li class="first-run-tip first-run-tip--context">
|
||||
<span class="first-run-tip-art" aria-hidden="true"><span class="material-symbols-outlined">my_location</span><i class="first-run-tip-ring"></i></span>
|
||||
<span class="first-run-tip-art" aria-hidden="true"><UiIcon name="my_location" :size="null" /><i class="first-run-tip-ring"></i></span>
|
||||
<strong>{{ t('Click anything') }}</strong>
|
||||
<small>{{ t('Select a map item to see its details.') }}</small>
|
||||
</li>
|
||||
@@ -248,12 +250,12 @@ function onSuppress(event) {
|
||||
<section class="first-run-section" aria-labelledby="first-run-deeper-heading">
|
||||
<h3 id="first-run-deeper-heading" class="first-run-section-title">{{ t('Go deeper') }}</h3>
|
||||
<div v-if="stories.available" class="first-run-link-card first-run-stories">
|
||||
<div class="first-run-preview first-run-preview--stories" aria-hidden="true"><span class="material-symbols-outlined">movie</span></div>
|
||||
<div class="first-run-preview first-run-preview--stories" aria-hidden="true"><UiIcon name="movie" :size="null" /></div>
|
||||
<div class="first-run-link-body">
|
||||
<p class="first-run-mode-title"><strong translate="no">GEV Stories</strong> <span class="first-run-tag">{{ t('NEW') }}</span></p>
|
||||
<p class="first-run-mode-copy">{{ t('Curated, interactive views of what is happening on Earth. Play one, take over the map whenever you like, then pick the story back up.') }}</p>
|
||||
</div>
|
||||
<button type="button" class="first-run-link-button" data-first-run-stories :aria-disabled="String(settling || launcher?.busy === 'true')" @click="openStories">{{ t('BROWSE STORIES') }}</button>
|
||||
<UiButton class="first-run-link-button" data-first-run-stories :aria-disabled="String(settling || launcher?.busy === 'true')" @click="openStories">{{ t('BROWSE STORIES') }}</UiButton>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -304,10 +306,10 @@ function onSuppress(event) {
|
||||
<p class="first-run-note" data-first-run-status role="status" aria-live="polite">{{ launcher?.status ?? '' }}</p>
|
||||
<!-- The card's main action: God mode, starting where the selected tile
|
||||
says (a clean globe by default). -->
|
||||
<button v-if="step > 1" type="button" class="first-run-back" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="go(step - 1, $event)">{{ t('BACK') }}</button>
|
||||
<button type="button" class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @pointerdown="onPrimaryDown" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
|
||||
{{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} <span class="material-symbols-outlined" aria-hidden="true">arrow_forward</span>
|
||||
</button>
|
||||
<UiButton v-if="step > 1" class="first-run-back" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="go(step - 1, $event)">{{ t('BACK') }}</UiButton>
|
||||
<UiButton class="first-run-enter" :data-first-run-choice="step === STEPS ? start : undefined" :data-first-run-next="step < STEPS ? '' : undefined" data-first-run-primary aria-describedby="first-run-title first-run-description" @pointerdown="onPrimaryDown" @keydown.enter="onPrimaryKeydown" :aria-disabled="String(settling || launcher?.busy === 'true')" @click="onPrimary">
|
||||
{{ step < STEPS ? t('NEXT') : t('ENTER GOD MODE') }} <UiIcon name="arrow_forward" :size="null" />
|
||||
</UiButton>
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
|
||||
Reference in new issue
Block a user