auto selecting currency if user has only one wallet

This commit was merged in pull request #687.
This commit is contained in:
victorAnumudu
2024-04-01 16:20:58 +01:00
parent f032ed21b5
commit 4b7c3beb53
5 changed files with 152 additions and 42 deletions
@@ -102,7 +102,7 @@ export default function NewTasks({ formState, setFormState }) {
htmlFor="Job Delivery Details"
className='job-label'
>
Job Delivery Details
Delivery Detail
{/* {props.errors.job_detail && props.touched.job_detail && <span className="text-[12px] text-red-500">{props.errors.job_detail}</span>} */}
</label>
<textarea
@@ -144,7 +144,7 @@ export default function NewTasks({ formState, setFormState }) {
<div className="field w-full">
<label
htmlFor="country"
className="job-label"
className="job-label invisible"
>
Currency
{/* {props.errors.country && props.touched.country && <span className="text-[12px] text-red-500">{props.errors.country}</span>} */}
@@ -155,6 +155,7 @@ export default function NewTasks({ formState, setFormState }) {
value={formState.country}
className={`input-field w-full h-[42px] flex items-center px-2 mt-2 rounded-full placeholder:text-base text-dark-gray dark:text-white bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none`}
onChange={handleInputChange}
disabled={walletDetails.data.length == 1}
// onBlur={props.handleBlur}
>
{walletDetails?.loading ? (
@@ -163,18 +164,34 @@ export default function NewTasks({ formState, setFormState }) {
</option>
) : walletDetails.data.length ? (
<>
<option className="text-slate-500 text-[13.975px]" value="">
Select
</option>
{walletDetails.data?.map((item, index) => (
<option
key={index}
className="text-slate-500 text-lg"
value={item?.country}
>
{item?.code}
</option>
))}
{walletDetails.data.length == 1 ?
<>
{walletDetails.data?.map((item, index) => (
<option
key={index}
className="text-slate-500 text-lg"
value={item?.country}
>
{item?.code}
</option>
))}
</>
:
<>
<option className="text-slate-500 text-[13.975px]" value="">
Select
</option>
{walletDetails.data?.map((item, index) => (
<option
key={index}
className="text-slate-500 text-lg"
value={item?.country}
>
{item?.code}
</option>
))}
</>
}
</>
) : (
<option className="text-slate-500 text-lg" value="">
@@ -205,7 +222,7 @@ export default function NewTasks({ formState, setFormState }) {
{publicArray.length && (
<>
<option className="text-slate-500 text-[13.975px]" value="">
Duration
Select
</option>
{publicArray.map(({ name, duration }, idx) => (
<option