From dc6cfe695c17d65eaae4b1a55a072e61568a4c44 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Mon, 10 Jul 2023 17:42:46 -0500 Subject: [PATCH] warn for large amounts --- src/components/AmountEditable.tsx | 39 +++++++++++++++++++++++++------ src/i18n/en/translations.ts | 4 +++- 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/components/AmountEditable.tsx b/src/components/AmountEditable.tsx index a77278e..1d9734f 100644 --- a/src/components/AmountEditable.tsx +++ b/src/components/AmountEditable.tsx @@ -5,7 +5,9 @@ import { createResource, createSignal, onMount, - onCleanup + onCleanup, + Switch, + Match } from "solid-js"; import { Button } from "~/components/layout"; import { useMegaStore } from "~/state/megaStore"; @@ -254,6 +256,18 @@ export const AmountEditable: ParentComponent<{ return undefined; }; + const betaWarning = () => { + const parsed = Number(localSats()); + if (isNaN(parsed)) { + return undefined; + } + + // If over 4 million sats, warn that it's a beta bro + if (parsed >= 4000000) { + return i18n.t("too_big_for_beta"); + } + }; + function handleCharacterInput(character: string) { const isFiatMode = mode() === "fiat"; const inputSanitizer = isFiatMode @@ -401,7 +415,9 @@ export const AmountEditable: ParentComponent<{ {i18n.t("set_amount")} +
+ {i18n.t("set_amount")} +
} > @@ -472,11 +488,20 @@ export const AmountEditable: ParentComponent<{ /> - - - {warningText()} - - + + + + {betaWarning()} + + + + + {warningText()} + + +