Skip to content

Commit 08b908b

Browse files
committed
feat: handle case where emoji reaction is normal non-custom emojis and adjust styling
1 parent 38f31a6 commit 08b908b

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
<script setup lang="ts">
2-
import type { mastodon } from 'masto'
2+
import { getEmojiAttributes } from '~/config/emojis'
33
44
const props = defineProps<{
5-
status: mastodon.v1.Status
5+
status: Status
66
details?: boolean
77
}>()
88
99
const {
1010
status,
1111
} = useStatusActions(props)
12+
13+
function isCustomEmoji(emoji: EmojiReaction) {
14+
return !!emoji.staticUrl
15+
}
1216
</script>
1317

1418
<template>
15-
<div flex items-center class="status-actions">
16-
<div v-for="(i, emoji) in status.emojiReactions" :key="i" flex-inline gap-1 mr-4 text-secondary>
17-
<picture class="custom-emoji" :alt="`:${emoji.name}:`" :data-emoji-id="emoji.name" :title="emoji.name">
19+
<div flex flex-wrap gap-1 class="status-actions">
20+
<button
21+
v-for="(emoji, i) in status?.emojiReactions ?? []"
22+
:key="i"
23+
flex gap-1 p="block-1 inline-2" text-secondary btn-base hover:bg-gray-1 rounded-1
24+
>
25+
<picture v-if="isCustomEmoji(emoji)" class="custom-emoji" :alt="`:${emoji.name}:`" :data-emoji-id="emoji.name">
1826
<source :srcset="emoji.staticUrl" media="(prefers-reduced-motion: reduce)">
1927
<img :src="emoji.url" :alt="`:${emoji.name}:`" title="" style="">
2028
</picture>
21-
<CommonLocalizedNumber :keypath="emoji.count" :count="emoji.count" />
22-
</div>
29+
<picture v-else class="custom-emoji" :alt="`:${emoji.name}:`" :data-emoji-id="emoji.name">
30+
<img v-bind="getEmojiAttributes(emoji.name)">
31+
</picture>
32+
<CommonLocalizedNumber :keypath="emoji.count.toString()" :count="emoji.count" />
33+
</button>
2334
</div>
2435
</template>

0 commit comments

Comments
 (0)