flotilla/src/app/components/ChatMessageEmojiButton.svelte

26 lines
811 B
Svelte
Raw Normal View History

2024-10-08 18:39:16 +00:00
<script lang="ts">
import type {NativeEmoji} from "emoji-picker-element/shared"
import type {TrustedEvent} from "@welshman/util"
2025-09-10 22:26:39 +00:00
import SmileCircle from "@assets/icons/smile-circle.svg?dataurl"
2024-10-24 22:48:45 +00:00
import Icon from "@lib/components/Icon.svelte"
2024-10-23 23:16:28 +00:00
import EmojiButton from "@lib/components/EmojiButton.svelte"
2026-07-28 16:16:26 +00:00
import {reactions, wraps} from "@app/core"
2024-10-08 18:39:16 +00:00
2026-07-28 16:16:26 +00:00
type Props = {
2025-02-04 00:37:14 +00:00
event: TrustedEvent
pubkeys: string[]
}
const {event, pubkeys}: Props = $props()
2024-10-08 18:39:16 +00:00
2026-07-28 16:16:26 +00:00
const onEmoji = async (emoji: NativeEmoji) => {
const reaction = await $reactions.react(event, emoji.unicode)
return $wraps.publish({event: reaction.event, recipients: pubkeys, pow: 16})
}
2024-10-08 18:39:16 +00:00
</script>
<EmojiButton {onEmoji} class="button button-neutral button-xs join-item">
2025-09-10 22:26:39 +00:00
<Icon icon={SmileCircle} size={4} />
2024-10-24 22:48:45 +00:00
</EmojiButton>