mirror of
https://github.com/elk-zone/elk
synced 2024-11-27 22:38:11 +09:00
feat: notification type selector (#16)
This commit is contained in:
parent
1aa81a3a0a
commit
230f5111ac
@ -1,10 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import type { FetchNotificationsParams } from 'masto'
|
||||
definePageMeta({
|
||||
middleware: 'auth',
|
||||
})
|
||||
|
||||
const masto = await useMasto()
|
||||
const paginator = masto.notifications.getIterator()
|
||||
|
||||
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'] })
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@ -16,7 +23,14 @@ const paginator = masto.notifications.getIterator()
|
||||
<div color-gray i-ri:equalizer-fill mr-1 h-6 />
|
||||
</template>
|
||||
<slot>
|
||||
<NotificationPaginator :paginator="paginator" />
|
||||
<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" />
|
||||
</slot>
|
||||
</MainContent>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user