wip
This commit is contained in:
parent
4c5cf43ea1
commit
9f69035607
|
|
@ -108,8 +108,8 @@ function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Pr
|
|||
})
|
||||
.then(res => new Promise<Account | { error: Record<string, any> }>((done2, fail2) => {
|
||||
if (res.status >= 500 && res.status < 600) {
|
||||
// サーバーエラー(5xx)の場合をrejectとする
|
||||
// (認証エラーなど4xxはresolve)
|
||||
// サーバーエラー(5xx)の場合をrejectとする
|
||||
// (認証エラーなど4xxはresolve)
|
||||
return fail2(res);
|
||||
}
|
||||
res.json().then(done2, fail2);
|
||||
|
|
|
|||
|
|
@ -83,6 +83,14 @@ export async function mainBoot() {
|
|||
}
|
||||
});
|
||||
|
||||
for (const announcement of $i.announcements.filter(x => x.display === 'dialog')) {
|
||||
popup(defineAsyncComponent(() => import('@/components/MkAnnouncementDialog.vue')), {
|
||||
announcement,
|
||||
}, {}, 'closed');
|
||||
}
|
||||
|
||||
// TODO: announcementCreatedイベント監視
|
||||
|
||||
if ($i.isDeleted) {
|
||||
alert({
|
||||
type: 'warning',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
<!--
|
||||
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
||||
SPDX-License-Identifier: AGPL-3.0-only
|
||||
-->
|
||||
|
||||
<template>
|
||||
<MkModal ref="modal" :zPriority="'middle'" @closed="$emit('closed')">
|
||||
<div :class="$style.root">
|
||||
<div :class="$style.title">{{ announcement.title }}</div>
|
||||
<div :class="$style.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 MkModal from '@/components/MkModal.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
announcement: misskey.entities.Announcement;
|
||||
}>(), {
|
||||
});
|
||||
|
||||
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
||||
|
||||
function ok() {
|
||||
modal.value.close();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.root {
|
||||
margin: auto;
|
||||
position: relative;
|
||||
padding: 32px;
|
||||
min-width: 320px;
|
||||
max-width: 480px;
|
||||
box-sizing: border-box;
|
||||
text-align: center;
|
||||
background: var(--panel);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.text {
|
||||
margin: 1em 0;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -104,6 +104,7 @@ export type MeDetailed = UserDetailed & {
|
|||
noCrawle: boolean;
|
||||
receiveAnnouncementEmail: boolean;
|
||||
usePasswordLessLogin: boolean;
|
||||
announcements: Announcement[];
|
||||
[other: string]: any;
|
||||
};
|
||||
|
||||
|
|
@ -413,6 +414,9 @@ export type Announcement = {
|
|||
text: string;
|
||||
title: string;
|
||||
imageUrl: string | null;
|
||||
display: 'normal' | 'banner' | 'dialog';
|
||||
needConfirmationToRead: boolean;
|
||||
forYou: boolean;
|
||||
isRead?: boolean;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue