Skip to content

Commit

Permalink
on-chain warnings and hide zero amounts
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed May 9, 2024
1 parent 2504e57 commit 2c84093
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
4 changes: 3 additions & 1 deletion public/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
"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.",
"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": {
"search": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ActivityDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function OnchainHeader(props: { info: OnChainTx; kind?: HackActivityType }) {
</Match>
</Switch>
</div>
<Show when={props.kind !== "ChannelClose"}>
<Show when={props.kind !== "ChannelClose" && Number(amount()) > 0}>
<div class="flex flex-col items-center">
<div
class="text-2xl"
Expand Down
13 changes: 12 additions & 1 deletion src/components/ReceiveWarnings.tsx
Original file line number Diff line number Diff line change
@@ -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 { FeesModal } from "~/components/MoreInfoModal";
Expand Down Expand Up @@ -79,6 +79,12 @@ export function ReceiveWarnings(props: {
}
};

const onChainFedi = createMemo(() => {
if (props.flavor === "onchain" && state.federations?.length) {
return true;
}
});

return (
<Switch>
<Match when={tooSmallWarning()}>
Expand All @@ -92,6 +98,11 @@ export function ReceiveWarnings(props: {
{warningText()} <FeesModal />
</InfoBox>
</Match>
<Match when={onChainFedi()}>
<InfoBox accent="blue">
{i18n.t("receive.warning_on_chain_fedi")}
</InfoBox>
</Match>
</Switch>
);
}
5 changes: 5 additions & 0 deletions src/routes/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ export function Receive() {
<p>{error()}</p>
</InfoBox>
</Show>
<Show when={flavor() === "onchain"}>
<InfoBox accent="blue">
{i18n.t("receive.warning_address_reuse")}
</InfoBox>
</Show>
<IntegratedQr
value={qrString() ?? ""}
amountSats={amount() ? amount().toString() : "0"}
Expand Down

0 comments on commit 2c84093

Please sign in to comment.