7b1efd6b97
* feat: 個人宛てお知らせ機能 * Remove unused import * Update packages/backend/src/server/api/endpoints/admin/announcements/create.ts Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Update packages/frontend/src/pages/announcements.vue Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Restore breakline * 一般向けAPIにはuserオブジェクトを提供しない * fix * Fix * Update packages/misskey-js/src/entities.ts Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Fix * Update misskey-js.api.md * Fix lint * 他のテーブルに合わせて character varying(32) にした * count クエリを1つにまとめた * user を pack するようにした * いろいろ修正 * 個人宛てのお知らせの表示を改善 * Update misskey-js.api.md * Merge migration scripts * Fix * Update packages/backend/migration/1688647797135-userannouncement.js Co-authored-by: riku6460 <17585784+riku6460@users.noreply.github.com> * Update packages/backend/src/models/entities/Announcement.ts Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com> * Fix * Update migration script --------- Co-authored-by: CyberRex <hspwinx86@gmail.com> Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
95 lines
2.2 KiB
Vue
95 lines
2.2 KiB
Vue
<template>
|
|
<MkStickyContainer>
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
<MkSpacer :contentMax="800">
|
|
<MkPagination v-slot="{items}" :pagination="pagination" class="ruryvtyk _gaps_m">
|
|
<section v-for="(announcement, i) in items" :key="announcement.id" :class="{ announcement: true, _panel: true, private: announcement.isPrivate }">
|
|
<div class="header"><span v-if="$i && !announcement.isRead"><span class="ti ti-speakerphone"></span></span><Mfm :text="announcement.title"/></div>
|
|
<div class="content">
|
|
<Mfm :text="announcement.text"/>
|
|
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
|
|
</div>
|
|
<div v-if="$i && !announcement.isRead" class="footer">
|
|
<MkButton primary @click="read(items, announcement, i)"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton>
|
|
</div>
|
|
</section>
|
|
</MkPagination>
|
|
</MkSpacer>
|
|
</MkStickyContainer>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { } from 'vue';
|
|
import MkPagination from '@/components/MkPagination.vue';
|
|
import MkButton from '@/components/MkButton.vue';
|
|
import * as os from '@/os';
|
|
import { i18n } from '@/i18n';
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
|
import { $i } from '@/account';
|
|
|
|
const pagination = {
|
|
endpoint: 'announcements' as const,
|
|
limit: 10,
|
|
};
|
|
|
|
// TODO: これは実質的に親コンポーネントから子コンポーネントのプロパティを変更してるのでなんとかしたい
|
|
function read(items, announcement, i) {
|
|
items[i] = {
|
|
...announcement,
|
|
isRead: true,
|
|
};
|
|
os.api('i/read-announcement', { announcementId: announcement.id });
|
|
}
|
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
definePageMetadata({
|
|
title: i18n.ts.announcements,
|
|
icon: 'ti ti-speakerphone',
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.ruryvtyk {
|
|
|
|
> .private {
|
|
border-left: 4px solid olivedrab;
|
|
}
|
|
|
|
> .announcement {
|
|
padding: 16px;
|
|
|
|
> .header {
|
|
margin-bottom: 16px;
|
|
font-weight: bold;
|
|
}
|
|
|
|
> .content {
|
|
> img {
|
|
display: block;
|
|
max-height: 300px;
|
|
max-width: 100%;
|
|
}
|
|
}
|
|
|
|
> .footer {
|
|
margin-top: 16px;
|
|
}
|
|
}
|
|
}
|
|
|
|
@keyframes fade {
|
|
0% {
|
|
opacity: 0;
|
|
}
|
|
50% {
|
|
opacity: 1;
|
|
}
|
|
100% {
|
|
opacity: 0;
|
|
}
|
|
}
|
|
</style>
|