2023-07-08 21:55:38 +02:00
|
|
|
<template>
|
|
|
|
<MkModal ref="modal" :z-priority="'middle'" @closed="$emit('closed')">
|
|
|
|
<div :class="$style.root">
|
|
|
|
<div :class="$style.title">
|
2023-07-09 00:37:15 +02:00
|
|
|
<MkSparkle v-if="isGoodNews">{{ title }}</MkSparkle>
|
2023-07-08 21:55:38 +02:00
|
|
|
<p v-else>{{ title }}</p>
|
|
|
|
</div>
|
2023-07-10 05:46:53 +02:00
|
|
|
<div :class="$style.time">
|
|
|
|
<MkTime :time="announcement.createdAt" />
|
|
|
|
<div v-if="announcement.updatedAt">
|
|
|
|
{{ i18n.ts.updatedAt }}:
|
|
|
|
<MkTime :time="announcement.createdAt" />
|
|
|
|
</div>
|
|
|
|
</div>
|
2023-07-08 21:55:38 +02:00
|
|
|
<Mfm :text="text" />
|
|
|
|
<img
|
|
|
|
v-if="imageUrl != null"
|
|
|
|
:key="imageUrl"
|
|
|
|
:src="imageUrl"
|
|
|
|
alt="attached image"
|
|
|
|
/>
|
2023-07-08 23:17:13 +02:00
|
|
|
<MkButton :class="$style.gotIt" primary full @click="gotIt()">{{
|
|
|
|
i18n.ts.gotIt
|
|
|
|
}}</MkButton>
|
2023-07-08 21:55:38 +02:00
|
|
|
</div>
|
|
|
|
</MkModal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { shallowRef } from "vue";
|
|
|
|
import MkModal from "@/components/MkModal.vue";
|
|
|
|
import MkSparkle from "@/components/MkSparkle.vue";
|
|
|
|
import MkButton from "@/components/MkButton.vue";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import * as os from "@/os";
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
announcement: Announcement;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const { id, text, title, imageUrl, isGoodNews } = props.announcement;
|
|
|
|
|
|
|
|
const modal = shallowRef<InstanceType<typeof MkModal>>();
|
|
|
|
|
2023-07-08 23:17:13 +02:00
|
|
|
const gotIt = () => {
|
|
|
|
modal.value.close();
|
2023-07-08 22:15:08 +02:00
|
|
|
os.api("i/read-announcement", { announcementId: id });
|
2023-07-08 23:17:13 +02:00
|
|
|
};
|
2023-07-08 21:55:38 +02:00
|
|
|
</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);
|
2023-07-08 23:17:13 +02:00
|
|
|
|
|
|
|
> img {
|
2023-07-09 00:29:36 +02:00
|
|
|
border-radius: 10px;
|
2023-07-08 23:17:13 +02:00
|
|
|
max-height: 100%;
|
|
|
|
max-width: 100%;
|
|
|
|
}
|
2023-07-08 21:55:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
.title {
|
|
|
|
font-weight: bold;
|
|
|
|
|
2023-07-08 23:17:13 +02:00
|
|
|
> p {
|
|
|
|
margin: 0;
|
|
|
|
}
|
2023-07-08 21:55:38 +02:00
|
|
|
}
|
|
|
|
|
2023-07-10 05:46:53 +02:00
|
|
|
.time {
|
|
|
|
font-size: 0.8rem;
|
|
|
|
}
|
|
|
|
|
2023-07-08 21:55:38 +02:00
|
|
|
.gotIt {
|
|
|
|
margin: 8px 0 0 0;
|
|
|
|
}
|
|
|
|
</style>
|