<script lang="ts">
  import {deriveZapperForPubkey} from "@welshman/app"
  import AltArrowLeft from "@assets/icons/alt-arrow-left.svg?dataurl"
  import Icon from "@lib/components2/Icon.svelte"
  import Button from "@lib/components2/Button.svelte"
  import ModalHeader from "@lib/components2/ModalHeader.svelte"
  import ModalTitle from "@lib/components2/ModalTitle.svelte"
  import ModalFooter from "@lib/components2/ModalFooter.svelte"
  import Modal from "@lib/components2/Modal.svelte"
  import ModalBody from "@lib/components2/ModalBody.svelte"
  import ProfileLink from "@app/components/ProfileLink.svelte"

  const {pubkey} = $props()

  const zapper = deriveZapperForPubkey(pubkey)

  const back = () => history.back()
</script>

<Modal>
  <ModalBody>
    <ModalHeader>
      <ModalTitle>Unable to Zap</ModalTitle>
    </ModalHeader>
    <p>
      Zapping <ProfileLink {pubkey} class="cl-text-primary" /> isn't possible right now because
      {#if $zapper}
        their zap receiver isn't correctly set up.
      {:else}
        they don't currently have a zap receiver set up.
      {/if}
    </p>
  </ModalBody>
  <ModalFooter>
    <Button variant="ghost" onclick={back}>
      <Icon icon={AltArrowLeft} />
      Go back
    </Button>
  </ModalFooter>
</Modal>
