Improve reaction tooltip

This commit is contained in:
syuilo
2019-09-03 07:25:02 +09:00
parent f36d88246a
commit d36b129369
3 changed files with 20 additions and 4 deletions

View File

@ -12,7 +12,7 @@
</i18n>
<i18n path="many-users" v-if="10 < users.length">
<span slot="users">{{ users.slice(0, 10).join(', ') }}</span>
<span slot="ommited">{{ users.length - 10 }}</span>
<span slot="ommited">{{ count - 10 }}</span>
<mk-reaction-icon slot="reaction" :reaction="reaction" ref="icon" />
</i18n>
</div>
@ -34,6 +34,10 @@ export default Vue.extend({
type: Array,
required: true,
},
count: {
type: Number,
required: true,
},
source: {
required: true,
}

View File

@ -102,9 +102,10 @@ export default Vue.extend({
if (this.$root.isMobile) return;
this.$root.api('notes/reactions', {
noteId: this.note.id,
limit: 30
type: this.reaction,
limit: 11
}).then((reactions: any[]) => {
const users = reactions.filter(x => x.type === this.reaction)
const users = reactions
.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime())
.map(x => x.user);
@ -113,6 +114,7 @@ export default Vue.extend({
this.details = this.$root.new(XDetails, {
reaction: this.reaction,
users,
count: this.count,
source: this.$refs.reaction
});
});