feat: pwa with push notifications (#337)

This commit is contained in:
Joaquín Sánchez 2022-12-18 00:29:16 +01:00 committed by GitHub
parent a18e5e2332
commit f0c91a3974
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
48 changed files with 2903 additions and 14 deletions

View file

@ -4,6 +4,8 @@ definePageMeta({
})
const { t } = useI18n()
const showSettings = ref(false)
const pwaEnabled = useRuntimeConfig().public.pwaEnabled
const tabs = $computed(() => [
{
@ -17,6 +19,10 @@ const tabs = $computed(() => [
display: t('tab.notifications_mention'),
},
] as const)
onActivated(() => {
showSettings.value = false
})
</script>
<template>
@ -28,9 +34,26 @@ const tabs = $computed(() => [
</NuxtLink>
</template>
<template v-if="pwaEnabled" #actions>
<button
flex rounded-4 p1
hover:bg-active cursor-pointer transition-100
:title="$t(showSettings ? 'notification.settings.close_btn' : 'notification.settings.show_btn')"
@click="showSettings = !showSettings"
>
<span aria-hidden="true" w-1.75em h-1.75em :class="showSettings ? 'i-ri:close-circle-line' : 'i-ri:settings-3-fill'" />
</button>
</template>
<template #header>
<CommonRouteTabs replace :options="tabs" />
</template>
<NuxtPage />
<slot>
<template v-if="pwaEnabled">
<NotificationPreferences :show="showSettings" />
</template>
<NuxtPage />
</slot>
</MainContent>
</template>