Startup dialog on first run

This commit is contained in:
2024-11-06 16:45:36 +01:00
parent b7eca62403
commit 80dd2a0ae8
4 changed files with 49 additions and 3 deletions

View File

@@ -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, () => {
<company-footer />
</v-main>
</v-app>
<action-dialog
v-model="preferencesStore.firstStartup"
:title="$t('misc.firstStartup.title')"
persistent
max-width="600"
>
<v-row>
<v-col>
{{ $t('misc.firstStartup.description') }}
</v-col>
</v-row>
<v-row>
<v-col class="text-center pa-8">
<circular-progress-indeterminate />
</v-col>
</v-row>
</action-dialog>
</template>

View File

@@ -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..."
}
}
}

View File

@@ -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..."
}
}
}

View File

@@ -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<Boolean>("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
}
}
})