From 7bedf76945b2bb43ccd7ec7f142aad323543d04b Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Mon, 17 Jul 2023 11:07:11 +0100 Subject: [PATCH] made confirm withdrawal a pop up --- .../{ => Popup}/ConfirmNairaWithdraw.jsx | 16 ++-- src/components/MyWallet/WalletAction.jsx | 83 ++++++++++++------- 2 files changed, 59 insertions(+), 40 deletions(-) rename src/components/MyWallet/{ => Popup}/ConfirmNairaWithdraw.jsx (93%) diff --git a/src/components/MyWallet/ConfirmNairaWithdraw.jsx b/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx similarity index 93% rename from src/components/MyWallet/ConfirmNairaWithdraw.jsx rename to src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx index e7f8b9e..28eba23 100644 --- a/src/components/MyWallet/ConfirmNairaWithdraw.jsx +++ b/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx @@ -1,11 +1,11 @@ import React, { useEffect, useState } from "react"; -import { useLocation, useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router-dom"; import { toast } from "react-toastify"; -import InputCom from "../Helpers/Inputs/InputCom"; -import LoadingSpinner from "../Spinners/LoadingSpinner"; -import ModalCom from "../Helpers/ModalCom"; +import InputCom from "../../Helpers/Inputs/InputCom"; +import ModalCom from "../../Helpers/ModalCom"; +import LoadingSpinner from "../../Spinners/LoadingSpinner"; -import usersService from "../../services/UsersService"; +import usersService from "../../../services/UsersService"; function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) { const apiURL = new usersService(); @@ -73,9 +73,9 @@ function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {

- {`Withdraw from ${wallet.description} Wallet : ${wallet.symbol}${( - wallet.amount * 0.01 - ).toFixed(2)}`} + {`Withdraw from ${wallet.description} Wallet : ${ + wallet.symbol + }${(wallet.amount * 0.01).toFixed(2)}`}


diff --git a/src/components/MyWallet/WalletAction.jsx b/src/components/MyWallet/WalletAction.jsx index d16b361..310367e 100644 --- a/src/components/MyWallet/WalletAction.jsx +++ b/src/components/MyWallet/WalletAction.jsx @@ -1,37 +1,40 @@ -import React, { useState } from 'react' -import { Link } from 'react-router-dom'; -import NairaWithdraw from './Popup/NairaWithdraw'; -import ConfirmNairaWithdraw from './ConfirmNairaWithdraw'; +import React, { useState } from "react"; +import ConfirmNairaWithdraw from "./Popup/ConfirmNairaWithdraw"; +import NairaWithdraw from "./Popup/NairaWithdraw"; -function WalletAction({walletItem, payment, openPopUp}) { - const [showNairaWithdraw, setShowNairaWithdraw] = useState(false) // DETERMINES WHEN NAIRA WITHDRAWAL POPS UP +function WalletAction({ walletItem, payment, openPopUp }) { + const [showNairaWithdraw, setShowNairaWithdraw] = useState(false); // DETERMINES WHEN NAIRA WITHDRAWAL POPS UP - const [showConfirmNairaWithdraw, setShowConfirmNairaWithdraw] = useState({show: false, state: {}}) // DETERMINES WHEN CONFIRM NAIRA WITHDRAWAL POPS UP - + const [showConfirmNairaWithdraw, setShowConfirmNairaWithdraw] = useState({ + show: false, + state: {}, + }); // DETERMINES WHEN CONFIRM NAIRA WITHDRAWAL POPS UP return (
-
+
-
-
+
+
-
- - {showNairaWithdraw && - {setShowNairaWithdraw(prev => !prev)}} situation={showNairaWithdraw} setShowConfirmNairaWithdraw={setShowConfirmNairaWithdraw} /> - } +
- {showConfirmNairaWithdraw.show && - {setShowConfirmNairaWithdraw(prev => ({...prev, show: !prev.show}))}} situation={showConfirmNairaWithdraw.show} /> - } + {showNairaWithdraw && ( + { + setShowNairaWithdraw((prev) => !prev); + }} + situation={showNairaWithdraw} + setShowConfirmNairaWithdraw={setShowConfirmNairaWithdraw} + /> + )} + {showConfirmNairaWithdraw.show && ( + { + setShowConfirmNairaWithdraw((prev) => ({ + ...prev, + show: !prev.show, + })); + }} + situation={showConfirmNairaWithdraw.show} + /> + )}
- ) + ); } -export default WalletAction \ No newline at end of file +export default WalletAction; -- 2.34.1