mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-19 15:24:25 +01:00
warn for large amounts
This commit is contained in:
@@ -5,7 +5,9 @@ import {
|
|||||||
createResource,
|
createResource,
|
||||||
createSignal,
|
createSignal,
|
||||||
onMount,
|
onMount,
|
||||||
onCleanup
|
onCleanup,
|
||||||
|
Switch,
|
||||||
|
Match
|
||||||
} from "solid-js";
|
} from "solid-js";
|
||||||
import { Button } from "~/components/layout";
|
import { Button } from "~/components/layout";
|
||||||
import { useMegaStore } from "~/state/megaStore";
|
import { useMegaStore } from "~/state/megaStore";
|
||||||
@@ -254,6 +256,18 @@ export const AmountEditable: ParentComponent<{
|
|||||||
return undefined;
|
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) {
|
function handleCharacterInput(character: string) {
|
||||||
const isFiatMode = mode() === "fiat";
|
const isFiatMode = mode() === "fiat";
|
||||||
const inputSanitizer = isFiatMode
|
const inputSanitizer = isFiatMode
|
||||||
@@ -401,7 +415,9 @@ export const AmountEditable: ParentComponent<{
|
|||||||
<Show
|
<Show
|
||||||
when={localSats() !== "0"}
|
when={localSats() !== "0"}
|
||||||
fallback={
|
fallback={
|
||||||
<div class="inline-block font-semibold">{i18n.t("set_amount")}</div>
|
<div class="inline-block font-semibold">
|
||||||
|
{i18n.t("set_amount")}
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<InlineAmount amount={maxOrLocalSats()} />
|
<InlineAmount amount={maxOrLocalSats()} />
|
||||||
@@ -472,11 +488,20 @@ export const AmountEditable: ParentComponent<{
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Show when={warningText() && !props.skipWarnings}>
|
<Switch>
|
||||||
|
<Match when={betaWarning()}>
|
||||||
|
<InfoBox accent="red">
|
||||||
|
{betaWarning()}
|
||||||
|
</InfoBox>
|
||||||
|
</Match>
|
||||||
|
<Match
|
||||||
|
when={warningText() && !props.skipWarnings}
|
||||||
|
>
|
||||||
<InfoBox accent="blue">
|
<InfoBox accent="blue">
|
||||||
{warningText()} <FeesModal />
|
{warningText()} <FeesModal />
|
||||||
</InfoBox>
|
</InfoBox>
|
||||||
</Show>
|
</Match>
|
||||||
|
</Switch>
|
||||||
<div class="flex justify-center gap-4 my-2">
|
<div class="flex justify-center gap-4 my-2">
|
||||||
<For
|
<For
|
||||||
each={
|
each={
|
||||||
|
|||||||
@@ -18,5 +18,7 @@ export default {
|
|||||||
receive_add_the_sender: "Add the sender for your records",
|
receive_add_the_sender: "Add the sender for your records",
|
||||||
continue: "Continue",
|
continue: "Continue",
|
||||||
receive_bitcoin: "Receive Bitcoin",
|
receive_bitcoin: "Receive Bitcoin",
|
||||||
keep_mutiny_open: "Keep Mutiny open to complete the payment."
|
keep_mutiny_open: "Keep Mutiny open to complete the payment.",
|
||||||
|
too_big_for_beta:
|
||||||
|
"That's a lot of sats. You do know Mutiny Wallet is still in beta, yeah?"
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user