diff --git a/src/pages/Home/SendModal/SendModal.tsx b/src/pages/Home/SendModal/SendModal.tsx index f8a5d6af..4a8f98fe 100644 --- a/src/pages/Home/SendModal/SendModal.tsx +++ b/src/pages/Home/SendModal/SendModal.tsx @@ -2,20 +2,19 @@ import SwitchTxType, { TxType } from "../SwitchTxType"; import ConfirmSendModal from "./ConfirmSendModal"; import SendLn, { LnInvoiceForm } from "./SendLN"; import SendOnChain, { SendOnChainForm } from "./SendOnChain"; -import ModalDialog from "@/layouts/ModalDialog"; +import ConfirmModal, { + type Props as ConfirmModalProps, +} from "@/components/ConfirmModal"; import { DecodePayRequest } from "@/models/decode-pay-req"; -import { MODAL_ROOT } from "@/utils"; import { checkError } from "@/utils/checkError"; import { instance } from "@/utils/interceptor"; import { AxiosResponse } from "axios"; import { FC, useState } from "react"; -import { createPortal } from "react-dom"; -export type Props = { +interface Props extends Pick { lnBalance: number; onchainBalance: number; - onClose: () => void; -}; +} export interface SendLnForm { invoiceType: TxType.LIGHTNING; @@ -27,7 +26,7 @@ export interface SendLnForm { expiry: number; } -const SendModal: FC = ({ lnBalance, onClose, onchainBalance }) => { +const SendModal: FC = ({ lnBalance, disclosure, onchainBalance }) => { const [invoiceType, setInvoiceType] = useState(TxType.LIGHTNING); const [confirmData, setConfirmData] = useState< SendOnChainForm | SendLnForm | null @@ -84,57 +83,71 @@ const SendModal: FC = ({ lnBalance, onClose, onchainBalance }) => { // confirm send if (!isBack && confirmData) { return ( - onClose()}> - - + + } + /> ); } // Send LN if (invoiceType === TxType.LIGHTNING) { - return createPortal( - onClose()} closeable={!loading}> - + return ( + + - - , - MODAL_ROOT, + + + } + /> ); } // Send On-Chain - return createPortal( - onClose()}> - + return ( + + - - , - MODAL_ROOT, + + + } + /> ); }; diff --git a/src/pages/Home/UnlockModal.tsx b/src/pages/Home/UnlockModal.tsx index 155725aa..19de3a81 100644 --- a/src/pages/Home/UnlockModal.tsx +++ b/src/pages/Home/UnlockModal.tsx @@ -56,7 +56,7 @@ export default function UnlockModal({ return ( diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 6e6ec900..fd954062 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -149,6 +149,8 @@ const Home: FC = () => { useInterval(getTransactions, 20000); useEffect(() => { + console.log("showModal", showModal); + if (showModal === "UNLOCK") { openModal("UNLOCK"); } @@ -158,11 +160,17 @@ const Home: FC = () => { if (showModal === "OPEN_CHANNEL") { openModal("OPEN_CHANNEL"); } - // // } else if (hasPendingSend) { - // // openModal('send') - // // } else if (hasPendingReceive) { - // // openModal('receive') - // } + if (showModal === "SEND") { + console.log("SEND888888"); + + openModal("SEND"); + } + if (showModal === "RECEIVE") { + openModal("RECEIVE"); + } + if (showModal === "DETAIL") { + openModal("DETAIL"); + } }, [showModal, openModal]); const closeModalHandler = () => { @@ -209,8 +217,11 @@ const Home: FC = () => { /> )} {activeModal === "SEND" && ( - // - <>YO1 + )} {activeModal === "RECEIVE" && ( // @@ -243,6 +254,7 @@ const Home: FC = () => {
+

{activeModal}

{!btcOnlyMode && (