Refactor MkAnnouncement
This commit is contained in:
parent
8b79f59d8d
commit
ac9774c1e6
1 changed files with 14 additions and 27 deletions
|
@ -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>
|
||||||
|
|
Loading…
Reference in a new issue