diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-09 01:26:04 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-09 01:26:04 +0900 |
| commit | 040d395ddbd9d36eb1ae824728537d2640ecf216 (patch) | |
| tree | 943e3df7de30fb54708994bfdfc86fcf7ecea1ef /src | |
| parent | Merge branch 'develop' of https://github.com/syuilo/misskey into develop (diff) | |
| download | sharkey-040d395ddbd9d36eb1ae824728537d2640ecf216.tar.gz sharkey-040d395ddbd9d36eb1ae824728537d2640ecf216.tar.bz2 sharkey-040d395ddbd9d36eb1ae824728537d2640ecf216.zip | |
:art:
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/common/scripts/note-subscriber.ts | 10 | ||||
| -rw-r--r-- | src/client/app/common/views/components/reactions-viewer.vue | 52 | ||||
| -rw-r--r-- | src/client/theme/dark.json5 | 6 | ||||
| -rw-r--r-- | src/client/theme/light.json5 | 6 | ||||
| -rw-r--r-- | src/services/note/reaction/create.ts | 3 |
5 files changed, 45 insertions, 32 deletions
diff --git a/src/client/app/common/scripts/note-subscriber.ts b/src/client/app/common/scripts/note-subscriber.ts index c41897e70f..6c994aa9bc 100644 --- a/src/client/app/common/scripts/note-subscriber.ts +++ b/src/client/app/common/scripts/note-subscriber.ts @@ -86,8 +86,16 @@ export default prop => ({ switch (type) { case 'reacted': { 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; + + if (body.userId == this.$store.state.i.id) { + Vue.set(this.$_ns_target, 'myReaction', reaction); + } break; } diff --git a/src/client/app/common/views/components/reactions-viewer.vue b/src/client/app/common/views/components/reactions-viewer.vue index 8e06b79d19..15989ff4d8 100644 --- a/src/client/app/common/views/components/reactions-viewer.vue +++ b/src/client/app/common/views/components/reactions-viewer.vue @@ -1,16 +1,16 @@ <template> <div class="mk-reactions-viewer"> <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="{notReacted}" @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="{notReacted}" @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="{notReacted}" @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="{notReacted}" @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="{notReacted}" @click="react('pudding')" v-if="reactions.pudding"><mk-reaction-icon reaction="pudding"/><span>{{ reactions.pudding }}</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="{ reacted: note.myReaction == 'love' }" @click="react('love')" v-if="reactions.love"><mk-reaction-icon reaction="love"/><span>{{ reactions.love }}</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="{ reacted: note.myReaction == 'hmm' }" @click="react('hmm')" v-if="reactions.hmm"><mk-reaction-icon reaction="hmm"/><span>{{ reactions.hmm }}</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="{ reacted: note.myReaction == 'congrats' }" @click="react('congrats')" v-if="reactions.congrats"><mk-reaction-icon reaction="congrats"/><span>{{ reactions.congrats }}</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="{ reacted: note.myReaction == 'confused' }" @click="react('confused')" v-if="reactions.confused"><mk-reaction-icon reaction="confused"/><span>{{ reactions.confused }}</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="{ reacted: note.myReaction == 'pudding' }" @click="react('pudding')" v-if="reactions.pudding"><mk-reaction-icon reaction="pudding"/><span>{{ reactions.pudding }}</span></span> </template> </div> </template> @@ -22,9 +22,6 @@ export default Vue.extend({ computed: { reactions(): number { return this.note.reactionCounts; - }, - notReacted(): boolean { - return this.note.myReaction == null; } }, methods: { @@ -46,25 +43,36 @@ export default Vue.extend({ display none > span + display inline-block + height 32px margin-right 6px - padding 6px 6px 6px 4px - border-radius 3px + padding 0 6px + border-radius 4px - &.notReacted + * + user-select none + pointer-events none + + &.reacted + background var(--primary) + + > span + color var(--primaryForeground) + + &:not(.reacted) cursor pointer - border solid 1px var(--reactionViewerButtonBorder) - background-color var(--reactionViewerButtonBg) + background var(--reactionViewerButtonBg) &:hover - border solid 1px var(--reactionViewerButtonHoverBorder) - background-color var(--reactionViewerButtonHoverBg) + background var(--reactionViewerButtonHoverBg) > .mk-reaction-icon font-size 1.4em > span - margin-left 4px - font-size 1.2em + font-size 1.1em + line-height 32px + vertical-align middle color var(--text) </style> diff --git a/src/client/theme/dark.json5 b/src/client/theme/dark.json5 index 1ac5554a83..59cff0ae44 100644 --- a/src/client/theme/dark.json5 +++ b/src/client/theme/dark.json5 @@ -84,10 +84,8 @@ reactionPickerButtonHoverBg: 'rgba(255, 255, 255, 0.18)', - reactionViewerButtonBg: 'rgba(0, 0, 0, 0)', - reactionViewerButtonHoverBg: 'rgba(0, 0, 0, 0)', - reactionViewerButtonBorder: 'rgba(255, 255, 255, 0.1)', - reactionViewerButtonHoverBorder: 'rgba(255, 255, 255, 0.2)', + reactionViewerButtonBg: 'rgba(255, 255, 255, 0.1)', + reactionViewerButtonHoverBg: 'rgba(255, 255, 255, 0.2)', pollEditorInputBg: 'rgba(0, 0, 0, 0.25)', diff --git a/src/client/theme/light.json5 b/src/client/theme/light.json5 index 0caea33480..a1b000530a 100644 --- a/src/client/theme/light.json5 +++ b/src/client/theme/light.json5 @@ -84,10 +84,8 @@ reactionPickerButtonHoverBg: '#eee', - reactionViewerButtonBg: 'rgba(0, 0, 0, 0)', - reactionViewerButtonHoverBg: 'rgba(0, 0, 0, 0)', - reactionViewerButtonBorder: 'rgba(0, 0, 0, 0.1)', - reactionViewerButtonHoverBorder: 'rgba(0, 0, 0, 0.2)', + reactionViewerButtonBg: 'rgba(0, 0, 0, 0.05)', + reactionViewerButtonHoverBg: 'rgba(0, 0, 0, 0.1)', pollEditorInputBg: '#fff', diff --git a/src/services/note/reaction/create.ts b/src/services/note/reaction/create.ts index 6884014e33..b54f8a60bb 100644 --- a/src/services/note/reaction/create.ts +++ b/src/services/note/reaction/create.ts @@ -44,7 +44,8 @@ export default async (user: IUser, note: INote, reaction: string) => new Promise }); publishNoteStream(note._id, 'reacted', { - reaction: reaction + reaction: reaction, + userId: user._id }); // リアクションされたユーザーがローカルユーザーなら通知を作成 |