main
vue 33 lines 794 Bytes
Raw
1 <template>
2 <div
3 class="notifications-toolbar flex"
4 :class="{ 'justify-between': hasNotifications, 'justify-end': !hasNotifications }"
5 >
6 <n-button v-if="hasNotifications" quaternary @click="deleteAll()">Clear</n-button>
7 <n-button strong secondary type="primary" :disabled="!hasUnread" @click="setAllRead()">
8 Mark all as read
9 </n-button>
10 </div>
11 </template>
12
13 <script lang="ts" setup>
14 import { NButton } from "naive-ui"
15 import { useNotifications } from "@/composables/useNotifications"
16
17 const hasUnread = useNotifications().hasUnread
18 const hasNotifications = useNotifications().hasNotifications
19
20 function setAllRead() {
21 useNotifications().setAllRead()
22 }
23
24 function deleteAll() {
25 useNotifications().deleteAll()
26 }
27 </script>
28
29 <style>
30 .notifications-toolbar {
31 width: 100%;
32 }
33 </style>