2020-02-18 14:16:49 -07:00
|
|
|
<template>
|
2021-10-23 13:03:07 -06:00
|
|
|
<MkSpacer :content-max="800">
|
|
|
|
<div class="clupoqwt">
|
2021-12-24 21:38:53 -07:00
|
|
|
<XNotifications class="notifications" :include-types="includeTypes" :unread-only="tab === 'unread'"/>
|
2021-10-23 13:03:07 -06:00
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2020-02-18 14:16:49 -07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-10-08 21:44:19 -06:00
|
|
|
import { computed, defineComponent } from 'vue';
|
2021-11-11 10:02:25 -07:00
|
|
|
import XNotifications from '@/components/notifications.vue';
|
|
|
|
import * as os from '@/os';
|
|
|
|
import * as symbols from '@/symbols';
|
|
|
|
import { notificationTypes } from 'misskey-js';
|
2020-02-18 14:16:49 -07:00
|
|
|
|
2020-10-17 05:12:00 -06:00
|
|
|
export default defineComponent({
|
2020-02-18 14:16:49 -07:00
|
|
|
components: {
|
|
|
|
XNotifications
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-10-23 13:03:07 -06:00
|
|
|
[symbols.PAGE_INFO]: computed(() => ({
|
2021-10-08 21:33:08 -06:00
|
|
|
title: this.$ts.notifications,
|
|
|
|
icon: 'fas fa-bell',
|
|
|
|
bg: 'var(--bg)',
|
2021-04-09 22:38:24 -06:00
|
|
|
actions: [{
|
2021-10-08 22:12:41 -06:00
|
|
|
text: this.$ts.filter,
|
|
|
|
icon: 'fas fa-filter',
|
|
|
|
highlighted: this.includeTypes != null,
|
|
|
|
handler: this.setFilter,
|
|
|
|
}, {
|
2021-04-09 22:38:24 -06:00
|
|
|
text: this.$ts.markAllAsRead,
|
2021-04-20 08:22:59 -06:00
|
|
|
icon: 'fas fa-check',
|
2021-04-09 22:38:24 -06:00
|
|
|
handler: () => {
|
|
|
|
os.apiWithDialog('notifications/mark-all-as-read');
|
2021-10-08 21:44:19 -06:00
|
|
|
},
|
|
|
|
}],
|
|
|
|
tabs: [{
|
|
|
|
active: this.tab === 'all',
|
|
|
|
title: this.$ts.all,
|
|
|
|
onClick: () => { this.tab = 'all'; },
|
|
|
|
}, {
|
|
|
|
active: this.tab === 'unread',
|
|
|
|
title: this.$ts.unread,
|
|
|
|
onClick: () => { this.tab = 'unread'; },
|
|
|
|
},]
|
|
|
|
})),
|
2021-10-23 13:03:07 -06:00
|
|
|
tab: 'all',
|
|
|
|
includeTypes: null,
|
2020-02-18 14:16:49 -07:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2021-10-08 22:12:41 -06:00
|
|
|
setFilter(ev) {
|
|
|
|
const typeItems = notificationTypes.map(t => ({
|
|
|
|
text: this.$t(`_notification._types.${t}`),
|
|
|
|
active: this.includeTypes && this.includeTypes.includes(t),
|
|
|
|
action: () => {
|
|
|
|
this.includeTypes = [t];
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
const items = this.includeTypes != null ? [{
|
|
|
|
icon: 'fas fa-times',
|
|
|
|
text: this.$ts.clear,
|
|
|
|
action: () => {
|
|
|
|
this.includeTypes = null;
|
|
|
|
}
|
|
|
|
}, null, ...typeItems] : typeItems;
|
|
|
|
os.popupMenu(items, ev.currentTarget || ev.target);
|
2020-02-18 14:16:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2021-08-21 02:40:15 -06:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.clupoqwt {
|
|
|
|
}
|
|
|
|
</style>
|