From 80dd2a0ae857024234170633ee672f4d390a5546 Mon Sep 17 00:00:00 2001 From: Tobias Zoghaib Date: Wed, 6 Nov 2024 16:45:36 +0100 Subject: [PATCH] Startup dialog on first run --- software/src/App.vue | 27 ++++++++++++++++++++++++ software/src/locales/de.json | 6 +++++- software/src/locales/en.json | 6 +++++- software/src/stores/preferences.store.ts | 13 +++++++++++- 4 files changed, 49 insertions(+), 3 deletions(-) diff --git a/software/src/App.vue b/software/src/App.vue index 345b01b..aa1e54e 100644 --- a/software/src/App.vue +++ b/software/src/App.vue @@ -9,6 +9,8 @@ import { useFeedbackStore } from './stores/feedback.store'; import companyFooter from './components/navigation/companyFooter.vue'; import urlBar from './components/navigation/urlBar.vue'; import { useRouter } from 'vue-router'; +import actionDialog from './components/basics/actionDialog.vue'; +import CircularProgressIndeterminate from './components/basics/circularProgressIndeterminate.vue'; const preferencesStore = usePreferencesStore() const feedbackStore = useFeedbackStore() @@ -18,6 +20,12 @@ const router = useRouter() theme.global.name.value = preferencesStore.theme +// First startup +if (preferencesStore.firstStartup) { + preferencesStore.firstStartupRoutine() +} + + // Global watcher watch(() => preferencesStore.language, () => { i18n.global.locale = preferencesStore.language @@ -84,4 +92,23 @@ watch(() => feedbackStore.notFound, () => { + + + + + {{ $t('misc.firstStartup.description') }} + + + + + + + + + \ No newline at end of file diff --git a/software/src/locales/de.json b/software/src/locales/de.json index 2d5e855..ddbeff2 100644 --- a/software/src/locales/de.json +++ b/software/src/locales/de.json @@ -207,6 +207,10 @@ }, "file": "Datei | Dateien", "folder": "Ordner | Ordner", - "uploadFile": "Datei hochladen" + "uploadFile": "Datei hochladen", + "firstStartup": { + "title": "Ersteinrichtung", + "description": "Die Datenbank wird eingerichtet. Dies kann 1-2 Minuten dauern. Bitte warten..." + } } } diff --git a/software/src/locales/en.json b/software/src/locales/en.json index 49f5e32..1238c2e 100644 --- a/software/src/locales/en.json +++ b/software/src/locales/en.json @@ -207,6 +207,10 @@ }, "file": "File | Files", "folder": "folder | folders", - "uploadFile": "Upload file" + "uploadFile": "Upload file", + "firstStartup": { + "title": "First startup", + "description": "Creating database. This could take 1-2 minutes. Please wait..." + } } } diff --git a/software/src/stores/preferences.store.ts b/software/src/stores/preferences.store.ts index 48a5a20..14383b0 100644 --- a/software/src/stores/preferences.store.ts +++ b/software/src/stores/preferences.store.ts @@ -28,7 +28,11 @@ export const usePreferencesStore = defineStore('preferencesStore', { /** Show the "Delete Exercise progress?" confirm dialog */ showDeleteExerciseDialog: ref(false), - staticFiles: ref([]) + /** List of files on the server */ + staticFiles: ref([]), + + /** Marks the first run of the app */ + firstStartup: useLocalStorage("hackmycart/preferencesStore/firstStartup", true) }), actions: { @@ -102,6 +106,13 @@ export const usePreferencesStore = defineStore('preferencesStore', { this.staticFiles = res.data this.fetchInProgress = false }) + }, + + async firstStartupRoutine() { + await this.resetDb() + await this.resetExerciseProg() + + this.firstStartup = false } } }) \ No newline at end of file