hippofish/src/client/components/reactions-viewer.vue

61 lines
1 KiB
Vue
Raw Normal View History

2018-02-07 10:34:43 +01:00
<template>
2020-02-21 22:43:46 +01:00
<div class="tdflqwzn" :class="{ isMe }">
<x-reaction v-for="(count, reaction) in reactions" :reaction="reaction" :count="count" :is-initial="initialReactions.has(reaction)" :note="note" :my-reaction="myReaction" :emojis="emojis" :key="reaction"/>
2018-02-07 10:34:43 +01:00
</div>
</template>
2018-02-16 07:38:12 +01:00
<script lang="ts">
import Vue from 'vue';
import XReaction from './reactions-viewer.reaction.vue';
2018-02-16 07:38:12 +01:00
export default Vue.extend({
components: {
XReaction
},
props: {
note: {
type: Object,
required: true
},
reactions: {
type: Object,
required: true
},
myReaction: {
type: String,
required: false,
},
emojis: {
type: Array,
required: true,
},
},
data() {
return {
initialReactions: new Set(Object.keys(this.note.reactions))
};
},
2018-02-16 07:38:12 +01:00
computed: {
isMe(): boolean {
return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId;
2018-12-16 19:29:57 +01:00
},
},
2018-02-16 07:38:12 +01:00
});
2018-02-07 10:41:48 +01:00
</script>
<style lang="scss" scoped>
2020-02-21 22:43:46 +01:00
.tdflqwzn {
margin: 4px -2px 0 -2px;
2018-02-07 10:41:48 +01:00
&:empty {
display: none;
}
2018-02-07 10:41:48 +01:00
&.isMe {
> span {
cursor: default !important;
}
}
}
2018-02-07 10:41:48 +01:00
</style>