summaryrefslogtreecommitdiff
path: root/src/client/widgets/notifications.vue
blob: 9d6282735b7875cf11cf728a5f63c1ef314838f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<mk-container :style="`height: ${props.height}px;`" :show-header="props.showHeader" :scrollable="true">
	<template #header><fa :icon="faBell"/>{{ $t('notifications') }}</template>
	<template #func><button @click="configure()" class="_button"><fa :icon="faCog"/></button></template>

	<div>
		<x-notifications :include-types="props.includingTypes"/>
	</div>
</mk-container>
</template>

<script lang="ts">
import { faBell, faCog } from '@fortawesome/free-solid-svg-icons';
import MkContainer from '../components/ui/container.vue';
import XNotifications from '../components/notifications.vue';
import define from './define';

export default define({
	name: 'notifications',
	props: () => ({
		showHeader: {
			type: 'boolean',
			default: true,
		},
		height: {
			type: 'number',
			default: 300,
		},
		includingTypes: {
			type: 'array',
			hidden: true,
			default: null,
		},
	})
}).extend({
	components: {
		MkContainer,
		XNotifications,
	},

	data() {
		return {
			faBell, faCog
		};
	},

	methods: {
		async configure() {
			this.$root.new(await import('../components/notification-setting-window.vue').then(m => m.default), {
				includingTypes: this.props.includingTypes,
			}).$on('ok', async ({ includingTypes }) => {
				this.props.includingTypes = includingTypes;
				this.save();
			});
		}
	}
});
</script>