diff --git a/src/pages/Home/ReceiveModal/QRCode.tsx b/src/pages/Home/ReceiveModal/QRCode.tsx index e5508728..9dce94f9 100644 --- a/src/pages/Home/ReceiveModal/QRCode.tsx +++ b/src/pages/Home/ReceiveModal/QRCode.tsx @@ -35,11 +35,13 @@ const ReceiveOnChain: FC = ({ address, onRefreshHandler }) => { -
- -
+ {onRefreshHandler && ( +
+ +
+ )} ); }; diff --git a/src/pages/Home/ReceiveModal/ReceiveModal.tsx b/src/pages/Home/ReceiveModal/ReceiveModal.tsx index f184d679..329a9b72 100644 --- a/src/pages/Home/ReceiveModal/ReceiveModal.tsx +++ b/src/pages/Home/ReceiveModal/ReceiveModal.tsx @@ -94,11 +94,15 @@ const ReceiveModal: FC> = ({ onSelectionChange={handleTabChange} > - + {invoice ? ( + + ) : ( + + )} diff --git a/src/pages/Home/ReceiveModal/ReceiveOnChain.tsx b/src/pages/Home/ReceiveModal/ReceiveOnChain.tsx deleted file mode 100644 index 13e5d0a5..00000000 --- a/src/pages/Home/ReceiveModal/ReceiveOnChain.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { Button } from "@/components/Button"; -import useClipboard from "@/hooks/use-clipboard"; -import { ApiError, checkError } from "@/utils/checkError"; -import { instance } from "@/utils/interceptor"; -import { RefreshIcon } from "@bitcoin-design/bitcoin-icons-react/filled"; -import { AxiosError } from "axios"; -import { QRCodeSVG } from "qrcode.react"; -import { Dispatch, FC, SetStateAction } from "react"; -import { useTranslation } from "react-i18next"; -import { Tooltip } from "react-tooltip"; - -type Props = { - address: string; - setAddress: Dispatch>; - setIsLoading: Dispatch>; - setError: Dispatch>; -}; - -const ReceiveOnChain: FC = ({ - address, - setAddress, - setIsLoading, - setError, -}) => { - const { t } = useTranslation(); - const [copyAddress, addressCopied] = useClipboard(address); - - const refreshAddressHandler = async () => { - setAddress(""); - setError(""); - - try { - setIsLoading(true); - const response = await instance.post("lightning/new-address", { - type: "p2wkh", - }); - setAddress(response.data); - } catch (error) { - setError(checkError(error as AxiosError)); - } finally { - setIsLoading(false); - } - }; - - return ( - <> - -

{t("wallet.scan_qr")}

- -
-

- {address} -

- -
- {addressCopied ? t("wallet.copied") : t("wallet.copy_clipboard")} -
-
-
- -
- -
- - ); -}; - -export default ReceiveOnChain;