From 2b70ec8c8d6b1815f38367afa68c794a5e835330 Mon Sep 17 00:00:00 2001 From: Arturo Manzoli Date: Tue, 7 Jan 2025 17:57:58 -0300 Subject: [PATCH] App: Startup dialogs: Implement changes to run under dialog queue Signed-off-by: Arturo Manzoli --- src/components/Tutorial.vue | 21 ++++++--------------- src/components/UpdateNotification.vue | 17 ++++++++++++++--- src/components/VehicleDiscoveryDialog.vue | 23 +++++++++++++++++------ 3 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/components/Tutorial.vue b/src/components/Tutorial.vue index edf4d61a7..78c7878d1 100644 --- a/src/components/Tutorial.vue +++ b/src/components/Tutorial.vue @@ -88,23 +88,15 @@ import { useMainVehicleStore } from '@/stores/mainVehicle' import GlassModal from './GlassModal.vue' const { showSnackbar } = useSnackbar() + const interfaceStore = useAppInterfaceStore() const vehicleStore = useMainVehicleStore() -const props = defineProps<{ - /** - * - */ - showTutorial?: boolean -}>() - -const emits = defineEmits(['update:showTutorial']) - -const showTutorial = ref(props.showTutorial || false) +const userHasSeenTutorial = useBlueOsStorage('cockpit-has-seen-tutorial', false) +const showTutorial = ref(false) const currentTutorialStep = ref(1) const isVehicleConnectedVisible = ref(false) const tallContent = ref(false) -const userHasSeenTutorial = useBlueOsStorage('cockpit-has-seen-tutorial', false) const steps = [ { @@ -345,7 +337,6 @@ const handleStepChangeDown = (newStep: number): void => { const dontShowTutorialAgain = (): void => { userHasSeenTutorial.value = true showTutorial.value = false - emits('update:showTutorial', false) showSnackbar({ message: 'This guide can be reopened via the Settings > General menu', variant: 'info', @@ -356,8 +347,6 @@ const dontShowTutorialAgain = (): void => { const alwaysShowTutorialOnStartup = (): void => { userHasSeenTutorial.value = false - showTutorial.value = true - emits('update:showTutorial', true) } const nextTutorialStep = (): void => { @@ -379,7 +368,7 @@ const closeTutorial = (): void => { showTutorial.value = false interfaceStore.componentToHighlight = 'none' currentTutorialStep.value = 1 - emits('update:showTutorial', false) + interfaceStore.isTutorialVisible = false } const setVehicleConnectedVisible = (): void => { @@ -403,6 +392,7 @@ const handleKeydown = (event: KeyboardEvent): void => { watch( () => interfaceStore.isTutorialVisible, (val) => { + console.log('🚀 ~ val:', val) showTutorial.value = val } ) @@ -435,6 +425,7 @@ onMounted(() => { onBeforeUnmount(() => { window.removeEventListener('keydown', handleKeydown) + interfaceStore.isTutorialVisible = false })