diff options
| author | Adam Soltys <[email protected]> | 2023-12-23 20:18:08 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-12-23 20:18:08 -0800 |
| commit | 45547db374033860050b323264e5563c35efe8a9 (patch) | |
| tree | 0002198cec1db73891f410971b967ce89143e2a4 /src | |
| parent | 74d4ba4e3400acc0f7a50e633cd7d3d14208178d (diff) | |
| download | coinos-ui-45547db374033860050b323264e5563c35efe8a9.tar.gz coinos-ui-45547db374033860050b323264e5563c35efe8a9.zip | |
revert numpad
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/Numpad.svelte | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/components/Numpad.svelte b/src/components/Numpad.svelte index 72dad375..fe018dce 100644 --- a/src/components/Numpad.svelte +++ b/src/components/Numpad.svelte @@ -10,7 +10,7 @@ rate, submit = undefined; - export let amountFiat = ""; + export let amountFiat = 0; let arrow = "<"; @@ -93,7 +93,9 @@ } else if (value !== "<" && parseInt(amount + value) > sats) { warning($t("user.receive.lessThan1BTCWarning")); } else { + console.log("CLICK", amount.toString(), value); amount = parseInt(amount.toString() + value); + console.log("AMOUNT", amount); } } }; @@ -118,8 +120,6 @@ .replace(/\./g, "") .replace("F", "."); - if (!clean) clean = " "; - if (fiat) clean = clean.replace(",", ""); if (clean !== html) { html = clean; @@ -163,19 +163,16 @@ }, 0); }; - let clear = (e) => { - if (amount > 0) { - let range = document.createRange(); - range.selectNodeContents(e.target); - let sel = getSelection(); - sel.removeAllRanges(); - sel.addRange(range); - } + let select = (e) => { + let range = document.createRange(); + range.selectNodeContents(e.target); + let sel = getSelection(); + sel.removeAllRanges(); + sel.addRange(range); }; - let keydown = (e) => { + let keydown = (e) => e.key === "Enter" && (e.preventDefault() || submit.click()); - }; </script> <div class="flex justify-center items-center mb-3 px-3"> @@ -191,7 +188,7 @@ use:focus contenteditable bind:innerHTML={html} - on:focus={clear} + on:focus={select} on:input={input} on:keydown={keydown} class="outline-none my-auto" @@ -224,8 +221,7 @@ <button type="button" class="bg-primary rounded-xl py-4 px-8 font-semibold active:bg-black active:text-white flex justify-center items-center hover:opacity-80" - on:click={() => handleInput(value)} - > + on:click={() => handleInput(value)}> <Left /> </button> {:else} |
