From 9ca4ba319980f823d48d9bf1aeb2b3bc6d6dd4df Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Mon, 8 Apr 2024 09:17:47 +0100 Subject: [PATCH] made currency to auto select during add job if user has only one wallet acct --- src/components/AddJob/AddJob.jsx | 31 ++++++++++++++++++++++++--- src/components/MyWallet/WalletBox.jsx | 2 +- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/components/AddJob/AddJob.jsx b/src/components/AddJob/AddJob.jsx index 23aaced..325dd07 100644 --- a/src/components/AddJob/AddJob.jsx +++ b/src/components/AddJob/AddJob.jsx @@ -72,9 +72,21 @@ function AddJob({ popUpHandler, categories }) { } }; + // For form initial values + const initialValues = { + // initial values for formik + country: walletDetails.data.length == 1 ? walletDetails.data[0].country : '', + price: "", + title: "", + description: "", + job_detail: "", + timeline_days: "", + category: [], + }; + return ( @@ -105,12 +117,13 @@ function AddJob({ popUpHandler, categories }) { className={`input-field p-2 mt-3 rounded-md placeholder:text-base text-dark-gray dark:text-white w-full h-10 bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none border`} onChange={props.handleChange} onBlur={props.handleBlur} + disabled={walletDetails.data.length == 1} > {walletDetails?.loading ? ( - ) : walletDetails.data.length ? ( + ) : walletDetails.data.length > 1 ? ( <> ))} - ) : ( + ) : walletDetails.data.length == 1 ? + <> + {walletDetails.data?.map((item, index) => ( + + ))} + + :( diff --git a/src/components/MyWallet/WalletBox.jsx b/src/components/MyWallet/WalletBox.jsx index cd6f636..6e43def 100644 --- a/src/components/MyWallet/WalletBox.jsx +++ b/src/components/MyWallet/WalletBox.jsx @@ -22,7 +22,7 @@ export default function WalletBox({ wallet, payment, countries }) { ) : ( data.length > 0 && data.map((item) => ( -
+
)) -- 2.34.1