2020-01-29 19:37:25 +00:00
|
|
|
<template>
|
2022-12-22 07:59:11 +00:00
|
|
|
<MkTooltip ref="tooltip" :showing="showing" :target-element="targetElement" :max-width="340" @closed="emit('closed')">
|
2023-01-14 08:23:49 +00:00
|
|
|
<div :class="$style.root">
|
|
|
|
<div :class="$style.reaction">
|
|
|
|
<MkReactionIcon :reaction="reaction" :class="$style.reactionIcon" :no-style="true"/>
|
|
|
|
<div :class="$style.reactionName">{{ getReactionName(reaction) }}</div>
|
2021-10-24 04:54:31 +00:00
|
|
|
</div>
|
2023-01-14 08:23:49 +00:00
|
|
|
<div :class="$style.users">
|
|
|
|
<div v-for="u in users" :key="u.id" :class="$style.user">
|
2023-01-16 05:18:11 +00:00
|
|
|
<MkAvatar :class="$style.avatar" :user="u"/>
|
2023-01-14 08:23:49 +00:00
|
|
|
<MkUserName :user="u" :nowrap="true"/>
|
2021-11-14 04:13:22 +00:00
|
|
|
</div>
|
2023-01-14 08:23:49 +00:00
|
|
|
<div v-if="users.length > 10">+{{ count - 10 }}</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MkTooltip>
|
2020-01-29 19:37:25 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-14 01:35:32 +00:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkTooltip from './MkTooltip.vue';
|
2023-01-08 05:22:04 +00:00
|
|
|
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
2022-12-25 06:52:52 +00:00
|
|
|
import { getEmojiName } from '@/scripts/emojilist';
|
2020-01-29 19:37:25 +00:00
|
|
|
|
2022-12-22 07:59:11 +00:00
|
|
|
defineProps<{
|
|
|
|
showing: boolean;
|
2022-01-14 01:35:32 +00:00
|
|
|
reaction: string;
|
|
|
|
users: any[]; // TODO
|
|
|
|
count: number;
|
2022-01-31 12:07:33 +00:00
|
|
|
targetElement: HTMLElement;
|
2022-01-14 01:35:32 +00:00
|
|
|
}>();
|
|
|
|
|
|
|
|
const emit = defineEmits<{
|
2022-01-31 12:07:33 +00:00
|
|
|
(ev: 'closed'): void;
|
2022-01-14 01:35:32 +00:00
|
|
|
}>();
|
2022-12-25 06:52:52 +00:00
|
|
|
|
|
|
|
function getReactionName(reaction: string): string {
|
|
|
|
const trimLocal = reaction.replace('@.', '');
|
|
|
|
if (trimLocal.startsWith(':')) {
|
|
|
|
return trimLocal;
|
|
|
|
}
|
|
|
|
return getEmojiName(reaction) ?? reaction;
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
</script>
|
|
|
|
|
2023-01-14 08:23:49 +00:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2021-10-24 04:54:31 +00:00
|
|
|
display: flex;
|
2023-01-14 08:23:49 +00:00
|
|
|
}
|
2021-10-24 04:54:31 +00:00
|
|
|
|
2023-01-14 08:23:49 +00:00
|
|
|
.reaction {
|
|
|
|
max-width: 100px;
|
|
|
|
text-align: center;
|
|
|
|
}
|
2021-10-24 04:54:31 +00:00
|
|
|
|
2023-01-14 08:23:49 +00:00
|
|
|
.reactionIcon {
|
|
|
|
display: block;
|
|
|
|
width: 60px;
|
|
|
|
font-size: 60px; // unicodeな絵文字についてはwidthが効かないため
|
|
|
|
object-fit: contain;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
2021-10-24 04:54:31 +00:00
|
|
|
|
2023-01-14 08:23:49 +00:00
|
|
|
.reactionName {
|
|
|
|
font-size: 1em;
|
|
|
|
}
|
2021-11-14 04:13:22 +00:00
|
|
|
|
2023-01-14 08:23:49 +00:00
|
|
|
.users {
|
|
|
|
flex: 1;
|
|
|
|
min-width: 0;
|
|
|
|
font-size: 0.95em;
|
|
|
|
border-left: solid 0.5px var(--divider);
|
|
|
|
padding-left: 10px;
|
|
|
|
margin-left: 10px;
|
|
|
|
margin-right: 14px;
|
|
|
|
text-align: left;
|
|
|
|
}
|
2021-11-14 04:13:22 +00:00
|
|
|
|
2023-01-14 08:23:49 +00:00
|
|
|
.user {
|
|
|
|
line-height: 24px;
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
2021-11-14 04:13:22 +00:00
|
|
|
|
2023-01-14 08:23:49 +00:00
|
|
|
&:not(:last-child) {
|
|
|
|
margin-bottom: 3px;
|
2020-01-29 19:37:25 +00:00
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
}
|
2023-01-14 08:23:49 +00:00
|
|
|
|
|
|
|
.avatar {
|
|
|
|
width: 24px;
|
|
|
|
height: 24px;
|
|
|
|
margin-right: 3px;
|
|
|
|
}
|
2020-10-17 11:12:00 +00:00
|
|
|
</style>
|