Refactor MkAnnouncement

This commit is contained in:
naskya 2023-07-08 21:17:13 +00:00
parent 8b79f59d8d
commit ac9774c1e6
No known key found for this signature in database
GPG Key ID: 164DFF24E2D40139

View File

@ -8,21 +8,13 @@
<Mfm :text="text" /> <Mfm :text="text" />
<img <img
v-if="imageUrl != null" v-if="imageUrl != null"
:style="$style.image"
:key="imageUrl" :key="imageUrl"
:src="imageUrl" :src="imageUrl"
alt="attached image" alt="attached image"
/> />
<MkButton <MkButton :class="$style.gotIt" primary full @click="gotIt()">{{
:class="$style.gotIt" i18n.ts.gotIt
primary }}</MkButton>
full
@click="
$refs.modal.close();
markAsRead();
"
>{{ i18n.ts.gotIt }}</MkButton
>
</div> </div>
</MkModal> </MkModal>
</template> </template>
@ -32,7 +24,6 @@ import { shallowRef } from "vue";
import MkModal from "@/components/MkModal.vue"; import MkModal from "@/components/MkModal.vue";
import MkSparkle from "@/components/MkSparkle.vue"; import MkSparkle from "@/components/MkSparkle.vue";
import MkButton from "@/components/MkButton.vue"; import MkButton from "@/components/MkButton.vue";
import { version } from "@/config";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import * as os from "@/os"; import * as os from "@/os";
@ -44,9 +35,10 @@ const { id, text, title, imageUrl, isGoodNews } = props.announcement;
const modal = shallowRef<InstanceType<typeof MkModal>>(); const modal = shallowRef<InstanceType<typeof MkModal>>();
function markAsRead() { const gotIt = () => {
modal.value.close();
os.api("i/read-announcement", { announcementId: id }); os.api("i/read-announcement", { announcementId: id });
} };
</script> </script>
<style lang="scss" module> <style lang="scss" module>
@ -60,27 +52,22 @@ function markAsRead() {
text-align: center; text-align: center;
background: var(--panel); background: var(--panel);
border-radius: var(--radius); border-radius: var(--radius);
> img {
max-height: 100%;
max-width: 100%;
}
} }
.title { .title {
font-weight: bold; font-weight: bold;
}
.version { > p {
margin: 1em 0; margin: 0;
} }
.image {
max-width: 500px;
} }
.gotIt { .gotIt {
margin: 8px 0 0 0; margin: 8px 0 0 0;
} }
.releaseNotes {
> img {
border-radius: 10px;
}
}
</style> </style>