2018-02-07 11:00:55 +01:00
|
|
|
<template>
|
2019-03-17 16:03:57 +01:00
|
|
|
<mk-emoji :emoji="str.startsWith(':') ? null : str" :name="str.startsWith(':') ? str.substr(1, str.length - 2) : null" :is-reaction="true" :custom-emojis="customEmojis" :normal="true"/>
|
2018-02-07 11:00:55 +01:00
|
|
|
</template>
|
|
|
|
|
2018-02-13 04:32:00 +01:00
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 19:44:35 +01:00
|
|
|
import i18n from '../../../i18n';
|
2018-02-13 04:32:00 +01:00
|
|
|
export default Vue.extend({
|
2018-11-08 19:44:35 +01:00
|
|
|
i18n: i18n(),
|
2019-03-17 16:03:57 +01:00
|
|
|
props: {
|
|
|
|
reaction: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
2019-07-05 10:58:54 +02:00
|
|
|
customEmojis: []
|
2019-03-17 16:03:57 +01:00
|
|
|
};
|
|
|
|
},
|
2019-07-05 10:58:54 +02:00
|
|
|
created() {
|
|
|
|
this.$root.getMeta().then(meta => {
|
|
|
|
if (meta && meta.emojis) this.customEmojis = meta.emojis;
|
|
|
|
});
|
|
|
|
},
|
2019-03-17 16:03:57 +01:00
|
|
|
computed: {
|
|
|
|
str(): any {
|
|
|
|
switch (this.reaction) {
|
|
|
|
case 'like': return '👍';
|
|
|
|
case 'love': return '❤';
|
|
|
|
case 'laugh': return '😆';
|
|
|
|
case 'hmm': return '🤔';
|
|
|
|
case 'surprise': return '😮';
|
|
|
|
case 'congrats': return '🎉';
|
|
|
|
case 'angry': return '💢';
|
|
|
|
case 'confused': return '😥';
|
|
|
|
case 'rip': return '😇';
|
|
|
|
case 'pudding': return (this.$store.getters.isSignedIn && this.$store.state.settings.iLikeSushi) ? '🍣' : '🍮';
|
2019-03-17 17:03:35 +01:00
|
|
|
case 'star': return '⭐';
|
2019-03-17 16:03:57 +01:00
|
|
|
default: return this.reaction;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2018-02-13 04:32:00 +01:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2018-02-07 11:00:55 +01:00
|
|
|
<style lang="stylus" scoped>
|
2018-02-13 04:32:00 +01:00
|
|
|
.mk-reaction-icon
|
2018-02-07 11:00:55 +01:00
|
|
|
img
|
|
|
|
vertical-align middle
|
|
|
|
width 1em
|
|
|
|
height 1em
|
|
|
|
</style>
|