From decde50c865afb287d8c0d67e2dba0af65b1d69e Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Sun, 25 Dec 2022 15:52:52 +0900 Subject: [PATCH] enhance(client): show Unicode emoji tooltip with its name (#9399) * enhance(client): show Unicode emoji tooltip with its name * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: tamaina Co-authored-by: syuilo --- .../components/MkReactionsViewer.details.vue | 11 ++++++++- .../client/src/components/global/MkEmoji.vue | 23 +++++++++++++------ packages/client/src/scripts/emojilist.ts | 4 ++++ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/packages/client/src/components/MkReactionsViewer.details.vue b/packages/client/src/components/MkReactionsViewer.details.vue index 10e82cb9f..fb8d74ad4 100644 --- a/packages/client/src/components/MkReactionsViewer.details.vue +++ b/packages/client/src/components/MkReactionsViewer.details.vue @@ -3,7 +3,7 @@
-
{{ reaction.replace('@.', '') }}
+
{{ getReactionName(reaction) }}
@@ -20,6 +20,7 @@ import { } from 'vue'; import MkTooltip from './MkTooltip.vue'; import XReactionIcon from '@/components/MkReactionIcon.vue'; +import { getEmojiName } from '@/scripts/emojilist'; defineProps<{ showing: boolean; @@ -33,6 +34,14 @@ defineProps<{ const emit = defineEmits<{ (ev: 'closed'): void; }>(); + +function getReactionName(reaction: string): string { + const trimLocal = reaction.replace('@.', ''); + if (trimLocal.startsWith(':')) { + return trimLocal; + } + return getEmojiName(reaction) ?? reaction; +}