Fetch real data from backend

This commit is contained in:
Tusooa Zhu 2022-03-17 14:01:45 -04:00 committed by tusooa
commit 95750509b1
No known key found for this signature in database
GPG key ID: 7B467EDE43A08224
6 changed files with 117 additions and 32 deletions

View file

@ -6,6 +6,16 @@ const Announcement = {
computed: {
content () {
return this.announcement.content
},
isRead () {
return this.announcement.read
}
},
methods: {
markAsRead () {
if (!this.isRead) {
return this.$store.dispatch('markAnnouncementAsRead', this.announcement.id)
}
}
}
}

View file

@ -1,6 +1,24 @@
<template>
<div class="announcement">
<rich-content :html="content" />
<div class="heading">
<h4>{{ $t('announcements.title') }}</h4>
</div>
<div class="body">
<rich-content
:html="content"
:emoji="announcement.emojis"
:handle-links="true"
/>
</div>
<div class="footer">
<button
class="btn button-default"
:class="{ toggled: isRead }"
@click="markAsRead"
>
{{ $t('announcements.mark_as_read_action') }}
</button>
</div>
</div>
</template>
@ -15,5 +33,9 @@
border-bottom-color: var(--border, $fallback--border);
border-radius: 0;
padding: var(--status-margin, $status-margin);
.heading, .body {
margin-bottom: var(--status-margin, $status-margin);
}
}
</style>