2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header
|
|
|
|
><MkPageHeader :actions="headerActions" :tabs="headerTabs"
|
|
|
|
/></template>
|
|
|
|
<MkSpacer :content-max="800">
|
|
|
|
<MkPagination
|
2023-08-01 03:23:03 +02:00
|
|
|
ref="paginationEl"
|
2023-04-08 02:01:42 +02:00
|
|
|
v-slot="{ items }"
|
|
|
|
:pagination="pagination"
|
2023-08-01 03:23:03 +02:00
|
|
|
class="ruryvtyk _gaps_m"
|
2023-04-08 02:01:42 +02:00
|
|
|
>
|
|
|
|
<section
|
2023-08-01 03:23:03 +02:00
|
|
|
v-for="announcement in items"
|
2023-04-08 02:01:42 +02:00
|
|
|
:key="announcement.id"
|
2023-08-01 03:23:03 +02:00
|
|
|
class="announcement _panel"
|
2023-04-08 02:01:42 +02:00
|
|
|
>
|
|
|
|
<div class="_title">
|
2023-09-02 18:57:38 +02:00
|
|
|
<h3>
|
|
|
|
<span v-if="$i && !announcement.isRead">
|
|
|
|
🆕
|
|
|
|
</span>
|
|
|
|
{{ announcement.title }}
|
|
|
|
</h3>
|
2023-07-10 05:46:53 +02:00
|
|
|
<MkTime :time="announcement.createdAt" />
|
|
|
|
<div v-if="announcement.updatedAt">
|
|
|
|
{{ i18n.ts.updatedAt }}:
|
|
|
|
<MkTime :time="announcement.createdAt" />
|
|
|
|
</div>
|
2023-04-08 02:01:42 +02:00
|
|
|
</div>
|
2023-08-09 03:03:21 +02:00
|
|
|
<hr class="_seperator" />
|
2023-04-08 02:01:42 +02:00
|
|
|
<div class="_content">
|
|
|
|
<Mfm :text="announcement.text" />
|
|
|
|
<img
|
|
|
|
v-if="announcement.imageUrl"
|
|
|
|
:src="announcement.imageUrl"
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div v-if="$i && !announcement.isRead" class="_footer">
|
2023-08-01 03:23:03 +02:00
|
|
|
<MkButton primary @click="read(announcement.id)"
|
2023-10-17 03:57:20 +02:00
|
|
|
><i :class="icon('ph-check')"></i>
|
2023-04-08 02:01:42 +02:00
|
|
|
{{ i18n.ts.gotIt }}</MkButton
|
|
|
|
>
|
|
|
|
</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-09-02 01:27:33 +02:00
|
|
|
import { computed, ref } from "vue";
|
2023-04-08 02:01:42 +02:00
|
|
|
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";
|
2023-10-17 03:57:20 +02:00
|
|
|
import icon from "@/scripts/icon";
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
const pagination = {
|
2023-04-08 02:01:42 +02:00
|
|
|
endpoint: "announcements" as const,
|
2022-06-20 10:38:49 +02:00
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2023-08-01 03:23:03 +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
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.announcements,
|
2023-10-17 03:57:20 +02:00
|
|
|
icon: `${icon("ph-megaphone-simple")}`,
|
2020-01-29 20:37:25 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.ruryvtyk {
|
|
|
|
> .announcement {
|
2021-10-24 17:13:54 +02:00
|
|
|
&:not(:last-child) {
|
|
|
|
margin-bottom: var(--margin);
|
|
|
|
}
|
|
|
|
|
2023-07-10 05:46:53 +02:00
|
|
|
> ._title {
|
2023-09-02 18:57:38 +02:00
|
|
|
padding: 0.5rem 2rem !important;
|
2023-07-10 05:46:53 +02:00
|
|
|
}
|
|
|
|
|
2023-08-03 03:04:22 +02:00
|
|
|
> ._seperator {
|
|
|
|
margin: 1rem;
|
|
|
|
}
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
> ._content {
|
2023-09-02 18:57:38 +02:00
|
|
|
padding: 0 2rem !important;
|
2023-08-03 03:04:22 +02:00
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
> img {
|
|
|
|
display: block;
|
|
|
|
max-height: 300px;
|
|
|
|
max-width: 100%;
|
2023-04-17 04:04:28 +02:00
|
|
|
border-radius: 10px;
|
|
|
|
margin-top: 1rem;
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|