Convert ConfirmAddFund to Popup

This commit was merged in pull request #292.
This commit is contained in:
2023-07-11 19:47:04 +01:00
parent c53ee2833f
commit e899e5eb2a
7 changed files with 321 additions and 210 deletions
+32 -9
View File
@@ -59,6 +59,7 @@ function AddFundDollars(props) {
let apiCall = new usersService();
let [tab, setTab] = useState("previous"); //STATE FOR SWITCHING BETWEEN TABS
const [loader, setLoader] = useState(false);
let [prevCardDetails, setPrevCardDetails] = useState(null); // STATE TO HOLD PREVIOUS CARD SELECTED
@@ -94,18 +95,26 @@ function AddFundDollars(props) {
}, 5000);
}
if (tab == "previous") {
const stateData = { amount: Number(props.input), currency: "dollars" };
navigate("confirm-add-fund", { state: stateData }); // State will change later dummy for now
setLoader(true);
const stateData = {
amount: Number(props.input),
currency: props.currency,
};
setTimeout(() => {
props.setConfirmCredit({ show: true, data: stateData });
setLoader(false);
}, 1500);
// navigate("confirm-add-fund", { state: stateData }); // State will change later dummy for now
}
if (tab == "new") {
const stateData = {
amount: Number(props.input),
currency: "dollars",
currency: props.currency,
...values,
};
navigate("confirm-add-fund", { state: stateData }); // State will change later dummy for now
// navigate("confirm-add-fund", { state: stateData }); // State will change later dummy for now
}
props.setInput("");
};
useEffect(() => {
@@ -169,7 +178,11 @@ function AddFundDollars(props) {
<select className="my-3 w-full rounded-full p-4 outline-none border-none">
<option value="">Select a card</option>
{currentPreviousCards.map((item, index) => (
<option key={index} className={index != 0 && "border-t-2"}>
<option
key={index}
className={index != 0 && "border-t-2"}
value={item}
>
<div className="my-2 flex items-center gap-5">
{/* <input
type="radio"
@@ -518,13 +531,23 @@ function AddFundDollars(props) {
)}
</div>
{tab == "previous" && (
<div className="md:py-8 px-[38px] add-fund-btn flex justify-end items-center py-4">
<div className="md:py-8 px-[38px] add-fund-btn flex justify-end items-center gap-4 py-4">
<button
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center items-center border-gradient text-base rounded-full"
onClick={props.onClose}
>
Cancel
</button>
<button
onClick={handleSubmit}
type="button"
className="px-4 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
className="px-4 py-1 h-11 max-w-[100px] w-full flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
<span className="text-white">Continue</span>
{loader ? (
<LoadingSpinner size="6" color="sky-blue" />
) : (
<span className="text-white">Continue</span>
)}
</button>
</div>
)}