on-chain warnings and hide zero amounts

This commit is contained in:
Paul Miller
2024-05-09 11:56:20 -05:00
parent 37fc60b394
commit 336ec4b2cf
4 changed files with 21 additions and 3 deletions

View File

@@ -148,7 +148,9 @@
"body": "Lightning receives will automatically go into your chosen federation. You can swap to self-custodial later if you want." "body": "Lightning receives will automatically go into your chosen federation. You can swap to self-custodial later if you want."
}, },
"receive_strings_error": "Something went wrong generating an invoice or on-chain address.", "receive_strings_error": "Something went wrong generating an invoice or on-chain address.",
"error_under_min_onchain": "That's under the dust limit! On-chain transactions should be much bigger." "error_under_min_onchain": "That's under the dust limit! On-chain transactions should be much bigger.",
"warning_on_chain_fedi": "On-chain fedimint deposits require 10 confirmations.",
"warning_address_reuse": "Only send to this address once!"
}, },
"send": { "send": {
"search": { "search": {

View File

@@ -168,7 +168,7 @@ function OnchainHeader(props: { info: OnChainTx; kind?: HackActivityType }) {
</Match> </Match>
</Switch> </Switch>
</div> </div>
<Show when={props.kind !== "ChannelClose"}> <Show when={props.kind !== "ChannelClose" && Number(amount()) > 0}>
<div class="flex flex-col items-center"> <div class="flex flex-col items-center">
<div <div
class="text-2xl" class="text-2xl"

View File

@@ -1,4 +1,4 @@
import { createResource, Match, Switch } from "solid-js"; import { createMemo, createResource, Match, Switch } from "solid-js";
import { InfoBox } from "~/components/InfoBox"; import { InfoBox } from "~/components/InfoBox";
import { FeesModal } from "~/components/MoreInfoModal"; import { FeesModal } from "~/components/MoreInfoModal";
@@ -79,6 +79,12 @@ export function ReceiveWarnings(props: {
} }
}; };
const onChainFedi = createMemo(() => {
if (props.flavor === "onchain" && state.federations?.length) {
return true;
}
});
return ( return (
<Switch> <Switch>
<Match when={tooSmallWarning()}> <Match when={tooSmallWarning()}>
@@ -92,6 +98,11 @@ export function ReceiveWarnings(props: {
{warningText()} <FeesModal /> {warningText()} <FeesModal />
</InfoBox> </InfoBox>
</Match> </Match>
<Match when={onChainFedi()}>
<InfoBox accent="blue">
{i18n.t("receive.warning_on_chain_fedi")}
</InfoBox>
</Match>
</Switch> </Switch>
); );
} }

View File

@@ -460,6 +460,11 @@ export function Receive() {
<p>{error()}</p> <p>{error()}</p>
</InfoBox> </InfoBox>
</Show> </Show>
<Show when={flavor() === "onchain"}>
<InfoBox accent="blue">
{i18n.t("receive.warning_address_reuse")}
</InfoBox>
</Show>
<IntegratedQr <IntegratedQr
value={qrString() ?? ""} value={qrString() ?? ""}
amountSats={amount() ? amount().toString() : "0"} amountSats={amount() ? amount().toString() : "0"}