2022-11-15 22:21:54 +01:00
|
|
|
<script setup lang="ts">
|
2022-11-23 14:06:27 +01:00
|
|
|
import { STORAGE_KEY_NOTIFY_TAB } from '~/constants'
|
|
|
|
|
2022-11-15 22:21:54 +01:00
|
|
|
definePageMeta({
|
|
|
|
middleware: 'auth',
|
|
|
|
})
|
|
|
|
|
2022-11-28 15:25:32 +01:00
|
|
|
const { t } = useI18n()
|
|
|
|
|
2022-11-20 22:38:52 +01:00
|
|
|
const tabNames = ['All', 'Mentions'] as const
|
2022-11-23 14:06:27 +01:00
|
|
|
const tab = $(useLocalStorage<typeof tabNames[number]>(STORAGE_KEY_NOTIFY_TAB, 'All'))
|
2022-11-19 16:15:19 +01:00
|
|
|
|
|
|
|
const paginator = $computed(() => {
|
2022-11-26 16:42:58 +01:00
|
|
|
return useMasto().notifications.getIterator(tab === 'All' ? undefined : { types: ['mention'] })
|
2022-11-19 16:15:19 +01:00
|
|
|
})
|
2022-11-25 12:48:48 +01:00
|
|
|
|
|
|
|
useHead({
|
2022-11-28 15:25:32 +01:00
|
|
|
title: () => t('nav_side.notifications'),
|
2022-11-25 12:48:48 +01:00
|
|
|
})
|
2022-11-15 22:21:54 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<MainContent>
|
|
|
|
<template #title>
|
2022-11-29 21:15:53 +01:00
|
|
|
<NuxtLink to="/notifications" text-lg font-bold flex items-center gap-2 @click="$scrollToTop">
|
|
|
|
<div i-ri:notification-4-line />
|
|
|
|
<span>{{ t('nav_side.notifications') }}</span>
|
|
|
|
</NuxtLink>
|
2022-11-15 22:21:54 +01:00
|
|
|
</template>
|
2022-11-24 07:42:26 +01:00
|
|
|
|
2022-11-23 09:08:49 +01:00
|
|
|
<template #header>
|
2022-11-20 22:38:52 +01:00
|
|
|
<CommonTabs v-model="tab" :options="tabNames" />
|
2022-11-23 09:08:49 +01:00
|
|
|
</template>
|
|
|
|
<slot>
|
2022-11-19 16:15:19 +01:00
|
|
|
<NotificationPaginator :key="tab" :paginator="paginator" />
|
2022-11-15 22:21:54 +01:00
|
|
|
</slot>
|
|
|
|
</MainContent>
|
|
|
|
</template>
|