blob: f92cd5efe701ff75555865b3ab7e16da37508834 (
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
|
<script>
import Pin from "$comp/Pin.svelte";
import { f, s, si, sat, sats } from "$lib/utils";
import { pin } from "$lib/store";
import { t } from "$lib/translations";
let show = $state();
let { user, rate, balance } = $props();
let toggleShow = (e) => {
e.preventDefault();
e.stopPropagation();
show = !show;
};
</script>
{#if show && user.haspin && $pin?.length !== 6}
<Pin cancel={() => (show = false)} />
{/if}
<div>
{#if user.haspin && !$pin}
<button onclick={toggleShow} class="flex gap-2 text-xl">
<iconify-icon icon="ph:eye-slash-bold" width="32"></iconify-icon>
<div class="my-auto">{$t("user.showBalance")}</div>
</button>
{:else}
<div class="text-4xl font-bold flex items-center">
<iconify-icon icon="ph:lightning-fill" width="32" class="text-yellow-300"></iconify-icon>
{s(balance)}
</div>
<div class="text-secondary text-xl">
{#if isNaN(rate)}
<div class="text-gray-200">—</div>
{:else}
{si(((balance * rate) / sats).toFixed(2))} {user.currency}
{/if}
</div>
{/if}
</div>
|