feat(ui): render the page toast from the status store

ShellFeedback and the scene director show toasts through createToast(),
each on its own timer as before, and the scene chrome renders the toast.
Every show rewrites the text, so a repeated message is announced again.
This commit is contained in:
Sameh Khamis committed 2026-10-31 19:58:59 -07:00
1 parent 3c391482f6
commit f846aaed4c
13 files changed
+203 -43

No files matched your search

+15 -1
View File
@@ -4,7 +4,8 @@ import { markRaw, shallowRef } from 'vue';
/**
* The scene's status chips as their views render them. ShellFeedback
* (src/ui/shellFeedback.js) publishes the top-center loading status and the
* road network chip, CctvControls the camera grid chip. Each label keeps its
* road network chip, CctvControls the camera grid chip; the toast shows
* what any owner's createToast() (src/ui/toast.js) publishes. Each label keeps its
* last text while hidden, so the next change flaps from what was shown.
*/
export const useStatusStore = defineStore('gev-status', () => {
@@ -18,6 +19,12 @@ export const useStatusStore = defineStore('gev-status', () => {
/** `{visible, label, immediate, progress, stopped}`, or null. */
const cctv = shallowRef(null);
/**
* The page toast, `{text, visible, shown}`; null until the first one.
* `shown` changes with every show, which rewrites the text.
*/
const toast = shallowRef(null);
/** @param {?object} next A fresh presentation of the loading status. */
function publishLoading(next) {
loading.value = next && markRaw(next);
@@ -33,7 +40,14 @@ export const useStatusStore = defineStore('gev-status', () => {
cctv.value = next && markRaw(next);
}
/** @param {?{text: string, visible: boolean, shown: number}} next */
function publishToast(next) {
toast.value = next && markRaw(next);
}
return {
toast,
publishToast,
loading,
publishLoading,
traffic,