wrbapp/frontend/app.vue

73 lines
2.5 KiB
Vue
Raw Normal View History

2022-09-15 19:15:07 +02:00
<template>
2023-12-21 14:47:32 +01:00
<div v-if="showInstallGuide !== null && showInstallGuide && host != 'localhost'" class="bg-neutral-1100 dark:bg-neutral-900 h-screen flex flex-col px-5 text-center text-black dark:text-gray-200">
2023-05-15 15:06:45 +02:00
<h1 class="font-bold text-3xl text-center mb-10 mt-20 text-primary">Reddingsbrigade Waddinxveen</h1>
<p class="mb-10">Om gebruik te maken van de WRB App moet je deze installeren</p>
<h2 class="font-bold">Op een iPhone:</h2>
<p class="mb-10">
Ga naar <a href="https://apps.apple.com/us/app/waddinxveense-reddingsbrigade/id6443636255" class="underline">deze link</a> en download de app via de App Store
</p>
<h2 class="font-bold">Op een Android:</h2>
<ol class="list-decimal list-inside mb-3">
<li>Druk op het opties icoon:<Icon size="1.7em" name="ion:md-more" /></li>
<li>En kies voor "Toevoegen aan startscherm" of "App installeren"</li>
</ol>
<i>Als deze optie er niet is, gebruik dan de chrome browser</i>
</div>
2023-06-03 11:22:17 +02:00
<div v-else-if="userStore.userLoaded">
<div v-if="userStore.isAuthenticated" class="bg-neutral-100 dark:bg-neutral-900 text-primary h-screen flex flex-col">
<LayoutTopbar />
<div class="overflow-y-auto pt-3">
<NuxtPage />
</div>
<LayoutNavbar class="mt-auto" />
</div>
<div v-else class="bg-neutral-100 dark:bg-neutral-900 text-primary h-screen flex flex-col">
<Login />
</div>
</div>
<div v-else class="bg-neutral-100 dark:bg-neutral-900 text-primary h-screen flex justify-center items-center">
<div>
<Icon size="4em" name="ion:load-c" class="animate-spin" />
<h2 class="mt-2 font-bold">Loading...</h2>
</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()
2023-06-03 11:22:17 +02:00
const showInstallGuide = ref(null)
2022-09-20 15:53:44 +02:00
2023-12-21 14:47:32 +01:00
const host = ref(null)
2023-03-20 11:23:46 +01:00
onMounted(async () => {
2023-12-21 14:47:32 +01:00
host.value = window.location.hostname
2023-03-20 11:23:46 +01:00
userStore.init()
2023-01-22 15:34:32 +01:00
2023-01-22 20:02:53 +01:00
Device.getInfo().then(info => {
2023-05-15 15:06:45 +02:00
if (info.platform === 'ios') {
showInstallGuide.value = false;
document.getElementsByClassName('top-right')[0].classList.add('toastios')
} else if (info.platform === 'web' && process.client && 'serviceWorker' in navigator && window.isSecureContext) {
if (window.matchMedia('(display-mode: standalone)').matches) showInstallGuide.value = false
2023-06-03 11:22:17 +02:00
else showInstallGuide.value = true
2023-01-22 20:02:53 +01:00
2023-05-15 15:06:45 +02:00
registerServiceWorker()
2023-06-03 11:22:17 +02:00
} else {
showInstallGuide.value = true
2022-09-30 21:17:12 +02:00
}
2023-05-15 15:06:45 +02: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>