elk/pages/notifications.vue

37 lines
1.2 KiB
Vue
Raw Normal View History

2022-11-15 21:21:54 +00:00
<script setup lang="ts">
2022-11-19 15:15:19 +00:00
import type { FetchNotificationsParams } from 'masto'
2022-11-15 21:21:54 +00:00
definePageMeta({
middleware: 'auth',
})
const masto = await useMasto()
2022-11-19 15:15:19 +00:00
const tabNames = ['all', 'mentions'] as const
const tab = $(useLocalStorage<typeof tabNames[number]>('nuxtodon-notifications-tab', 'all'))
const paginator = $computed(() => {
return masto.notifications.getIterator(tab === 'all' ? undefined : { types: ['mention'] })
})
2022-11-15 21:21:54 +00:00
</script>
<template>
<MainContent>
<template #title>
<div i-ri:notification-2-fill h-6 mr-1 /><span>Notifications</span>
</template>
<template #actions>
<div color-gray i-ri:equalizer-fill mr-1 h-6 />
</template>
<slot>
2022-11-19 15:15:19 +00:00
<div flex w-full>
<template v-for="type in tabNames" :key="type">
<input
:id="`tab-${type}`" v-model="tab" :value="type" type="radio" name="tabs" display="none"
><label flex w-full justify-center h-8 cursor-pointer :for="`tab-${type}`" :class="tab === type ? 'color-primary' : 'hover:color-purple'" tabindex="1" @keypress.enter="tab = type">{{ type }}</label>
</template>
</div>
<NotificationPaginator :key="tab" :paginator="paginator" />
2022-11-15 21:21:54 +00:00
</slot>
</MainContent>
</template>