keanu-weblite/src/components/messages/MessageOutgoingImage.vue
N-Pex 43b3bdf164 Styling fixes
Issues #24 and #25.
2021-01-11 17:44:09 +01:00

57 lines
No EOL
1.4 KiB
Vue

<template>
<div class="messageOut">
<div class="op-button" ref="opbutton">
<v-btn icon @click.stop="showContextMenu($refs.opbutton)"
><v-icon>more_vert</v-icon></v-btn
>
</div>
<div class="bubble image-bubble">
<v-img :aspect-ratio="16 / 9" ref="image" :src="src" cover />
<QuickReactions :event="event" :reactions="reactions" />
</div>
<div class="senderAndTime">
<!-- <div class="sender">{{ "You" }}</div> -->
<div class="time">
{{ formatTime(event.event.origin_server_ts) }}
<div class="status">{{ event.status }}</div>
</div>
</div>
</div>
</template>
<script>
import messageMixin from "./messageMixin";
import util from "../../plugins/utils";
export default {
mixins: [messageMixin],
data() {
return {
src: null,
};
},
mounted() {
const width = this.$refs.image.$el.clientWidth;
const height = (width * 9) / 16;
util
.getThumbnail(this.$matrix.matrixClient, this.event, width, height)
.then((url) => {
this.src = url;
})
.catch((err) => {
console.log("Failed to fetch thumbnail: ", err);
});
},
beforeDestroy() {
if (this.src) {
const objectUrl = this.src;
this.src = null;
URL.revokeObjectURL(objectUrl);
}
},
};
</script>
<style lang="scss">
@import "@/assets/css/chat.scss";
</style>