2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-19 09:20:53 +02:00
|
|
|
<MkSpacer :contentMax="800">
|
2023-07-31 07:13:34 +02:00
|
|
|
<MkPagination ref="paginationEl" v-slot="{items}" :pagination="pagination" class="ruryvtyk _gaps_m">
|
|
|
|
<section v-for="announcement in items" :key="announcement.id" class="announcement _panel">
|
2023-01-06 01:41:14 +01:00
|
|
|
<div class="header"><span v-if="$i && !announcement.isRead">🆕 </span>{{ announcement.title }}</div>
|
|
|
|
<div class="content">
|
2022-06-20 10:38:49 +02:00
|
|
|
<Mfm :text="announcement.text"/>
|
|
|
|
<img v-if="announcement.imageUrl" :src="announcement.imageUrl"/>
|
|
|
|
</div>
|
2023-01-06 01:41:14 +01:00
|
|
|
<div v-if="$i && !announcement.isRead" class="footer">
|
2023-07-31 07:13:34 +02:00
|
|
|
<MkButton primary @click="read(announcement.id)"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton>
|
2022-06-20 10:38:49 +02:00
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
</MkPagination>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
<script lang="ts" setup>
|
2023-07-31 07:13:34 +02:00
|
|
|
import { ref } from 'vue';
|
2022-09-06 11:21:49 +02:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2021-11-11 18:02:25 +01:00
|
|
|
import * as os from '@/os';
|
2022-06-20 10:38:49 +02:00
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2023-04-01 06:52:07 +02:00
|
|
|
import { $i } from '@/account';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const pagination = {
|
|
|
|
endpoint: 'announcements' as const,
|
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2023-07-31 07:13:34 +02:00
|
|
|
const paginationEl = ref<InstanceType<typeof MkPagination>>();
|
|
|
|
|
|
|
|
function read(id: string) {
|
|
|
|
if (!paginationEl.value) return;
|
|
|
|
paginationEl.value.updateItem(id, announcement => {
|
|
|
|
announcement.isRead = true;
|
|
|
|
return announcement;
|
|
|
|
});
|
|
|
|
os.api('i/read-announcement', { announcementId: id });
|
2022-06-20 10:38:49 +02:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.announcements,
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-speakerphone',
|
2020-01-29 20:37:25 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2022-12-27 10:29:39 +01:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 20:37:25 +01:00
|
|
|
.ruryvtyk {
|
|
|
|
> .announcement {
|
2023-01-07 11:57:48 +01:00
|
|
|
padding: 16px;
|
|
|
|
|
2023-01-06 01:41:14 +01:00
|
|
|
> .header {
|
2023-01-07 11:57:48 +01:00
|
|
|
margin-bottom: 16px;
|
2023-01-06 01:41:14 +01:00
|
|
|
font-weight: bold;
|
2021-10-24 17:13:54 +02:00
|
|
|
}
|
|
|
|
|
2023-01-06 01:41:14 +01:00
|
|
|
> .content {
|
2020-01-29 20:37:25 +01:00
|
|
|
> img {
|
|
|
|
display: block;
|
|
|
|
max-height: 300px;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
|
|
|
}
|
2023-01-06 01:41:14 +01:00
|
|
|
|
|
|
|
> .footer {
|
2023-01-07 11:57:48 +01:00
|
|
|
margin-top: 16px;
|
2023-01-06 01:41:14 +01:00
|
|
|
}
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|