diff options
| author | Adam Soltys <[email protected]> | 2024-12-24 00:41:51 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-12-24 00:41:51 -0800 |
| commit | 3c0489e1cca4f6a211215b700489d256695c3ce1 (patch) | |
| tree | d477237d739237e2ca527750be2cd139393fb36a /src/components | |
| parent | 747e8d82fbfa88351a99e8d5cb5712ba4b6e4000 (diff) | |
| download | coinos-ui-3c0489e1cca4f6a211215b700489d256695c3ce1.tar.gz coinos-ui-3c0489e1cca4f6a211215b700489d256695c3ce1.zip | |
create fund
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Lnurlw.svelte | 6 | ||||
| -rw-r--r-- | src/components/Payments.svelte | 120 |
2 files changed, 123 insertions, 3 deletions
diff --git a/src/components/Lnurlw.svelte b/src/components/Lnurlw.svelte index e3345d31..8793d3b4 100644 --- a/src/components/Lnurlw.svelte +++ b/src/components/Lnurlw.svelte @@ -55,7 +55,7 @@ <Numpad bind:amount {currency} {rate} /> {/if} - <form action="?/withdraw" method="POST" use:enhance onsubmit={submit}> + <form action="?/withdraw" method="POST" use:enhance onsubmit={submit} class="space-y-5"> <input name="amount" value={amount} type="hidden" /> <input name="username" value={username} type="hidden" /> <input name="currency" value={currency} type="hidden" /> @@ -65,11 +65,11 @@ <input name="k1" value={k1} type="hidden" /> <div class="flex w-full"> - <button type="submit" class="btn"> + <button type="submit" class="btn btn-accent"> {#if loading} <Spinner /> {:else} - {$t("payments.redeem")} + {$t("payments.withdraw")} {/if} </button> </div> diff --git a/src/components/Payments.svelte b/src/components/Payments.svelte new file mode 100644 index 00000000..2d38513e --- /dev/null +++ b/src/components/Payments.svelte @@ -0,0 +1,120 @@ +<script> + import { goto } from "$app/navigation"; + import Avatar from "$comp/Avatar.svelte"; + import { get, f, s, si, sat, loc, sats, types } from "$lib/utils"; + import { format } from "date-fns"; + import { t } from "$lib/translations"; + + const { fund, locale, payments } = $props(); +</script> + +<div class="text-base"> + {#each payments as p, i} + {@const amount = fund ? -p.amount : p.amount} + <div + class="grid grid-cols-12 border-b border-base-200 hover:bg-base-200 px-1 py-2 lg:p-4 cursor-pointer" + class:border-b-0={i === payments.length - 1} + class:text-error={amount < 0} + onclick={() => goto(`/payment/${p.id}`)} + > + <div class="whitespace-nowrap my-auto col-span-3"> + <div class="font-bold flex items-center"> + <div class="flex items-center"> + <iconify-icon + icon="ph:lightning-fill" + width="24" + class="text-yellow-300" + ></iconify-icon> + <div>{s(Math.abs(amount), locale)}</div> + </div> + </div> + + <div class="text-secondary flex items-center text-base"> + {f(Math.abs(amount) * (p.rate / sats), p.currency, locale)} + + {#if p.tip} + <span class="text-sm text-secondary"> + +{Math.round((p.tip / Math.abs(amount)) * 100)}% + </span> + {/if} + </div> + </div> + + <div + class="flex my-auto col-span-6 truncate text-ellipsis overflow-hidden mx-auto" + > + {#if p.type === types.fund} + {#if fund} + <div class="flex"> + <div class="my-auto"> + <Avatar user={p.user} size={12} disabled={true} /> + </div> + <div class="my-auto ml-1 text-secondary"> + {p.user.username} + </div> + </div> + {:else} + <a href={`/fund/${p.memo}`}> + <div class="text-secondary flex"> + <iconify-icon + icon="ph:lightning-fill" + class="text-yellow-300 text-3xl" + ></iconify-icon> + + <div class="my-auto">{$t("payments.fund")}</div> + </div> + </a> + {/if} + {:else if p.with} + <div class="flex"> + <div class="my-auto"> + <Avatar user={p.with} size={12} disabled={true} /> + </div> + <div class="my-auto ml-1 text-secondary"> + {p.with.username} + </div> + </div> + {:else} + <div class="text-secondary flex items-center gap-1"> + {#if p.type === types.lightning} + <iconify-icon + icon="ph:lightning-fill" + class="text-yellow-300 text-3xl" + ></iconify-icon> + {:else if p.type === types.ecash} + <img src="/images/cash.png" class="w-12" /> + {:else if p.type === types.reconcile} + <iconify-icon icon="ph:scales-bold" width="32"></iconify-icon> + {:else if p.type === types.bitcoin} + <iconify-icon icon="logos:bitcoin" class="text-3xl" + ></iconify-icon> + {:else if p.type === types.liquid} + <div class="my-auto"> + <img + src="/images/liquid.svg" + class="w-10 border-4 border-transparent" + alt="Liquid" + /> + </div> + {/if} + + <div class="my-auto"> + {amount > 0 ? (p.confirmed ? "Received" : "Pending") : "Sent"} + </div> + </div> + {/if} + </div> + + <div class="text-secondary text-right text-sm my-auto col-span-3"> + <div> + {format(new Date(p.created), "h:mm aaa", { locale })} + </div> + <div> + {format(new Date(p.created), "MMM d, yy", { locale })} + </div> + </div> + </div> + {:else} + <p class="text-secondary text-lg text-center">{$t("payments.empty")}</p> + {/each} +</div> |
