feat: notifications settings page (#782)
This commit is contained in:
parent
0d66038eaa
commit
d4e99566b8
19 changed files with 519 additions and 362 deletions
|
@ -4,7 +4,6 @@ definePageMeta({
|
|||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const showSettings = ref(false)
|
||||
const pwaEnabled = useRuntimeConfig().public.pwaEnabled
|
||||
|
||||
const tabs = $computed(() => [
|
||||
|
@ -19,10 +18,6 @@ const tabs = $computed(() => [
|
|||
display: t('tab.notifications_mention'),
|
||||
},
|
||||
] as const)
|
||||
|
||||
onActivated(() => {
|
||||
showSettings.value = false
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -34,15 +29,15 @@ onActivated(() => {
|
|||
</NuxtLink>
|
||||
</template>
|
||||
|
||||
<template v-if="pwaEnabled" #actions>
|
||||
<button
|
||||
<template #actions>
|
||||
<NuxtLink
|
||||
flex rounded-4 p1
|
||||
hover:bg-active cursor-pointer transition-100
|
||||
:title="showSettings ? t('notification.settings.close_btn') : t('notification.settings.show_btn')"
|
||||
@click="showSettings = !showSettings"
|
||||
:title="t('settings.notifications.show_btn')"
|
||||
to="/settings/notifications"
|
||||
>
|
||||
<span aria-hidden="true" :class="showSettings ? 'i-ri:close-line' : 'i-ri:settings-line'" />
|
||||
</button>
|
||||
<span aria-hidden="true" i-ri:notification-badge-line />
|
||||
</NuxtLink>
|
||||
</template>
|
||||
|
||||
<template #header>
|
||||
|
@ -51,7 +46,7 @@ onActivated(() => {
|
|||
|
||||
<slot>
|
||||
<template v-if="pwaEnabled">
|
||||
<NotificationPreferences :show="showSettings" />
|
||||
<NotificationPreferences />
|
||||
</template>
|
||||
|
||||
<NuxtPage />
|
||||
|
|
|
@ -39,6 +39,13 @@ const isRootPath = computedEager(() => route.name === 'settings')
|
|||
:text="$t('settings.interface.label')"
|
||||
to="/settings/interface"
|
||||
/>
|
||||
<SettingsItem
|
||||
v-if="isHydrated && currentUser"
|
||||
command
|
||||
icon="i-ri:notification-badge-line"
|
||||
:text="$t('settings.notifications_settings')"
|
||||
to="/settings/notifications"
|
||||
/>
|
||||
<SettingsItem
|
||||
v-if="isHydrated && currentUser"
|
||||
command
|
||||
|
|
35
pages/settings/notifications/index.vue
Normal file
35
pages/settings/notifications/index.vue
Normal file
|
@ -0,0 +1,35 @@
|
|||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
const pwaEnabled = useRuntimeConfig().public.pwaEnabled
|
||||
|
||||
useHeadFixed({
|
||||
title: () => `${t('settings.notifications.notifications.label')} | ${t('nav.settings')}`,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<MainContent back-on-small-screen>
|
||||
<template #title>
|
||||
<div text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
|
||||
<span>{{ $t('settings.notifications.notifications.label') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<SettingsItem
|
||||
command
|
||||
:text="$t('settings.notifications.notifications.label')"
|
||||
to="/settings/notifications/notifications"
|
||||
/>
|
||||
<SettingsItem
|
||||
command
|
||||
:disabled="!pwaEnabled"
|
||||
:text="$t('settings.notifications.push_notifications.label')"
|
||||
:description="$t('settings.notifications.push_notifications.description')"
|
||||
to="/settings/notifications/push-notifications"
|
||||
/>
|
||||
</MainContent>
|
||||
</template>
|
27
pages/settings/notifications/notifications.vue
Normal file
27
pages/settings/notifications/notifications.vue
Normal file
|
@ -0,0 +1,27 @@
|
|||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
useHeadFixed({
|
||||
title: () => `${t('settings.notifications.notifications.label')} | ${t('settings.notifications.label')} | ${t('nav.settings')}`,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<MainContent back>
|
||||
<template #title>
|
||||
<div text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
|
||||
<span>{{ $t('settings.notifications.notifications.label') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<h3 px6 py4 mt2 font-bold text-xl flex="~ gap-1" items-center>
|
||||
{{ $t('settings.notifications.notifications.label') }}
|
||||
</h3>
|
||||
<p text-4xl text-center>
|
||||
<span sr-only>Under construction</span> 🚧
|
||||
</p>
|
||||
</MainContent>
|
||||
</template>
|
25
pages/settings/notifications/push-notifications.vue
Normal file
25
pages/settings/notifications/push-notifications.vue
Normal file
|
@ -0,0 +1,25 @@
|
|||
<script setup lang="ts">
|
||||
definePageMeta({
|
||||
middleware: ['auth', () => {
|
||||
if (!useRuntimeConfig().public.pwaEnabled)
|
||||
return navigateTo('/settings/notifications')
|
||||
}],
|
||||
})
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
useHeadFixed({
|
||||
title: () => `${t('settings.notifications.push_notifications.label')} | ${t('settings.notifications.label')} | ${t('nav.settings')}`,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<MainContent back>
|
||||
<template #title>
|
||||
<div text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
|
||||
<span>{{ $t('settings.notifications.push_notifications.label') }}</span>
|
||||
</div>
|
||||
</template>
|
||||
<NotificationPreferences show />
|
||||
</MainContent>
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue