sharkey/packages/frontend/src/pages/settings/notifications.notification-config.vue
2024-02-19 10:47:42 +01:00

54 lines
1.6 KiB
Vue

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div class="_gaps_m">
<MkSelect v-model="type">
<option value="all">{{ i18n.ts.all }}</option>
<option value="following" v-if="hasSender">{{ i18n.ts.following }}</option>
<option value="follower" v-if="hasSender">{{ i18n.ts.followers }}</option>
<option value="mutualFollow" v-if="hasSender">{{ i18n.ts.mutualFollow }}</option>
<option value="list" v-if="hasSender">{{ i18n.ts.userList }}</option>
<option value="never">{{ i18n.ts.none }}</option>
</MkSelect>
<MkSelect v-if="type === 'list'" v-model="userListId">
<template #label>{{ i18n.ts.userList }}</template>
<option v-for="list in props.userLists" :key="list.id" :value="list.id">{{ list.name }}</option>
</MkSelect>
<div class="_buttons">
<MkButton inline primary @click="save"><i class="ph-check ph-bold ph-lg"></i> {{ i18n.ts.save }}</MkButton>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import MkSelect from '@/components/MkSelect.vue';
import MkButton from '@/components/MkButton.vue';
import { i18n } from '@/i18n.js';
const props = withDefaults(defineProps<{
value: any;
userLists: Misskey.entities.UserList[];
hasSender: boolean;
}>(), {
hasSender: true,
});
const emit = defineEmits<{
(ev: 'update', result: any): void;
}>();
const type = ref(props.value.type);
const userListId = ref(props.value.userListId);
function save() {
emit('update', { type: type.value, userListId: userListId.value });
}
</script>