🎨
This commit is contained in:
parent
8296cac636
commit
040d395ddb
5 changed files with 45 additions and 32 deletions
|
@ -86,8 +86,16 @@ export default prop => ({
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'reacted': {
|
case 'reacted': {
|
||||||
const reaction = body.reaction;
|
const reaction = body.reaction;
|
||||||
if (this.$_ns_target.reactionCounts == null) Vue.set(this.$_ns_target, 'reactionCounts', {});
|
|
||||||
|
if (this.$_ns_target.reactionCounts == null) {
|
||||||
|
Vue.set(this.$_ns_target, 'reactionCounts', {});
|
||||||
|
}
|
||||||
|
|
||||||
this.$_ns_target.reactionCounts[reaction] = (this.$_ns_target.reactionCounts[reaction] || 0) + 1;
|
this.$_ns_target.reactionCounts[reaction] = (this.$_ns_target.reactionCounts[reaction] || 0) + 1;
|
||||||
|
|
||||||
|
if (body.userId == this.$store.state.i.id) {
|
||||||
|
Vue.set(this.$_ns_target, 'myReaction', reaction);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="mk-reactions-viewer">
|
<div class="mk-reactions-viewer">
|
||||||
<template v-if="reactions">
|
<template v-if="reactions">
|
||||||
<span :class="{notReacted}" @click="react('like')" v-if="reactions.like"><mk-reaction-icon reaction="like"/><span>{{ reactions.like }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'like' }" @click="react('like')" v-if="reactions.like"><mk-reaction-icon reaction="like"/><span>{{ reactions.like }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('love')" v-if="reactions.love"><mk-reaction-icon reaction="love"/><span>{{ reactions.love }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'love' }" @click="react('love')" v-if="reactions.love"><mk-reaction-icon reaction="love"/><span>{{ reactions.love }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('laugh')" v-if="reactions.laugh"><mk-reaction-icon reaction="laugh"/><span>{{ reactions.laugh }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'laugh' }" @click="react('laugh')" v-if="reactions.laugh"><mk-reaction-icon reaction="laugh"/><span>{{ reactions.laugh }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('hmm')" v-if="reactions.hmm"><mk-reaction-icon reaction="hmm"/><span>{{ reactions.hmm }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'hmm' }" @click="react('hmm')" v-if="reactions.hmm"><mk-reaction-icon reaction="hmm"/><span>{{ reactions.hmm }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('surprise')" v-if="reactions.surprise"><mk-reaction-icon reaction="surprise"/><span>{{ reactions.surprise }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'surprise' }" @click="react('surprise')" v-if="reactions.surprise"><mk-reaction-icon reaction="surprise"/><span>{{ reactions.surprise }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('congrats')" v-if="reactions.congrats"><mk-reaction-icon reaction="congrats"/><span>{{ reactions.congrats }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'congrats' }" @click="react('congrats')" v-if="reactions.congrats"><mk-reaction-icon reaction="congrats"/><span>{{ reactions.congrats }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('angry')" v-if="reactions.angry"><mk-reaction-icon reaction="angry"/><span>{{ reactions.angry }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'angry' }" @click="react('angry')" v-if="reactions.angry"><mk-reaction-icon reaction="angry"/><span>{{ reactions.angry }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('confused')" v-if="reactions.confused"><mk-reaction-icon reaction="confused"/><span>{{ reactions.confused }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'confused' }" @click="react('confused')" v-if="reactions.confused"><mk-reaction-icon reaction="confused"/><span>{{ reactions.confused }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('rip')" v-if="reactions.rip"><mk-reaction-icon reaction="rip"/><span>{{ reactions.rip }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'rip' }" @click="react('rip')" v-if="reactions.rip"><mk-reaction-icon reaction="rip"/><span>{{ reactions.rip }}</span></span>
|
||||||
<span :class="{notReacted}" @click="react('pudding')" v-if="reactions.pudding"><mk-reaction-icon reaction="pudding"/><span>{{ reactions.pudding }}</span></span>
|
<span :class="{ reacted: note.myReaction == 'pudding' }" @click="react('pudding')" v-if="reactions.pudding"><mk-reaction-icon reaction="pudding"/><span>{{ reactions.pudding }}</span></span>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -22,9 +22,6 @@ export default Vue.extend({
|
||||||
computed: {
|
computed: {
|
||||||
reactions(): number {
|
reactions(): number {
|
||||||
return this.note.reactionCounts;
|
return this.note.reactionCounts;
|
||||||
},
|
|
||||||
notReacted(): boolean {
|
|
||||||
return this.note.myReaction == null;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -46,25 +43,36 @@ export default Vue.extend({
|
||||||
display none
|
display none
|
||||||
|
|
||||||
> span
|
> span
|
||||||
|
display inline-block
|
||||||
|
height 32px
|
||||||
margin-right 6px
|
margin-right 6px
|
||||||
padding 6px 6px 6px 4px
|
padding 0 6px
|
||||||
border-radius 3px
|
border-radius 4px
|
||||||
|
|
||||||
&.notReacted
|
*
|
||||||
|
user-select none
|
||||||
|
pointer-events none
|
||||||
|
|
||||||
|
&.reacted
|
||||||
|
background var(--primary)
|
||||||
|
|
||||||
|
> span
|
||||||
|
color var(--primaryForeground)
|
||||||
|
|
||||||
|
&:not(.reacted)
|
||||||
cursor pointer
|
cursor pointer
|
||||||
border solid 1px var(--reactionViewerButtonBorder)
|
background var(--reactionViewerButtonBg)
|
||||||
background-color var(--reactionViewerButtonBg)
|
|
||||||
|
|
||||||
&:hover
|
&:hover
|
||||||
border solid 1px var(--reactionViewerButtonHoverBorder)
|
background var(--reactionViewerButtonHoverBg)
|
||||||
background-color var(--reactionViewerButtonHoverBg)
|
|
||||||
|
|
||||||
> .mk-reaction-icon
|
> .mk-reaction-icon
|
||||||
font-size 1.4em
|
font-size 1.4em
|
||||||
|
|
||||||
> span
|
> span
|
||||||
margin-left 4px
|
font-size 1.1em
|
||||||
font-size 1.2em
|
line-height 32px
|
||||||
|
vertical-align middle
|
||||||
color var(--text)
|
color var(--text)
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -84,10 +84,8 @@
|
||||||
|
|
||||||
reactionPickerButtonHoverBg: 'rgba(255, 255, 255, 0.18)',
|
reactionPickerButtonHoverBg: 'rgba(255, 255, 255, 0.18)',
|
||||||
|
|
||||||
reactionViewerButtonBg: 'rgba(0, 0, 0, 0)',
|
reactionViewerButtonBg: 'rgba(255, 255, 255, 0.1)',
|
||||||
reactionViewerButtonHoverBg: 'rgba(0, 0, 0, 0)',
|
reactionViewerButtonHoverBg: 'rgba(255, 255, 255, 0.2)',
|
||||||
reactionViewerButtonBorder: 'rgba(255, 255, 255, 0.1)',
|
|
||||||
reactionViewerButtonHoverBorder: 'rgba(255, 255, 255, 0.2)',
|
|
||||||
|
|
||||||
pollEditorInputBg: 'rgba(0, 0, 0, 0.25)',
|
pollEditorInputBg: 'rgba(0, 0, 0, 0.25)',
|
||||||
|
|
||||||
|
|
|
@ -84,10 +84,8 @@
|
||||||
|
|
||||||
reactionPickerButtonHoverBg: '#eee',
|
reactionPickerButtonHoverBg: '#eee',
|
||||||
|
|
||||||
reactionViewerButtonBg: 'rgba(0, 0, 0, 0)',
|
reactionViewerButtonBg: 'rgba(0, 0, 0, 0.05)',
|
||||||
reactionViewerButtonHoverBg: 'rgba(0, 0, 0, 0)',
|
reactionViewerButtonHoverBg: 'rgba(0, 0, 0, 0.1)',
|
||||||
reactionViewerButtonBorder: 'rgba(0, 0, 0, 0.1)',
|
|
||||||
reactionViewerButtonHoverBorder: 'rgba(0, 0, 0, 0.2)',
|
|
||||||
|
|
||||||
pollEditorInputBg: '#fff',
|
pollEditorInputBg: '#fff',
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,8 @@ export default async (user: IUser, note: INote, reaction: string) => new Promise
|
||||||
});
|
});
|
||||||
|
|
||||||
publishNoteStream(note._id, 'reacted', {
|
publishNoteStream(note._id, 'reacted', {
|
||||||
reaction: reaction
|
reaction: reaction,
|
||||||
|
userId: user._id
|
||||||
});
|
});
|
||||||
|
|
||||||
// リアクションされたユーザーがローカルユーザーなら通知を作成
|
// リアクションされたユーザーがローカルユーザーなら通知を作成
|
||||||
|
|
Loading…
Reference in a new issue