Compare commits

..

8 Commits

6 changed files with 542 additions and 496 deletions
+6
View File
@@ -74,3 +74,9 @@ REACT_APP_LINKEDIN_SOCIAL_LOGIN=0
#apigate.lotus.g1.wrenchboard.com:76.209.103.227 #apigate.lotus.g1.wrenchboard.com:76.209.103.227
#apigate.orion.g1.wrenchboard.com:76.209.103.227 #apigate.orion.g1.wrenchboard.com:76.209.103.227
REACT_APP_MAX_CREDIT_CARDS=4
REACT_APP_MAX_CREDIT_BANK_ACCOUNT=4
REACT_APP_MAX_FAMILY_MEMBERS=8
+5
View File
@@ -46,3 +46,8 @@ REACT_APP_LOGOUT_TEXT="Sign Out"
REACT_APP_APPLE_SOCIAL_LOGIN=0 REACT_APP_APPLE_SOCIAL_LOGIN=0
REACT_APP_LINKEDIN_SOCIAL_LOGIN=0 REACT_APP_LINKEDIN_SOCIAL_LOGIN=0
REACT_APP_MAX_CREDIT_CARDS=4
REACT_APP_MAX_CREDIT_BANK_ACCOUNT=4
REACT_APP_MAX_FAMILY_MEMBERS=8
+5
View File
@@ -52,3 +52,8 @@ REACT_APP_TOTAL_NUM_FILE=4
REACT_APP_LOGOUT_TEXT="Sign Out" REACT_APP_LOGOUT_TEXT="Sign Out"
REACT_APP_APPLE_SOCIAL_LOGIN=0 REACT_APP_APPLE_SOCIAL_LOGIN=0
REACT_APP_LINKEDIN_SOCIAL_LOGIN=0 REACT_APP_LINKEDIN_SOCIAL_LOGIN=0
REACT_APP_MAX_CREDIT_CARDS=4
REACT_APP_MAX_CREDIT_BANK_ACCOUNT=4
REACT_APP_MAX_FAMILY_MEMBERS=8
+15 -4
View File
@@ -1,5 +1,5 @@
import React, { useCallback, useEffect, useState } from "react"; import React, { useCallback, useEffect, useState } from "react";
import { Link, useNavigate } from "react-router-dom"; import { Link, useLocation, useNavigate } from "react-router-dom";
import WrenchBoard from "../../../assets/images/wrenchboard-logo-text.png"; import WrenchBoard from "../../../assets/images/wrenchboard-logo-text.png";
import usersService from "../../../services/UsersService"; import usersService from "../../../services/UsersService";
import InputCom from "../../Helpers/Inputs/InputCom"; import InputCom from "../../Helpers/Inputs/InputCom";
@@ -9,6 +9,9 @@ export default function SignUp() {
const queryParams = new URLSearchParams(location?.search); const queryParams = new URLSearchParams(location?.search);
const country = queryParams.get("cnt")?.toUpperCase(); const country = queryParams.get("cnt")?.toUpperCase();
const {pathname} = useLocation()
const currentPath = country ? `${pathname}?cnt=${country.toLowerCase()}`:pathname // Determines the new pathname is country query params exist
const [signUpLoading, setSignUpLoading] = useState(false); const [signUpLoading, setSignUpLoading] = useState(false);
const [checked, setValue] = useState(false); const [checked, setValue] = useState(false);
// for the catch error // for the catch error
@@ -50,8 +53,12 @@ export default function SignUp() {
const { signup_country } = await res.data; const { signup_country } = await res.data;
// setCountries(signup_country); // setCountries(signup_country);
if(country){ // IF LINK/PATHNAME HAS CNT QUERY VALUE if(country){ // IF LINK/PATHNAME HAS CNT QUERY VALUE
let cnt = signup_country.filter(item => item[0]==country) let cnt = signup_country.filter(item => item[0]==country) // test to see country passed in query param exist from list of countries supplied by API
return setCountries({loading: false, data: cnt.length ? signup_country.filter(item => item[0]==country) : signup_country}); if(!cnt.length){ // IF CNT EMPTY, SET FORMDATA COUNTRY BACK TO EMPTY STRING: RE: THIS IS BCOS WE INITAIL SET COUNTRY VALUE IN FORMDATA, IF COUNTRY PARAM IS PRESENT IN LINK
setFormData(prev => ({...prev, country: ''}))
return setCountries({loading: false, data: signup_country});
}
return setCountries({loading: false, data: cnt});
} }
setCountries({loading: false, data:signup_country}); setCountries({loading: false, data:signup_country});
} else if (res.data.result !== 100) { } else if (res.data.result !== 100) {
@@ -142,7 +149,7 @@ export default function SignUp() {
<AuthLayout slogan="Welcome to WrenchBoard"> <AuthLayout slogan="Welcome to WrenchBoard">
<div className="w-full"> <div className="w-full">
<div className="mb-5"> <div className="mb-5">
<Link to="#"> <Link to={currentPath}>
<img <img
src={WrenchBoard} src={WrenchBoard}
alt="wrenchboard" alt="wrenchboard"
@@ -180,6 +187,7 @@ export default function SignUp() {
name="country" name="country"
value={formData.country} value={formData.country}
inputHandler={handleInputChange} inputHandler={handleInputChange}
disable={country && countries?.data?.length <= 1 ? true : false}
/> />
<div className="input-fl-name mb-5 sm:flex w-full sm:space-x-6 "> <div className="input-fl-name mb-5 sm:flex w-full sm:space-x-6 ">
<div className="input-item sm:w-1/2 w-full mb-5 sm:mb-0"> <div className="input-item sm:w-1/2 w-full mb-5 sm:mb-0">
@@ -314,6 +322,7 @@ export default function SignUp() {
<div className="signin-area mb-1"> <div className="signin-area mb-1">
<div className="flex justify-center"> <div className="flex justify-center">
<button <button
disabled={countries.loading}
type="button" type="button"
onClick={handleSignUp} onClick={handleSignUp}
className={`rounded-[0.475rem] mb-6 text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center h-[42px] py-[0.8875rem] px-[1.81rem] text-[14.95px] btn-login`} className={`rounded-[0.475rem] mb-6 text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center h-[42px] py-[0.8875rem] px-[1.81rem] text-[14.95px] btn-login`}
@@ -341,6 +350,7 @@ const SelectOption = ({
inputHandler, inputHandler,
value, value,
data, // passing the data from parent data, // passing the data from parent
disable
}) => { }) => {
return ( return (
<div className="input-com mb-7"> <div className="input-com mb-7">
@@ -354,6 +364,7 @@ const SelectOption = ({
</div> </div>
<div> <div>
<select <select
disabled={disable}
name={name} name={name}
id={name} id={name}
className="input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base focus-visible:border-transparent focus-visible:outline-0 focus-visible:ring-transparent " className="input-wrapper border border-[#f5f8fa] dark:border-[#5e6278] w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base focus-visible:border-transparent focus-visible:outline-0 focus-visible:ring-transparent "
@@ -64,6 +64,8 @@ const initialValues = {
}; };
function AddFundDollars(props) { function AddFundDollars(props) {
let MaxNoOfCards = process.env.REACT_APP_MAX_CREDIT_CARDS // HOLDS THE VALUE OF THE MAX NUMBER OF CARDS USER CAN ADD
const apiCall = new usersService(); const apiCall = new usersService();
let countryWallet = props.walletItem.country; let countryWallet = props.walletItem.country;
const [tab, setTab] = useState("previous"); const [tab, setTab] = useState("previous");
@@ -240,7 +242,7 @@ function AddFundDollars(props) {
<label <label
onClick={() => setTab("new")} onClick={() => setTab("new")}
htmlFor="new" htmlFor="new"
className="cursor-pointer flex items-center gap-1" className={`cursor-pointer flex items-center gap-1 ${payListCards.data.length >= MaxNoOfCards ? 'pointer-events-none':''}`}
> >
<input <input
id="new" id="new"
@@ -251,7 +253,7 @@ function AddFundDollars(props) {
tab == "new" ? "" : "" tab == "new" ? "" : ""
} tracking-wide transition duration-200`} } tracking-wide transition duration-200`}
/> />
Add New Card Add New Card {payListCards.data.length >= MaxNoOfCards && <span className="text-[14px] text-red-500">Max Reached</span>}
</label> </label>
</div> </div>
</form> </form>
@@ -314,6 +316,11 @@ function AddFundDollars(props) {
{tab === "new" && ( {tab === "new" && (
<div className="new-details w-full max-h-[22rem]"> <div className="new-details w-full max-h-[22rem]">
{payListCards.loading ?
<div className="pt-10 flex w-full h-full justify-center items-center">
<LoadingSpinner size='10' color='sky-blue' />
</div>
:payListCards.data.length < MaxNoOfCards ?
<div className="w-full flex flex-col justify-between"> <div className="w-full flex flex-col justify-between">
<Formik <Formik
initialValues={initialValues} initialValues={initialValues}
@@ -553,6 +560,9 @@ function AddFundDollars(props) {
}} }}
</Formik> </Formik>
</div> </div>
:
null
}
</div> </div>
)} )}
</div> </div>
@@ -12,6 +12,8 @@ function NairaWithdraw({
state, state,
setShowConfirmNairaWithdraw, setShowConfirmNairaWithdraw,
}) { }) {
let MaxNoOfBanks = process.env.REACT_APP_MAX_CREDIT_BANK_ACCOUNT // HOLDS THE VALUE OF THE MAX NUMBER OF BANKS USER CAN ADD
const apiCall = new usersService(); const apiCall = new usersService();
const [tab, setTab] = useState("previous"); const [tab, setTab] = useState("previous");
let [requestStatus, setRequestStatus] = useState(false); let [requestStatus, setRequestStatus] = useState(false);
@@ -422,7 +424,7 @@ function NairaWithdraw({
<label <label
onClick={() => setTab("new")} onClick={() => setTab("new")}
htmlFor="new" htmlFor="new"
className="cursor-pointer flex items-center gap-1" className={`cursor-pointer flex items-center gap-1 ${recipients.data.length >= MaxNoOfBanks ? 'pointer-events-none':''}`}
> >
<input <input
id="new" id="new"
@@ -434,7 +436,7 @@ function NairaWithdraw({
tab == "new" ? "" : "" tab == "new" ? "" : ""
} tracking-wide transition duration-200`} } tracking-wide transition duration-200`}
/> />
New Account{" "} New Account{" "} {recipients.data.length >= MaxNoOfBanks && <span className="text-[14px] text-red-500">Max Reached</span>}
</label> </label>
</div> </div>
</div> </div>
@@ -522,6 +524,11 @@ function NairaWithdraw({
)} )}
{tab == "new" && ( {tab == "new" && (
recipients.loading ?
<div className="mt-3 flex flex-col w-full h-[188px] justify-center items-center">
<LoadingSpinner size='10' color='sky-blue' />
</div>
:recipients.data.length < MaxNoOfBanks ?
<div className="w-full mt-3 rounded-md bg-slate-100"> <div className="w-full mt-3 rounded-md bg-slate-100">
<div className="relative fields w-full flex flex-col p-4"> <div className="relative fields w-full flex flex-col p-4">
<div className="flex flex-[2] min-h-[52px]"> <div className="flex flex-[2] min-h-[52px]">
@@ -789,6 +796,8 @@ function NairaWithdraw({
{/* end of inputs for new accounts */} {/* end of inputs for new accounts */}
</div> </div>
</div> </div>
:
<div className="mt-3 flex w-full h-[188px] justify-center items-center"></div>
)} )}
</div> </div>