2020-02-18 21:16:49 +00:00
|
|
|
<template>
|
2021-10-09 03:33:08 +00:00
|
|
|
<div>
|
|
|
|
<MkHeader :info="header"/>
|
2021-10-14 11:55:59 +00:00
|
|
|
<MkSpacer :content-max="800">
|
|
|
|
<div class="clupoqwt">
|
|
|
|
<XNotifications class="notifications" @before="before" @after="after" :include-types="includeTypes" :unread-only="tab === 'unread'"/>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
2020-02-18 21:16:49 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-10-09 03:44:19 +00:00
|
|
|
import { computed, defineComponent } from 'vue';
|
2021-03-23 08:30:14 +00:00
|
|
|
import Progress from '@client/scripts/loading';
|
|
|
|
import XNotifications from '@client/components/notifications.vue';
|
|
|
|
import * as os from '@client/os';
|
2021-04-10 03:54:12 +00:00
|
|
|
import * as symbols from '@client/symbols';
|
2021-10-09 04:12:41 +00:00
|
|
|
import { notificationTypes } from '@/types';
|
2020-02-18 21:16:49 +00:00
|
|
|
|
2020-10-17 11:12:00 +00:00
|
|
|
export default defineComponent({
|
2020-02-18 21:16:49 +00:00
|
|
|
components: {
|
|
|
|
XNotifications
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
|
|
|
return {
|
2021-04-10 03:54:12 +00:00
|
|
|
[symbols.PAGE_INFO]: {
|
2020-12-26 01:47:36 +00:00
|
|
|
title: this.$ts.notifications,
|
2021-04-20 14:22:59 +00:00
|
|
|
icon: 'fas fa-bell',
|
2021-09-17 13:39:15 +00:00
|
|
|
bg: 'var(--bg)',
|
2021-10-09 03:33:08 +00:00
|
|
|
},
|
2021-10-09 03:44:19 +00:00
|
|
|
tab: 'all',
|
2021-10-09 04:12:41 +00:00
|
|
|
includeTypes: null,
|
2021-10-09 03:44:19 +00:00
|
|
|
header: computed(() => ({
|
2021-10-09 03:33:08 +00:00
|
|
|
title: this.$ts.notifications,
|
|
|
|
icon: 'fas fa-bell',
|
|
|
|
bg: 'var(--bg)',
|
2021-04-10 04:38:24 +00:00
|
|
|
actions: [{
|
2021-10-09 04:12:41 +00:00
|
|
|
text: this.$ts.filter,
|
|
|
|
icon: 'fas fa-filter',
|
|
|
|
highlighted: this.includeTypes != null,
|
|
|
|
handler: this.setFilter,
|
|
|
|
}, {
|
2021-04-10 04:38:24 +00:00
|
|
|
text: this.$ts.markAllAsRead,
|
2021-04-20 14:22:59 +00:00
|
|
|
icon: 'fas fa-check',
|
2021-04-10 04:38:24 +00:00
|
|
|
handler: () => {
|
|
|
|
os.apiWithDialog('notifications/mark-all-as-read');
|
2021-10-09 03:44:19 +00: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'; },
|
|
|
|
},]
|
|
|
|
})),
|
2020-02-18 21:16:49 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
before() {
|
|
|
|
Progress.start();
|
|
|
|
},
|
|
|
|
|
|
|
|
after() {
|
|
|
|
Progress.done();
|
2021-10-09 04:12:41 +00: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 21:16:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
2021-08-21 08:40:15 +00:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.clupoqwt {
|
|
|
|
}
|
|
|
|
</style>
|