feat: CSAT for all channels (#2749)

This commit is contained in:
Muhsin Keloth 2021-08-23 22:00:47 +05:30 committed by GitHub
parent 5debe9e8ee
commit 6515b69560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 382 additions and 68 deletions

View file

@ -5,7 +5,7 @@
v-for="rating in ratings"
:key="rating.key"
:class="buttonClass(rating)"
@click="selectRating(rating)"
@click="onClick(rating)"
>
{{ rating.emoji }}
</button>
@ -18,35 +18,28 @@ import { CSAT_RATINGS } from 'shared/constants/messages';
export default {
props: {
messageContentAttributes: {
type: Object,
default: () => {},
selectedRating: {
type: Number,
default: null,
},
},
data() {
return {
email: '',
ratings: CSAT_RATINGS,
selectedRating: null,
};
},
computed: {
isRatingSubmitted() {
return this.messageContentAttributes?.csat_survey_response?.rating;
},
},
methods: {
buttonClass(rating) {
return [
{ selected: rating.value === this.selectedRating },
{ disabled: this.isRatingSubmitted },
{ hover: this.isRatingSubmitted },
{ disabled: !!this.selectedRating },
{ hover: !!this.selectedRating },
'emoji-button shadow-none text-4xl outline-none mr-8',
];
},
selectRating(rating) {
this.selectedRating = rating.value;
onClick(rating) {
this.$emit('selectRating', rating.value);
},
},
};