mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-16 18:29:01 +01:00
1f7a81aae7
* update deps
* node16
* wip
* wip
* wip
* Update test-utils.ts
* wip
* Update tsconfig.json
* wip
* Update package.json
* wip
* Update following.vue
* Update followers.vue
* Update index.vue
* Update share.vue
* Update MkUserPopup.vue
* Update MkPostForm.vue
* wip
* Update MkTokenGenerateWindow.vue
* Update MkPagination.vue
* refactor
* update deps
* update deps
* Update sw.ts
* wip
* wip
* wip
* Update FetchInstanceMetadataService.ts
* Update FetchInstanceMetadataService.ts
* update node
* update deps
* 🎨
104 lines
2.5 KiB
Vue
104 lines
2.5 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<MkModal ref="modal" :zPriority="'middle'" @closed="$emit('closed')" @click="onBgClick">
|
|
<div ref="rootEl" :class="$style.root">
|
|
<div :class="$style.header">
|
|
<span :class="$style.icon">
|
|
<i v-if="announcement.icon === 'info'" class="ti ti-info-circle"></i>
|
|
<i v-else-if="announcement.icon === 'warning'" class="ti ti-alert-triangle" style="color: var(--warn);"></i>
|
|
<i v-else-if="announcement.icon === 'error'" class="ti ti-circle-x" style="color: var(--error);"></i>
|
|
<i v-else-if="announcement.icon === 'success'" class="ti ti-check" style="color: var(--success);"></i>
|
|
</span>
|
|
<span :class="$style.title">{{ announcement.title }}</span>
|
|
</div>
|
|
<div :class="$style.text"><Mfm :text="announcement.text"/></div>
|
|
<MkButton primary full @click="ok">{{ i18n.ts.ok }}</MkButton>
|
|
</div>
|
|
</MkModal>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { onMounted, shallowRef } from 'vue';
|
|
import * as Misskey from 'misskey-js';
|
|
import * as os from '@/os';
|
|
import MkModal from '@/components/MkModal.vue';
|
|
import MkButton from '@/components/MkButton.vue';
|
|
import { i18n } from '@/i18n';
|
|
import { $i, updateAccount } from '@/account';
|
|
|
|
const props = withDefaults(defineProps<{
|
|
announcement: Misskey.entities.Announcement;
|
|
}>(), {
|
|
});
|
|
|
|
const rootEl = shallowRef<HTMLDivElement>();
|
|
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
|
|
|
async function ok() {
|
|
if (props.announcement.needConfirmationToRead) {
|
|
const confirm = await os.confirm({
|
|
type: 'question',
|
|
title: i18n.ts._announcement.readConfirmTitle,
|
|
text: i18n.t('_announcement.readConfirmText', { title: props.announcement.title }),
|
|
});
|
|
if (confirm.canceled) return;
|
|
}
|
|
|
|
modal.value.close();
|
|
os.api('i/read-announcement', { announcementId: props.announcement.id });
|
|
updateAccount({
|
|
unreadAnnouncements: $i!.unreadAnnouncements.filter(a => a.id !== props.announcement.id),
|
|
});
|
|
}
|
|
|
|
function onBgClick() {
|
|
rootEl.value.animate([{
|
|
offset: 0,
|
|
transform: 'scale(1)',
|
|
}, {
|
|
offset: 0.5,
|
|
transform: 'scale(1.1)',
|
|
}, {
|
|
offset: 1,
|
|
transform: 'scale(1)',
|
|
}], {
|
|
duration: 100,
|
|
});
|
|
}
|
|
|
|
onMounted(() => {
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" module>
|
|
.root {
|
|
margin: auto;
|
|
position: relative;
|
|
padding: 32px;
|
|
min-width: 320px;
|
|
max-width: 480px;
|
|
box-sizing: border-box;
|
|
background: var(--panel);
|
|
border-radius: var(--radius);
|
|
}
|
|
|
|
.header {
|
|
font-size: 120%;
|
|
}
|
|
|
|
.icon {
|
|
margin-right: 0.5em;
|
|
}
|
|
|
|
.title {
|
|
font-weight: bold;
|
|
}
|
|
|
|
.text {
|
|
margin: 1em 0;
|
|
}
|
|
</style>
|