elk/pages/notifications.vue

61 lines
1.5 KiB
Vue
Raw Normal View History

2022-11-15 21:21:54 +00:00
<script setup lang="ts">
definePageMeta({
middleware: 'auth',
})
2022-11-28 14:25:32 +00:00
const { t } = useI18n()
const showSettings = ref(false)
const pwaEnabled = useRuntimeConfig().public.pwaEnabled
2022-11-28 14:25:32 +00:00
2022-11-29 23:25:29 +00:00
const tabs = $computed(() => [
{
name: 'all',
to: '/notifications',
2022-11-29 23:25:29 +00:00
display: t('tab.notifications_all'),
},
{
name: 'mention',
to: '/notifications/mention',
2022-11-29 23:25:29 +00:00
display: t('tab.notifications_mention'),
},
] as const)
onActivated(() => {
showSettings.value = false
})
2022-11-15 21:21:54 +00:00
</script>
<template>
<MainContent>
<template #title>
2022-11-29 20:15:53 +00:00
<NuxtLink to="/notifications" text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
<div i-ri:notification-4-line />
2022-12-27 17:49:15 +00:00
<span>{{ t('nav.notifications') }}</span>
2022-11-29 20:15:53 +00:00
</NuxtLink>
2022-11-15 21:21:54 +00:00
</template>
2022-11-24 06:42:26 +00:00
<template v-if="pwaEnabled" #actions>
<button
flex rounded-4 p1
hover:bg-active cursor-pointer transition-100
2022-12-27 18:00:42 +00:00
:title="showSettings ? t('notification.settings.close_btn') : t('notification.settings.show_btn')"
@click="showSettings = !showSettings"
>
2022-12-19 20:31:12 +00:00
<span aria-hidden="true" w-1.75em h-1.75em :class="showSettings ? 'i-ri:close-line' : 'i-ri:settings-line'" />
</button>
</template>
2022-11-23 08:08:49 +00:00
<template #header>
<CommonRouteTabs replace :options="tabs" />
2022-11-23 08:08:49 +00:00
</template>
<slot>
<template v-if="pwaEnabled">
<NotificationPreferences :show="showSettings" />
</template>
<NuxtPage />
</slot>
2022-11-15 21:21:54 +00:00
</MainContent>
</template>