Dynamic message UI
Also, WIP: send and receive images.
This commit is contained in:
parent
9c8efab236
commit
c4230b8abc
6 changed files with 147 additions and 123 deletions
60
src/components/messages/MessageIncomingImage.vue
Normal file
60
src/components/messages/MessageIncomingImage.vue
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<template>
|
||||
<div>
|
||||
<div class="messageIn">
|
||||
<div class="sender">{{ messageEventDisplayName(event) }}</div>
|
||||
<v-avatar class="avatar" size="40" color="grey">
|
||||
<img
|
||||
v-if="messageEventAvatar(event)"
|
||||
:src="messageEventAvatar(event)"
|
||||
/>
|
||||
<span v-else class="white--text headline">{{
|
||||
messageEventDisplayName(event).substring(0, 1).toUpperCase()
|
||||
}}</span>
|
||||
</v-avatar>
|
||||
|
||||
<div class="bubble">
|
||||
<v-img :aspect-ratio="16 / 9" ref="image" :src="src" contain />
|
||||
</div>
|
||||
</div>
|
||||
<div class="time">
|
||||
{{ formatTime(event.event.origin_server_ts) }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import messageMixin from "./messageMixin";
|
||||
|
||||
export default {
|
||||
mixins: [messageMixin],
|
||||
data() {
|
||||
return {
|
||||
src: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
// const width = this.$refs.image.$el.clientWidth;
|
||||
// const height = (width * 9) / 16;
|
||||
const content = this.event.getContent();
|
||||
if (
|
||||
content &&
|
||||
content.info &&
|
||||
content.info.thumbnail_file &&
|
||||
content.info.thumbnail_file.url
|
||||
) {
|
||||
this.src = this.$matrix.matrixClient.mxcUrlToHttp(
|
||||
content.info.thumbnail_file.url,
|
||||
content.info.w,
|
||||
content.info.h,
|
||||
"scale",
|
||||
true
|
||||
);
|
||||
console.log("SRC set to: ", this.src);
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import "@/assets/css/chat.scss";
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue