2020-10-17 13:12:00 +02:00
|
|
|
<template>
|
2021-11-28 12:07:37 +01:00
|
|
|
<div class="_formRoot">
|
2023-03-29 21:53:07 +02:00
|
|
|
<FormButton class="_formBlock" @click="configure"><template #icon><i class="ph-gear-six ph-bold ph-lg"></i></template>{{ i18n.ts.notificationSetting }}</FormButton>
|
2021-11-28 12:07:37 +01:00
|
|
|
<FormSection>
|
2023-03-29 21:53:07 +02:00
|
|
|
<ForFormButtonmLink class="_formBlock" @click="readAllNotifications">{{ i18n.ts.markAsReadAllNotifications }}</ForFormButtonmLink>
|
|
|
|
<FormButton class="_formBlock" @click="readAllUnreadNotes">{{ i18n.ts.markAsReadAllUnreadNotes }}</FormButton>
|
|
|
|
<FormButton class="_formBlock" @click="readAllMessagingMessages">{{ i18n.ts.markAsReadAllTalkMessages }}</FormButton>
|
2021-11-28 12:07:37 +01:00
|
|
|
</FormSection>
|
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</template>
|
|
|
|
|
2022-05-12 19:31:26 +02:00
|
|
|
<script lang="ts" setup>
|
2022-06-20 10:38:49 +02:00
|
|
|
import { defineAsyncComponent } from 'vue';
|
2022-12-12 04:24:12 +01:00
|
|
|
import { notificationTypes } from 'calckey-js';
|
2022-09-06 11:21:49 +02:00
|
|
|
import FormButton from '@/components/MkButton.vue';
|
2021-11-28 12:07:37 +01:00
|
|
|
import FormLink from '@/components/form/link.vue';
|
|
|
|
import FormSection from '@/components/form/section.vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import * as os from '@/os';
|
2022-05-04 05:25:19 +02:00
|
|
|
import { $i } from '@/account';
|
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 10:38:49 +02:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-05-04 05:25:19 +02:00
|
|
|
async function readAllUnreadNotes() {
|
|
|
|
await os.api('i/read-all-unread-notes');
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-05-04 05:25:19 +02:00
|
|
|
async function readAllMessagingMessages() {
|
|
|
|
await os.api('i/read-all-messaging-messages');
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-05-04 05:25:19 +02:00
|
|
|
async function readAllNotifications() {
|
|
|
|
await os.api('notifications/mark-all-as-read');
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-05-04 05:25:19 +02:00
|
|
|
function configure() {
|
|
|
|
const includingTypes = notificationTypes.filter(x => !$i!.mutingNotificationTypes.includes(x));
|
2022-08-30 17:24:33 +02:00
|
|
|
os.popup(defineAsyncComponent(() => import('@/components/MkNotificationSettingWindow.vue')), {
|
2022-05-04 05:25:19 +02:00
|
|
|
includingTypes,
|
|
|
|
showGlobalToggle: false,
|
|
|
|
}, {
|
|
|
|
done: async (res) => {
|
|
|
|
const { includingTypes: value } = res;
|
|
|
|
await os.apiWithDialog('i/update', {
|
|
|
|
mutingNotificationTypes: notificationTypes.filter(x => !value.includes(x)),
|
|
|
|
}).then(i => {
|
|
|
|
$i!.mutingNotificationTypes = i.mutingNotificationTypes;
|
|
|
|
});
|
2022-06-20 10:38:49 +02:00
|
|
|
},
|
2022-05-04 05:25:19 +02:00
|
|
|
}, 'closed');
|
|
|
|
}
|
2020-10-17 13:12:00 +02:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.notifications,
|
2023-03-11 22:01:04 +01:00
|
|
|
icon: 'ph-bell ph-bold ph-lg',
|
2020-10-17 13:12:00 +02:00
|
|
|
});
|
|
|
|
</script>
|