2022-09-15 19:15:07 +02:00
|
|
|
<template>
|
2023-03-20 11:23:46 +01:00
|
|
|
<div v-if="!userStore.userLoaded" class="bg-neutral-100 dark:bg-neutral-900 text-primary h-screen flex justify-center items-center">
|
2023-01-23 23:37:11 +01:00
|
|
|
<div>
|
|
|
|
<Icon size="4em" name="ion:load-c" class="animate-spin" />
|
|
|
|
<h2 class="mt-2 font-bold">Loading...</h2>
|
2022-09-20 15:53:44 +02:00
|
|
|
</div>
|
2023-01-23 23:37:11 +01:00
|
|
|
</div>
|
|
|
|
<div v-else class="">
|
2023-03-20 11:23:46 +01:00
|
|
|
<div v-if="userStore.isAuthenticated" class="bg-neutral-100 dark:bg-neutral-900 text-primary h-screen flex flex-col">
|
2023-01-23 23:37:11 +01:00
|
|
|
<LayoutTopbar />
|
|
|
|
<div class="overflow-y-auto pt-3">
|
|
|
|
<NuxtPage />
|
|
|
|
</div>
|
|
|
|
<LayoutNavbar class="mt-auto" />
|
2022-09-15 19:15:07 +02:00
|
|
|
</div>
|
2023-01-23 23:37:11 +01:00
|
|
|
<div v-else class="bg-neutral-100 dark:bg-neutral-900 text-primary h-screen flex flex-col">
|
|
|
|
<Login />
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-09-19 09:36:47 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
2022-09-30 14:24:36 +02:00
|
|
|
import { Device } from '@capacitor/device';
|
2022-09-19 09:36:47 +02:00
|
|
|
|
2023-03-20 11:23:46 +01:00
|
|
|
const userStore = useUserStore()
|
2022-09-20 15:53:44 +02:00
|
|
|
|
2023-03-20 11:23:46 +01:00
|
|
|
onMounted(async () => {
|
|
|
|
userStore.init()
|
2023-01-22 15:34:32 +01:00
|
|
|
|
2023-01-22 20:02:53 +01:00
|
|
|
Device.getInfo().then(info => {
|
|
|
|
if (info.platform === 'ios') document.getElementsByClassName('top-right')[0].classList.add('toastios')
|
|
|
|
});
|
|
|
|
|
2023-01-22 15:34:32 +01:00
|
|
|
if (process.client) {
|
|
|
|
if ('serviceWorker' in navigator && window.isSecureContext) {
|
|
|
|
Device.getInfo().then(info => {
|
2023-03-20 11:23:46 +01:00
|
|
|
if (info.platform === 'web') registerServiceWorker()
|
2023-01-22 20:02:53 +01:00
|
|
|
else document.getElementsByClassName('top-right')[0].classList.add('toastios')
|
2023-01-22 15:34:32 +01:00
|
|
|
});
|
2022-09-30 21:17:12 +02:00
|
|
|
}
|
2023-01-22 15:34:32 +01:00
|
|
|
}
|
2022-09-20 15:53:44 +02:00
|
|
|
})
|
2022-11-13 19:48:40 +01:00
|
|
|
</script>
|
2022-12-04 10:29:11 +01:00
|
|
|
|
2023-01-22 20:02:53 +01:00
|
|
|
<style>
|
2022-12-04 10:29:11 +01:00
|
|
|
.body {
|
|
|
|
margin-bottom: env(safe-area-inset-bottom);
|
|
|
|
}
|
|
|
|
|
2023-01-22 20:02:53 +01:00
|
|
|
.toastios {
|
2023-05-11 13:21:02 +02:00
|
|
|
padding-top: env(safe-area-inset-top);
|
2023-01-22 20:02:53 +01:00
|
|
|
}
|
2022-12-04 10:29:11 +01:00
|
|
|
</style>
|