navigate home after send / receive

This commit is contained in:
Paul Miller
2023-05-04 15:29:24 -05:00
parent 91f66f345d
commit 8f1e469972
2 changed files with 17 additions and 3 deletions

View File

@@ -16,6 +16,7 @@ import { BackButton } from "~/components/layout/BackButton";
import { TagEditor, TagItem } from "~/components/TagEditor";
import { StyledRadioGroup } from "~/components/layout/Radio";
import { showToast } from "~/components/Toaster";
import { useNavigate } from "solid-start";
type OnChainTx = {
transaction: {
@@ -81,6 +82,7 @@ type PaidState = "lightning_paid" | "onchain_paid";
export default function Receive() {
const [state, _] = useMegaStore()
const navigate = useNavigate();
const [amount, setAmount] = createSignal("")
const [receiveState, setReceiveState] = createSignal<ReceiveState>("edit")
@@ -263,7 +265,12 @@ export default function Receive() {
</Card>
</Match>
<Match when={receiveState() === "paid" && paidState() === "lightning_paid"}>
<FullscreenModal title="Payment Received" open={!!paidState()} setOpen={(open: boolean) => { if (!open) clearAll() }}>
<FullscreenModal
title="Payment Received"
open={!!paidState()}
setOpen={(open: boolean) => { if (!open) clearAll() }}
onConfirm={() => { clearAll(); navigate("/"); }}
>
<div class="flex flex-col items-center gap-8">
<img src={party} alt="party" class="w-1/2 mx-auto max-w-[50vh] aspect-square" />
<Amount amountSats={paymentInvoice()?.amount_sats} showFiat />
@@ -271,7 +278,12 @@ export default function Receive() {
</FullscreenModal>
</Match>
<Match when={receiveState() === "paid" && paidState() === "onchain_paid"}>
<FullscreenModal title="Payment Received" open={!!paidState()} setOpen={(open: boolean) => { if (!open) clearAll() }}>
<FullscreenModal
title="Payment Received"
open={!!paidState()}
setOpen={(open: boolean) => { if (!open) clearAll() }}
onConfirm={() => { clearAll(); navigate("/"); }}
>
<div class="flex flex-col items-center gap-8">
<img src={party} alt="party" class="w-1/2 mx-auto max-w-[50vh] aspect-square" />
<Amount amountSats={paymentTx()?.received} showFiat />

View File

@@ -16,6 +16,7 @@ import handshake from "~/assets/hands/handshake.png";
import thumbsdown from "~/assets/hands/thumbsdown.png";
import mempoolTxUrl from "~/utils/mempoolTxUrl";
import { BackButton } from "~/components/layout/BackButton";
import { useNavigate } from "solid-start";
type SendSource = "lightning" | "onchain";
@@ -29,6 +30,7 @@ type SentDetails = { amount?: bigint, destination?: string, txid?: string, failu
export default function Send() {
const [state, actions] = useMegaStore();
const navigate = useNavigate()
// These can only be set by the user
const [fieldDestination, setFieldDestination] = createSignal("");
@@ -204,7 +206,7 @@ export default function Send() {
confirmText={sentDetails()?.amount ? "Nice" : "Too Bad"}
open={!!sentDetails()}
setOpen={(open: boolean) => { if (!open) setSentDetails(undefined) }}
onConfirm={() => setSentDetails(undefined)}
onConfirm={() => { setSentDetails(undefined); navigate("/"); }}
>
<div class="flex flex-col items-center gap-8 h-full">
<Switch>