2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2023-05-19 07:20:53 +00:00
|
|
|
<MkContainer :style="`height: ${widgetProps.height}px;`" :showHeader="widgetProps.showHeader" :scrollable="true" data-cy-mkw-notifications class="mkw-notifications">
|
2023-11-03 22:20:53 +00:00
|
|
|
<template #icon><i class="ph-bell ph-bold ph-lg"></i></template>
|
2023-01-14 23:30:29 +00:00
|
|
|
<template #header>{{ i18n.ts.notifications }}</template>
|
2023-11-03 22:20:53 +00:00
|
|
|
<template #func="{ buttonStyleClass }"><button class="_button" :class="buttonStyleClass" @click="configureNotification()"><i class="ph-gear ph-bold ph-lg"></i></button></template>
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2021-10-23 14:22:20 +00:00
|
|
|
<div>
|
2023-09-29 02:29:54 +00:00
|
|
|
<XNotifications :excludeTypes="widgetProps.excludeTypes"/>
|
2020-07-11 01:13:11 +00:00
|
|
|
</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
</MkContainer>
|
2020-01-29 19:37:25 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-08 11:30:01 +00:00
|
|
|
<script lang="ts" setup>
|
2022-07-20 13:24:26 +00:00
|
|
|
import { defineAsyncComponent } from 'vue';
|
2023-12-21 02:36:45 +00:00
|
|
|
import { useWidgetPropsManager, WidgetComponentEmits, WidgetComponentExpose, WidgetComponentProps } from './widget.js';
|
2023-09-19 07:37:43 +00:00
|
|
|
import { GetFormResultType } from '@/scripts/form.js';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkContainer from '@/components/MkContainer.vue';
|
2022-08-30 15:24:33 +00:00
|
|
|
import XNotifications from '@/components/MkNotifications.vue';
|
2023-09-19 07:37:43 +00:00
|
|
|
import * as os from '@/os.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-01-08 11:30:01 +00:00
|
|
|
const name = 'notifications';
|
2020-10-17 11:12:00 +00:00
|
|
|
|
2022-01-08 11:30:01 +00:00
|
|
|
const widgetPropsDef = {
|
|
|
|
showHeader: {
|
|
|
|
type: 'boolean' as const,
|
|
|
|
default: true,
|
2020-01-29 19:37:25 +00:00
|
|
|
},
|
2022-01-08 11:30:01 +00:00
|
|
|
height: {
|
|
|
|
type: 'number' as const,
|
|
|
|
default: 300,
|
|
|
|
},
|
2023-09-29 02:29:54 +00:00
|
|
|
excludeTypes: {
|
2022-01-08 11:30:01 +00:00
|
|
|
type: 'array' as const,
|
|
|
|
hidden: true,
|
2023-09-29 02:29:54 +00:00
|
|
|
default: [],
|
2020-01-29 19:37:25 +00:00
|
|
|
},
|
2022-01-08 11:30:01 +00:00
|
|
|
};
|
2020-08-22 01:06:17 +00:00
|
|
|
|
2022-01-08 11:30:01 +00:00
|
|
|
type WidgetProps = GetFormResultType<typeof widgetPropsDef>;
|
|
|
|
|
2023-05-19 07:20:53 +00:00
|
|
|
const props = defineProps<WidgetComponentProps<WidgetProps>>();
|
|
|
|
const emit = defineEmits<WidgetComponentEmits<WidgetProps>>();
|
2023-07-07 22:08:16 +00:00
|
|
|
|
2022-01-08 11:30:01 +00:00
|
|
|
const { widgetProps, configure, save } = useWidgetPropsManager(name,
|
|
|
|
widgetPropsDef,
|
|
|
|
props,
|
|
|
|
emit,
|
|
|
|
);
|
|
|
|
|
|
|
|
const configureNotification = () => {
|
2023-09-29 02:29:54 +00:00
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkNotificationSelectWindow.vue')), {
|
|
|
|
excludeTypes: widgetProps.excludeTypes,
|
2022-01-08 11:30:01 +00:00
|
|
|
}, {
|
|
|
|
done: async (res) => {
|
2023-09-29 02:29:54 +00:00
|
|
|
const { excludeTypes } = res;
|
|
|
|
widgetProps.excludeTypes = excludeTypes;
|
2022-01-08 11:30:01 +00:00
|
|
|
save();
|
2022-07-20 13:24:26 +00:00
|
|
|
},
|
2022-01-08 11:30:01 +00:00
|
|
|
}, 'closed');
|
|
|
|
};
|
|
|
|
|
|
|
|
defineExpose<WidgetComponentExpose>({
|
|
|
|
name,
|
|
|
|
configure,
|
|
|
|
id: props.widget ? props.widget.id : null,
|
2020-01-29 19:37:25 +00:00
|
|
|
});
|
|
|
|
</script>
|