keanu-weblite/src/components/messages/MessageOperations.vue

61 lines
1.2 KiB
Vue
Raw Normal View History

2020-11-25 14:42:50 +01:00
<template>
2020-12-14 16:11:45 +01:00
<div :class="{'message-operations':true,'incoming':incoming,'outgoing':!incoming}">
2020-12-03 22:12:50 +01:00
<v-btn icon @click.stop="addReaction" class="ma-0 pa-0">
2020-11-25 14:42:50 +01:00
<v-icon>mood</v-icon>
</v-btn>
2020-12-14 16:11:45 +01:00
<v-btn v-if="incoming" icon @click.stop="addReply" class="ma-0 pa-0">
<v-icon>reply</v-icon>
</v-btn>
<v-btn v-if="isEditable" icon @click.stop="edit" class="ma-0 pa-0">
<v-icon>edit</v-icon>
</v-btn>
2020-11-25 14:42:50 +01:00
</div>
</template>
<script>
import messageMixin from "./messageMixin";
export default {
mixins: [messageMixin],
props: {
incoming: {
type: Boolean,
default: function () {
return true
}
},
event: {
type: Object,
default: function () {
return {}
}
},
},
2020-12-03 22:12:50 +01:00
2020-12-14 16:11:45 +01:00
computed: {
isEditable() {
return !this.incoming && this.event.getContent().msgtype == "m.text";
}
},
2020-11-25 14:42:50 +01:00
methods: {
addReaction() {
2020-12-03 22:12:50 +01:00
this.$emit("close");
2020-11-25 14:42:50 +01:00
this.$emit("addreaction", {event:this.event});
2020-12-14 16:11:45 +01:00
},
addReply() {
this.$emit("close");
this.$emit("addreply", {event:this.event});
},
edit() {
this.$emit("close");
this.$emit("edit", {event:this.event});
2020-11-25 14:42:50 +01:00
}
}
};
</script>
<style lang="scss">
@import "@/assets/css/chat.scss";
</style>