<script lang="ts">
  import type {NativeEmoji} from "emoji-picker-element/shared"
  import type {TrustedEvent} from "@welshman/util"
  import {sendWrapped} from "@welshman/app"
  import SmileCircle from "@assets/icons/smile-circle.svg?dataurl"
  import Icon from "@lib/components2/Icon.svelte"
  import EmojiButton from "@lib/components2/EmojiButton.svelte"
  import {makeReaction} from "@app/reactions"

  interface Props {
    event: TrustedEvent
    pubkeys: string[]
  }

  const {event, pubkeys}: Props = $props()

  const onEmoji = (emoji: NativeEmoji) =>
    sendWrapped({
      event: makeReaction({event, content: emoji.unicode, protect: false}),
      recipients: pubkeys,
      pow: 16,
    })
</script>

<EmojiButton {onEmoji} class="btn-cl-sm">
  <Icon icon={SmileCircle} size={4} />
</EmojiButton>
