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