hippofish/packages/frontend/src/components/MkReactionsViewer.details.vue
かっこかり ed6dc84c5f
fix(frontend): リアクションしたユーザー一覧のユーザー名がはみ出る問題を修正 (#14294)
* pnpm dev で絵文字が表示されない問題を解決

(cherry picked from commit 22fcafbf55830922efe75d129f48b4d8c11724e6)

* リアクションしたユーザー一覧のユーザーネームがはみ出る問題を解決

(cherry picked from commit 46458b190e2b4ccfc8b50b6857ee9a5a6fd09fe9)

* Update Changelog

---------

Co-authored-by: 6wFh3kVo <yukikum57@gmail.com>
Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
2024-07-25 17:03:00 +09:00

101 lines
2 KiB
Vue

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkTooltip ref="tooltip" :showing="showing" :targetElement="targetElement" :maxWidth="340" @closed="emit('closed')">
<div :class="$style.root">
<div :class="$style.reaction">
<MkReactionIcon :reaction="reaction" :class="$style.reactionIcon" :noStyle="true"/>
<div :class="$style.reactionName">{{ getReactionName(reaction) }}</div>
</div>
<div :class="$style.users">
<div v-for="u in users" :key="u.id" :class="$style.user">
<MkAvatar :class="$style.avatar" :user="u"/>
<MkUserName :user="u" :nowrap="true"/>
</div>
<div v-if="count > 10" :class="$style.more">+{{ count - 10 }}</div>
</div>
</div>
</MkTooltip>
</template>
<script lang="ts" setup>
import { } from 'vue';
import MkTooltip from './MkTooltip.vue';
import MkReactionIcon from '@/components/MkReactionIcon.vue';
import { getEmojiName } from '@/scripts/emojilist.js';
defineProps<{
showing: boolean;
reaction: string;
users: any[]; // TODO
count: number;
targetElement: HTMLElement;
}>();
const emit = defineEmits<{
(ev: 'closed'): void;
}>();
function getReactionName(reaction: string): string {
const trimLocal = reaction.replace('@.', '');
if (trimLocal.startsWith(':')) {
return trimLocal;
}
return getEmojiName(reaction);
}
</script>
<style lang="scss" module>
.root {
display: flex;
}
.reaction {
max-width: 100px;
padding-right: 10px;
text-align: center;
border-right: solid 0.5px var(--divider);
}
.reactionIcon {
display: block;
width: 60px;
font-size: 60px; // unicodeな絵文字についてはwidthが効かないため
object-fit: contain;
margin: 0 auto;
}
.reactionName {
font-size: 1em;
}
.users {
flex: 1;
min-width: 0;
margin: -4px 14px 0 10px;
font-size: 0.95em;
text-align: left;
}
.user {
display: flex;
line-height: 24px;
padding-top: 4px;
white-space: nowrap;
overflow: visible;
text-overflow: ellipsis;
}
.avatar {
width: 24px;
height: 24px;
margin-right: 3px;
}
.more {
padding-top: 4px;
}
</style>