Stories: name the Opened in GEV toast for what it is

This commit is contained in:
Sameh Khamis committed 2026-11-16 13:48:14 -08:00
1 parent a5065743d9
commit a9990018ea
9 files changed
+30 -29

No files matched your search

+1 -1
View File
@@ -171,7 +171,7 @@ test('a failed load is reported and the next open tries again', async () => {
test('a Stories link that cannot load is reported too', async () => {
setActivePinia(createPinia());
history.replaceState(null, '', '/?story=worldfx%3Afire-tracker');
history.replaceState(null, '', '/?story=other%3Afire-tracker');
const store = useStoriesStore();
let failures = 0;
bootStories({
+1 -1
View File
@@ -918,7 +918,7 @@ export function createStoriesController({
director.styleManager?.setPanelCollapsed?.('scene-panel', false, {
explicit: true,
});
store.hostedToast = {
store.openedToast = {
id: story.id,
title: story.title,
atMs,
+2 -2
View File
@@ -258,7 +258,7 @@ test('reopening while a scene tears down keeps the view from before Stories', as
controller.open();
controller.openStory('gev:bhote-koshi-nepal-scene');
director.running = true;
const toast = store.hostedToast;
const toast = store.openedToast;
const closing = controller.openInGev();
// The scene has moved the camera; the person opens Stories again at once.
camera.position = { x: 9, y: 9, z: 9 };
@@ -267,7 +267,7 @@ test('reopening while a scene tears down keeps the view from before Stories', as
await closing;
assert.deepEqual(director.selected, []);
assert.deepEqual(director.styleManager.panels, []);
assert.equal(store.hostedToast, toast);
assert.equal(store.openedToast, toast);
assert.equal(camera.views.length, 0, 'no restore under the reopened Stories');
await controller.close();
const { x, y, z } = camera.views.at(-1).destination;
+2 -2
View File
@@ -32,8 +32,8 @@ export function creditPlacement({ map, feed, width, height }) {
/**
* Where the Stories button sits: just left of the leftmost visible control
* in GEV's top-right corner — the ACTIVE STYLE readout in GEV, the account
* avatar (with or beside the readout) in GEV Hosted — top-aligned with it.
* in GEV's top-right corner — the ACTIVE STYLE readout, or an element placed
* in that corner (with or beside the readout) — top-aligned with it.
* Where none of those shows (GEV's phone layout, whose top row of icon
* buttons spans the corner), it goes icon-only just under the right-hand
* column of corner actions, aligned with its right edge.
+1 -1
View File
@@ -41,7 +41,7 @@ export const useStoriesStore = defineStore('stories', {
/** Hints and toasts */
hint: '',
toast: '',
hostedToast: null,
openedToast: null,
popSeen: false,
hintSeen: false,
sheetHintSeen: false,
+3 -3
View File
@@ -134,19 +134,19 @@ test('the Stories button sits left of whatever is in the top-right corner', () =
top: 24,
right: 270,
});
// GEV Hosted: the account avatar beside the readout; the leftmost wins.
// An element placed beside the readout; the leftmost wins.
assert.deepEqual(
entryPlacement([box(1650, 24, 220, 60), box(1898, 22, 38, 38)], 1960),
{ top: 24, right: 320 },
);
// Hosted with the readout hidden: the avatar alone.
// The readout hidden: that element alone.
assert.deepEqual(
entryPlacement([box(0, 0, 0, 0), box(1898, 22, 38, 38)], 1960),
{ top: 22, right: 72 },
);
// Nothing there yet.
assert.deepEqual(entryPlacement([null, null], 1960), { top: 14, right: 14 });
// GEV's phone layout: no readout or avatar; icon-only under the corner
// GEV's phone layout: nothing in the corner; icon-only under the corner
// actions column, aligned with its right edge.
assert.deepEqual(
entryPlacement([box(0, 0, 0, 0), null], 639, box(594, 60, 33, 70)),
+3 -3
View File
@@ -202,7 +202,7 @@ body.ui-clean-view #gev-stories .gs-pop {
z-index: 1201;
left: auto;
}
#gev-stories .gs-hosted-toast {
#gev-stories .gs-opened-toast {
position: fixed;
z-index: 1201;
bottom: 110px;
@@ -230,7 +230,7 @@ body.ui-clean-view #gev-stories .gs-pop {
software WebGL): the closed-state pieces use a near-opaque fill instead. */
#gev-stories .gs-entry,
#gev-stories .gs-pop,
#gev-stories .gs-hosted-toast {
#gev-stories .gs-opened-toast {
-webkit-backdrop-filter: none;
backdrop-filter: none;
}
@@ -238,7 +238,7 @@ body.ui-clean-view #gev-stories .gs-pop {
background: rgba(6, 24, 34, 0.92);
}
#gev-stories .gs-pop,
#gev-stories .gs-hosted-toast {
#gev-stories .gs-opened-toast {
background: rgba(12, 12, 20, 0.95);
}
+15 -15
View File
@@ -30,14 +30,14 @@ const StoryScreen = defineAsyncComponent(
* Story page. Both show GEV's own Cesium globe through their map areas.
*/
const store = useStoriesStore();
const { mode, storyId, toast, hostedToast } = storeToRefs(store);
const { mode, storyId, toast, openedToast } = storeToRefs(store);
const story = computed(() => (storyId.value ? store.byId(storyId.value) : null));
const reduceMotion = () =>
globalThis.matchMedia?.('(prefers-reduced-motion: reduce)').matches;
// ── Entry: in GEV's top-right row, left of what sits in the corner ──
// GEV has its ACTIVE STYLE readout there; GEV Hosted adds the account
// avatar, which can come after Stories mounts (sign-in).
// GEV has its ACTIVE STYLE readout there; an element placed in that corner
// (#account-control, with or beside the readout) can come after Stories mounts.
const CORNER = ['style-indicator', 'account-control'];
// GEV's phone layout shows neither; the button then sits under this column.
const COLUMN = 'corner-actions';
@@ -53,8 +53,8 @@ let entryTries = 0;
let entryTimer = 0;
let cornerObserver = null;
const observed = new Set();
// GEV Hosted moves the corner by body class (signed in, guest) without
// resizing it, which a ResizeObserver does not see.
// A body class can move the corner without resizing it, which a
// ResizeObserver does not see.
let bodyObserver = null;
function watchCorner() {
placeEntry();
@@ -151,17 +151,17 @@ function openExplore() {
}
// ── Opened in GEV: a toast that leads back to the story ──
let hostedTimer = 0;
watch(hostedToast, (v) => {
clearTimeout(hostedTimer);
if (v) hostedTimer = setTimeout(() => (hostedToast.value = null), 6000);
let openedTimer = 0;
watch(openedToast, (v) => {
clearTimeout(openedTimer);
if (v) openedTimer = setTimeout(() => (openedToast.value = null), 6000);
});
function backToStory() {
const v = hostedToast.value;
hostedToast.value = null;
const v = openedToast.value;
openedToast.value = null;
if (v) store.controller.openStory(v.id, { atMs: v.atMs });
}
const hostedWhen = computed(() => hostedToast.value?.when ?? '');
const openedWhen = computed(() => openedToast.value?.when ?? '');
// ── Card-to-map morph: Play grows the card into the story; Back folds it home ──
const appEl = ref(null);
@@ -272,7 +272,7 @@ onMounted(() => {
});
onBeforeUnmount(() => {
clearTimeout(entryTimer);
clearTimeout(hostedTimer);
clearTimeout(openedTimer);
cancelAnimationFrame(creditFrame);
cornerObserver?.disconnect();
bodyObserver?.disconnect();
@@ -340,9 +340,9 @@ watch([mode, storyId], () => nextTick(watchCredit));
<button class="tbtn" type="button" @click="markPopSeen">{{ t('Not now') }}</button>
</div>
</div>
<div v-if="hostedToast" id="hToast" class="h-toast glass gs-hosted-toast" role="status">
<div v-if="openedToast" id="hToast" class="h-toast glass gs-opened-toast" role="status">
<b>{{ t('Opened in GEV') }}</b>
<span>{{ hostedToast.title }} · {{ hostedWhen }}</span>
<span>{{ openedToast.title }} · {{ openedWhen }}</span>
<button class="tbtn" type="button" @click="backToStory">{{ t('Back to story') }}</button>
</div>
</template>