@@ -13,12 +13,16 @@ SPDX-License-Identifier: AGPL-3.0-only
13
13
@contextmenu.prevent.stop="menu"
14
14
>
15
15
<MkReactionIcon :class="defaultStore.state.limitWidthOfReaction ? $style.limitWidth : ''" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]"/>
16
- <span :class="$style.count">{{ count }}</span>
16
+ <span :class="$style.count">
17
+ </span>
18
+ <div v-for="u in users" :key="u.id" :class="$style.avatars" style="height: 42px; width: auto">
19
+ <MkAvatar :class="$style.avatar" :user="u"/>
20
+ </div>
17
21
</button>
18
22
</template>
19
23
20
24
<script lang="ts" setup>
21
- import { computed, inject, onMounted, shallowRef, watch } from 'vue';
25
+ import { computed, inject, onMounted, shallowRef, watch, ref } from 'vue';
22
26
import * as Misskey from 'misskey-js';
23
27
import MkCustomEmojiDetailedDialog from './MkCustomEmojiDetailedDialog.vue';
24
28
import XDetails from '@/components/MkReactionsViewer.details.vue';
@@ -60,6 +64,15 @@ const canToggle = computed(() => {
60
64
});
61
65
const canGetInfo = computed(() => !props.reaction.match(/@\w/) && props.reaction.includes(':'));
62
66
67
+ // const reactions = await misskeyApiGet('notes/reactions', {
68
+ // noteId: props.note.id,
69
+ // type: props.reaction,
70
+ // limit: 10,
71
+ // _cacheKey_: props.count,
72
+ // });
73
+
74
+ const users = ref([]);
75
+
63
76
async function toggleReaction() {
64
77
if (!canToggle.value) return;
65
78
@@ -124,10 +137,28 @@ function anime() {
124
137
}
125
138
126
139
watch(() => props.count, (newCount, oldCount) => {
140
+ console.log('count changed', oldCount, newCount);
141
+ misskeyApiGet('notes/reactions', {
142
+ noteId: props.note.id,
143
+ type: props.reaction,
144
+ limit: 10,
145
+ _cacheKey_: newCount,
146
+ }).then((reactions) => {
147
+ users.value = reactions.map(x => x.user);
148
+ });
149
+
127
150
if (oldCount < newCount) anime();
128
151
});
129
152
130
153
onMounted(() => {
154
+ misskeyApiGet('notes/reactions', {
155
+ noteId: props.note.id,
156
+ type: props.reaction,
157
+ limit: 10,
158
+ }).then((reactions) => {
159
+ users.value = reactions.map(x => x.user);
160
+ });
161
+
131
162
if (!props.isInitial) anime();
132
163
});
133
164
@@ -154,6 +185,17 @@ if (!mock) {
154
185
</script>
155
186
156
187
<style lang="scss" module>
188
+ .avatars {
189
+ display: flex;
190
+ align-items: center;
191
+ }
192
+
193
+ .avatar {
194
+ height: 14px;
195
+ width: 14px;
196
+ margin-left: 2px;
197
+ }
198
+
157
199
.root {
158
200
display: inline-flex;
159
201
height: 42px;
0 commit comments