summaryrefslogtreecommitdiff
path: root/src/client/app/common/views/components/reaction-icon.vue
blob: afe51d783359944a3a37f5d2c1d2f70f379a2f19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<template>
<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"/>
</template>

<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
export default Vue.extend({
	i18n: i18n(),
	props: {
		reaction: {
			type: String,
			required: true
		},
	},
	data() {
		return {
			customEmojis: []
		};
	},
	created() {
		this.$root.getMeta().then(meta => {
			if (meta && meta.emojis) this.customEmojis = meta.emojis;
		});
	},
	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) ? '🍣' : '🍮';
				case 'star': return '⭐';
				default: return this.reaction;
			}
		},
	},
});
</script>

<style lang="stylus" scoped>
.mk-reaction-icon
	img
		vertical-align middle
		width 1em
		height 1em
</style>