1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-10 02:49:58 +00:00
elk/pages/notifications.vue

52 lines
1.3 KiB
Vue
Raw Normal View History

2022-11-15 21:21:54 +00:00
<script setup lang="ts">
2022-11-23 13:06:27 +00:00
import { STORAGE_KEY_NOTIFY_TAB } from '~/constants'
2022-11-15 21:21:54 +00:00
definePageMeta({
middleware: 'auth',
})
2022-11-28 14:25:32 +00:00
const { t } = useI18n()
2022-11-29 23:25:29 +00:00
const paginatorAll = useMasto().notifications.getIterator()
const paginatorMention = useMasto().notifications.getIterator({ types: ['mention'] })
2022-11-19 15:15:19 +00:00
2022-11-29 23:25:29 +00:00
const tabs = $computed(() => [
{
name: 'all',
display: t('tab.notifications_all'),
paginator: paginatorAll,
},
{
name: 'mention',
display: t('tab.notifications_mention'),
paginator: paginatorMention,
},
] as const)
// Don't use local storage because it is better to default to Posts every time you visit a user's profile.
const tab = $ref(tabs[0].name)
const paginator = $computed(() => tabs.find(t => t.name === tab)!.paginator)
2022-11-25 11:48:48 +00:00
useHeadFixed({
2022-11-28 14:25:32 +00:00
title: () => t('nav_side.notifications'),
2022-11-25 11:48:48 +00:00
})
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 />
<span>{{ t('nav_side.notifications') }}</span>
</NuxtLink>
2022-11-15 21:21:54 +00:00
</template>
2022-11-24 06:42:26 +00:00
2022-11-23 08:08:49 +00:00
<template #header>
2022-11-29 23:25:29 +00:00
<CommonTabs v-model="tab" :options="tabs" />
2022-11-23 08:08:49 +00:00
</template>
<slot>
2022-11-19 15:15:19 +00:00
<NotificationPaginator :key="tab" :paginator="paginator" />
2022-11-15 21:21:54 +00:00
</slot>
</MainContent>
</template>