From 0c1db6b4b51bdf4078e8798d0473392a4df5bb92 Mon Sep 17 00:00:00 2001 From: Chief Bube Date: Tue, 7 Nov 2023 23:00:12 -0800 Subject: [PATCH 1/3] fixed svg typos --- src/components/AddJob/AddJob.jsx | 4 ++-- src/components/Blogs/index.jsx | 2 +- .../FamilyAcc/FamilyPopout/AssignTaskPopout.jsx | 2 +- .../FamilyAcc/FamilyPopout/forms/NewTasks.jsx | 2 +- src/components/Helpers/Icons.jsx | 6 +++--- src/components/MyJobs/MyJobTable.jsx | 2 +- src/components/MyTasks/MyJobTable.jsx | 2 +- .../MyWallet/Popup/ConfirmNairaWithdraw.jsx | 12 ++++++------ 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/components/AddJob/AddJob.jsx b/src/components/AddJob/AddJob.jsx index a994dd7..d13ddf2 100644 --- a/src/components/AddJob/AddJob.jsx +++ b/src/components/AddJob/AddJob.jsx @@ -167,7 +167,7 @@ function AddJob({ popUpHandler, categories }) { onChange={props.handleChange} onBlur={props.handleBlur} > - {walletDetails.loading ? ( + {walletDetails?.loading ? ( @@ -400,7 +400,7 @@ function AddJob({ popUpHandler, categories }) { - {requestStatus.loading ? ( + {requestStatus?.loading ? ( ) : ( - {familyTask.loading ? ( + {familyTask?.loading ? (
diff --git a/src/components/FamilyAcc/FamilyPopout/forms/NewTasks.jsx b/src/components/FamilyAcc/FamilyPopout/forms/NewTasks.jsx index 5c2b0fa..26341f5 100644 --- a/src/components/FamilyAcc/FamilyPopout/forms/NewTasks.jsx +++ b/src/components/FamilyAcc/FamilyPopout/forms/NewTasks.jsx @@ -69,7 +69,7 @@ export default function NewTasks({ formState, setFormState }) { onChange={handleInputChange} // onBlur={props.handleBlur} > - {currency.loading ? ( + {currency?.loading ? ( diff --git a/src/components/Helpers/Icons.jsx b/src/components/Helpers/Icons.jsx index bb54399..2b2fb0c 100644 --- a/src/components/Helpers/Icons.jsx +++ b/src/components/Helpers/Icons.jsx @@ -478,13 +478,13 @@ export default function Icons({ name }) { xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" - stroke-width="1.5" + strokeWidth="1.5" stroke="currentColor" className="w-4 h-4" > diff --git a/src/components/MyJobs/MyJobTable.jsx b/src/components/MyJobs/MyJobTable.jsx index 235b984..53789cf 100644 --- a/src/components/MyJobs/MyJobTable.jsx +++ b/src/components/MyJobs/MyJobTable.jsx @@ -220,7 +220,7 @@ export default function MyJobTable({ MyJobList, reloadJobList, className }) { contentBodyClasses="w-auto min-w-max" /> - {MyJobList.loading ? ( + {MyJobList?.loading ? ( ) : (
diff --git a/src/components/MyTasks/MyJobTable.jsx b/src/components/MyTasks/MyJobTable.jsx index ac66111..4c23c5d 100644 --- a/src/components/MyTasks/MyJobTable.jsx +++ b/src/components/MyTasks/MyJobTable.jsx @@ -55,7 +55,7 @@ export default function MyJobTable({ className, ActiveJobList, Account }) { {!ActiveJobList?.data.length && accountType && (
)} - {ActiveJobList.loading ? + {ActiveJobList?.loading ?
diff --git a/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx b/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx index 7763e4b..eb0c4ed 100644 --- a/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx +++ b/src/components/MyWallet/Popup/ConfirmNairaWithdraw.jsx @@ -170,9 +170,9 @@ function ConfirmNairaWithdraw({ viewBox="0 0 24 24" fill="none" stroke="green" - stroke-width="2" - stroke-linecap="round" - stroke-linejoin="round" + strokeWidth="2" + strokeLinecap="round" + strokeLinejoin="round" className="feather feather-check-circle" > @@ -186,9 +186,9 @@ function ConfirmNairaWithdraw({ width="100" height="100" stroke="red" - stroke-width="2" - stroke-linecap="round" - stroke-linejoin="round" + strokeWidth="2" + strokeLinecap="round" + strokeLinejoin="round" className="feather feather-x-circle" > From 7e926cc7bc8c828e05cf1aec80d2fdc7f2e80e8d Mon Sep 17 00:00:00 2001 From: Chief Bube Date: Wed, 8 Nov 2023 10:42:54 -0800 Subject: [PATCH 2/3] added family image --- src/components/AuthPages/Login/index.jsx | 89 +++++++++++++----------- src/components/Partials/Header.jsx | 14 +++- 2 files changed, 60 insertions(+), 43 deletions(-) diff --git a/src/components/AuthPages/Login/index.jsx b/src/components/AuthPages/Login/index.jsx index 4f1f10b..424e10a 100644 --- a/src/components/AuthPages/Login/index.jsx +++ b/src/components/AuthPages/Login/index.jsx @@ -17,14 +17,14 @@ import { updateUserDetails } from "../../../store/UserDetails"; import ReCAPTCHA from "react-google-recaptcha"; export default function Login() { - + // eslint-disable-next-line no-restricted-globals const queryParams = new URLSearchParams(location?.search); - const sessionExpired = queryParams.get("sessionExpired") + const sessionExpired = queryParams.get("sessionExpired"); const dispatch = useDispatch(); const { state } = useLocation(); - const [validCaptcha, setValidCaptcha] = useState({show: false, valid:''}); // FOR CAPTCHA + const [validCaptcha, setValidCaptcha] = useState({ show: false, valid: "" }); // FOR CAPTCHA let [loginType, setLoginType] = useState(""); @@ -115,7 +115,8 @@ export default function Login() { }, Number(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT)); return; } - if(name == "full" && !validCaptcha.valid && validCaptcha.show){ // RUNS AND DISPLAYS CAPTCHA, IF ERROR OCCURED DURING LOGIN FOR FULL LOGIN ALONE + if (name == "full" && !validCaptcha.valid && validCaptcha.show) { + // RUNS AND DISPLAYS CAPTCHA, IF ERROR OCCURED DURING LOGIN FOR FULL LOGIN ALONE setMsgError("Please Verify Captcha"); setLoginLoading(false); setTimeout(() => { @@ -136,12 +137,15 @@ export default function Login() { // setMsgError("Wrong, email/password"); setLoginError(true); setLoginLoading(false); - setValidCaptcha(prev => ({...prev, show:true})) // DISPLAYS CAPTCHA IF ERROR + setValidCaptcha((prev) => ({ ...prev, show: true })); // DISPLAYS CAPTCHA IF ERROR return; } localStorage.setItem("member_id", `${res.data.member_id}`); localStorage.setItem("uid", `${res.data.uid}`); localStorage.setItem("session_token", `${res.data.session}`); + if (name === "family") { + sessionStorage.setItem("family_uid", res.data?.family_uid); + } // localStorage.setItem("session", `${res.data.session}`); dispatch(updateUserDetails({ ...res.data })); setTimeout(() => { @@ -152,7 +156,7 @@ export default function Login() { .catch((error) => { setMsgError("Unable to login, try again"); setLoginLoading(false); - setValidCaptcha(prev => ({...prev, show:true})) // DISPLAYS CAPTCHA IF ERROR + setValidCaptcha((prev) => ({ ...prev, show: true })); // DISPLAYS CAPTCHA IF ERROR }) .finally(() => { setTimeout(() => { @@ -163,11 +167,12 @@ export default function Login() { }); }; - function captchaChecker(value) { // FUNCTION TO VALIDATE CAPTCHA - if(value){ - setValidCaptcha({show: true, valid:value}) - }else{ - setValidCaptcha({show: true, valid:''}) + function captchaChecker(value) { + // FUNCTION TO VALIDATE CAPTCHA + if (value) { + setValidCaptcha({ show: true, valid: value }); + } else { + setValidCaptcha({ show: true, valid: "" }); } } @@ -245,31 +250,32 @@ export default function Login() {
- {/* HIDES THIS IF USER SESSION HAS EXPIRED */} - {sessionExpired != 'true' && -
- {/*

+ {sessionExpired != "true" && ( +
+ {/*

Sign In to WrenchBoard

*/} - - New Here?{" "} - - Create an Account - - -
- } - + + New Here?{" "} + + Create an Account + + +

+ )} + {/* SHOWS THIS IF USER SESSION HAS EXPIRED */} - {sessionExpired == 'true' && -
-

Your session expired and will need to login again

-
- } + {sessionExpired == "true" && ( +
+

+ Your session expired and will need to login again +

+
+ )} {/* switch login component */}
@@ -335,14 +341,16 @@ export default function Login() {
{/* hCaptha clone for the time being */} - {validCaptcha.show && -
- + -
- } +
+ )} {loginError && (
@@ -499,7 +507,8 @@ export default function Login() { {loginType == "full" && (
- This site is protected by a Captcha. Our Privacy Policy and Terms of Service apply. + This site is protected by a Captcha. Our Privacy Policy and + Terms of Service apply.
)}
diff --git a/src/components/Partials/Header.jsx b/src/components/Partials/Header.jsx index 12acd09..1ec941f 100644 --- a/src/components/Partials/Header.jsx +++ b/src/components/Partials/Header.jsx @@ -37,11 +37,17 @@ export default function Header({ logoutModalHandler, sidebarHandler }) { const { walletDetails } = useSelector((state) => state?.walletDetails); // WALLET STORE const image = localStorage.getItem("session_token") - ? `${userDetails.session_image_server}${localStorage.getItem( - "session_token" - )}/profile/${userDetails.uid}` + ? userDetails.account_type === "FAMILY" + ? `${userDetails.session_image_server}${localStorage.getItem( + "session_token" + )}/family/${sessionStorage.getItem("family_uid")}` + : `${userDetails.session_image_server}${localStorage.getItem( + "session_token" + )}/profile/${userDetails.uid}` : ""; + // 9308RDR122 + const handlerBalance = () => { setbalanceValue.toggle(); if (notificationDropdown) { @@ -99,6 +105,8 @@ export default function Header({ logoutModalHandler, sidebarHandler }) { let userEmail = email?.split("@")[0]; const userProfileImage = image || DEFAULT_PROFILE_IMAGE; + console.log(userDetails); + return ( <>
From 2c99fedd8c4e001a4c9f46e10d56e32d28251260 Mon Sep 17 00:00:00 2001 From: Chief Bube Date: Wed, 8 Nov 2023 10:58:42 -0800 Subject: [PATCH 3/3] removing session once user logs out or session expires --- src/components/Partials/Header.jsx | 2 -- src/components/Partials/Layout.jsx | 1 + src/middleware/AuthRoute.jsx | 15 ++++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/components/Partials/Header.jsx b/src/components/Partials/Header.jsx index 1ec941f..024e1b9 100644 --- a/src/components/Partials/Header.jsx +++ b/src/components/Partials/Header.jsx @@ -105,8 +105,6 @@ export default function Header({ logoutModalHandler, sidebarHandler }) { let userEmail = email?.split("@")[0]; const userProfileImage = image || DEFAULT_PROFILE_IMAGE; - console.log(userDetails); - return ( <>
diff --git a/src/components/Partials/Layout.jsx b/src/components/Partials/Layout.jsx index 1b6e44f..f7963b2 100644 --- a/src/components/Partials/Layout.jsx +++ b/src/components/Partials/Layout.jsx @@ -23,6 +23,7 @@ export default function Layout({ children }) { localStorage.removeItem("session_token"); localStorage.removeItem("member_id"); localStorage.removeItem("uid"); + sessionStorage.removeItem("family_uid"); // localStorage.clear(); // toast.success("Come Back Soon", { // icon: `🙂`, diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index 4444e99..cc31cf7 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -21,10 +21,12 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { const [loadProfileDetails, setLoadProfileDetails] = useState([]); const navigate = useNavigate(); - const { jobListTable, walletTable } = useSelector((state) => state.tableReload); + const { jobListTable, walletTable } = useSelector( + (state) => state.tableReload + ); const { - userDetails: { username, uid, session }, + userDetails: { username, uid, session}, } = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active let loggedIn = username && session && uid ? true : false; // variable to determine if user is logged in @@ -35,6 +37,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { localStorage.removeItem("uid"); localStorage.removeItem("member_id"); localStorage.removeItem("session_token"); + sessionStorage.removeItem("family_uid"); navigate("/login", { replace: true }); // redirects user to login page after session expires }; @@ -181,13 +184,15 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { useEffect(() => { const getMyWalletList = async () => { - dispatch(updateWalletDetails({ loading: true, data:[] })); + dispatch(updateWalletDetails({ loading: true, data: [] })); try { const res = await apiCall.getUserWallets(); console.log("wallet - >", res.data); - dispatch(updateWalletDetails({ loading: false, data:res.data?.result_list })); + dispatch( + updateWalletDetails({ loading: false, data: res.data?.result_list }) + ); } catch (error) { - dispatch(updateWalletDetails({ loading: false, data:[] })); + dispatch(updateWalletDetails({ loading: false, data: [] })); console.log("Error getting mode"); } };