mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-10 21:32:23 +00:00
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:
1 parent
3c391482f6
commit
f846aaed4c
13 files changed
+203
-43
No files matched your search
+15
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user