<script lang="ts">
  import Icon from "@lib/components2/Icon.svelte"
  import Button from "@lib/components2/Button.svelte"
  import Row from "@lib/components2/Row.svelte"
  import ChatMessageEmojiButton from "@app/components/ChatMessageEmojiButton.svelte"
  import EventInfo from "@app/components/EventInfo.svelte"
  import {pushModal} from "@app/modal"
  import Pen from "@assets/icons/pen.svg?dataurl"
  import Reply from "@assets/icons/reply-2.svg?dataurl"
  import Code2 from "@assets/icons/code-2.svg?dataurl"

  const {event, pubkeys, popover, replyTo, edit} = $props()

  const reply = () => replyTo(event)
  const onEdit = () => edit?.()

  const showInfo = () => {
    popover.hide()
    pushModal(EventInfo, {event})
  }
</script>

<Row gap={1} class="cl-surface cl-border rounded-full px-1 py-1 text-xs">
  <ChatMessageEmojiButton {event} {pubkeys} />
  {#if replyTo}
    <Button size="sm" circle onclick={reply}>
      <Icon size={4} icon={Reply} />
    </Button>
  {/if}
  {#if edit}
    <Button size="sm" circle onclick={onEdit}>
      <Icon size={4} icon={Pen} />
    </Button>
  {/if}
  <Button size="sm" circle onclick={showInfo}>
    <Icon size={4} icon={Code2} />
  </Button>
</Row>
