aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/InvoiceActions.svelte
blob: 0b5dca557b061fc60fc8ca5f2037465f93008f65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<script>
  let {
    user,
    invoice,
    copy,
    t,
    link,
    type,
    types,
    showQr = $bindable(),
    txt,
    toggleAmount
  } = $props();
</script>

<div class="text-secondary space-y-2 text-xl pt-2">
  <button type="button" class="btn" onclick={() => copy(txt)}>
    <iconify-icon icon="ph:copy-bold" width="32"></iconify-icon>
    <div class="my-auto">
      {t("payments.copy")}
    </div>
  </button>

  {#if user?.id === invoice?.user?.id}
    <button class="btn" onclick={toggleAmount}>
      <iconify-icon icon="ph:pencil-simple-bold" width="32"></iconify-icon>
      <div class="my-auto">{t("payments.setAmount")}</div>
    </button>
  {:else}
    <a href={link} class="block">
      <button class="btn">
        <iconify-icon icon="ph:wallet-bold" width="32"></iconify-icon>
        <div class="my-auto">{t("payments.openLink")}</div>
      </button>
    </a>
  {/if}

  {#if txt.startsWith("ln")}
    <div class="w-full flex justify-center gap-2 flex-wrap">
      <button class="btn" onclick={() => (showQr = !showQr)}>
        {#if showQr}
          <iconify-icon icon="ph:text-align-center-bold" width="32"></iconify-icon>
        {:else}
          <iconify-icon icon="ph:qr-code-bold" width="32"></iconify-icon>
        {/if}
        <div class="my-auto">
          {showQr ? t("payments.showText") : t("payments.showQr")}
        </div></button
      >
    </div>
  {/if}
</div>