2018-02-07 03:34:43 -06:00
|
|
|
<template>
|
2018-12-27 07:54:50 -06:00
|
|
|
<div class="mk-reactions-viewer" :class="{ isMe }">
|
2019-08-28 15:11:26 -05:00
|
|
|
<x-reaction v-for="(count, reaction) in reactions" :reaction="reaction" :count="count" :is-initial="initialReactions.has(reaction)" :note="note" :key="reaction"/>
|
2018-02-07 03:34:43 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2018-02-16 00:38:12 -06:00
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2019-02-06 11:05:49 -06:00
|
|
|
import XReaction from './reactions-viewer.reaction.vue';
|
2018-11-08 12:44:35 -06:00
|
|
|
|
2018-02-16 00:38:12 -06:00
|
|
|
export default Vue.extend({
|
2019-02-06 11:05:49 -06:00
|
|
|
components: {
|
|
|
|
XReaction
|
|
|
|
},
|
2019-08-28 15:11:26 -05:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
initialReactions: new Set(Object.keys(this.note.reactions))
|
|
|
|
};
|
|
|
|
},
|
2018-12-27 07:54:50 -06:00
|
|
|
props: {
|
|
|
|
note: {
|
|
|
|
type: Object,
|
|
|
|
required: true
|
2019-02-06 11:05:49 -06:00
|
|
|
},
|
2018-12-27 07:54:50 -06:00
|
|
|
},
|
2018-02-16 00:38:12 -06:00
|
|
|
computed: {
|
2018-12-16 12:29:57 -06:00
|
|
|
reactions(): any {
|
2019-04-07 07:50:36 -05:00
|
|
|
return this.note.reactions;
|
2018-12-27 07:54:50 -06:00
|
|
|
},
|
|
|
|
isMe(): boolean {
|
2019-02-06 11:05:49 -06:00
|
|
|
return this.$store.getters.isSignedIn && this.$store.state.i.id === this.note.userId;
|
2018-12-16 12:29:57 -06:00
|
|
|
},
|
|
|
|
},
|
2018-02-16 00:38:12 -06:00
|
|
|
});
|
2018-02-07 03:41:48 -06:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-27 08:59:56 -05:00
|
|
|
.mk-reactions-viewer
|
2019-02-06 07:57:08 -06:00
|
|
|
margin: 4px -2px
|
2018-02-07 03:41:48 -06:00
|
|
|
|
2018-02-16 00:38:12 -06:00
|
|
|
&:empty
|
|
|
|
display none
|
2018-02-07 03:41:48 -06:00
|
|
|
|
2018-12-27 07:54:50 -06:00
|
|
|
&.isMe
|
|
|
|
> span
|
|
|
|
cursor default !important
|
|
|
|
|
|
|
|
&:hover
|
|
|
|
background var(--reactionViewerButtonBg) !important
|
2018-02-07 03:41:48 -06:00
|
|
|
</style>
|