- ≈ {amountInUsd()}
+ ~{amountInUsd()}
USD
diff --git a/src/components/AmountEditable.tsx b/src/components/AmountEditable.tsx
index d6d7699..8e72ba4 100644
--- a/src/components/AmountEditable.tsx
+++ b/src/components/AmountEditable.tsx
@@ -4,7 +4,8 @@ import {
Show,
createResource,
createSignal,
- onMount
+ onMount,
+ onCleanup
} from "solid-js";
import { Button } from "~/components/layout";
import { useMegaStore } from "~/state/megaStore";
@@ -12,6 +13,7 @@ import { satsToUsd, usdToSats } from "~/utils/conversions";
import { Dialog } from "@kobalte/core";
import close from "~/assets/icons/close.svg";
import pencil from "~/assets/icons/pencil.svg";
+import currencySwap from "~/assets/icons/currency-swap.svg";
import { InlineAmount } from "./AmountCard";
import { DIALOG_CONTENT, DIALOG_POSITIONER } from "~/styles/dialogs";
import { InfoBox } from "./InfoBox";
@@ -76,8 +78,32 @@ function satsInputSanitizer(input: string): string {
function SingleDigitButton(props: {
character: string;
onClick: (c: string) => void;
+ onClear: () => void;
fiat: boolean;
}) {
+ let holdTimer: number;
+ const holdThreshold = 500;
+
+ function onHold() {
+ holdTimer = setTimeout(() => {
+ props.onClear();
+ }, holdThreshold);
+ }
+
+ function endHold() {
+ clearTimeout(holdTimer);
+ }
+
+ function onClick() {
+ props.onClick(props.character);
+
+ clearTimeout(holdTimer);
+ }
+
+ onCleanup(() => {
+ clearTimeout(holdTimer);
+ });
+
return (
// Skip the "." if it's fiat