Compare commits

..

67 Commits

Author SHA1 Message Date
victorAnumudu 0f8ef167bb Merge master into notifications 2023-07-22 23:15:30 +01:00
victorAnumudu aa6e3f4b94 notification bug fixed 2023-07-22 23:12:29 +01:00
ameye 68beda891b Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-22 21:20:55 +00:00
Ebube 61bef08a24 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-22 20:53:04 +01:00
Ebube a6409a037f ConfirmNairaWithdraw layout, payload adjustment and other style fixes 2023-07-22 20:52:39 +01:00
ameye f3ab8241a3 Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-22 11:27:18 +00:00
Ebube f3defdca85 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-22 12:23:41 +01:00
Ebube f3b1a42819 Bug Fixes..Notification load, Withdraw css fix 2023-07-22 12:23:14 +01:00
ameye e65d538709 Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-21 10:48:59 +00:00
Ebube 98aef302de Updated Layout for Withdraw Pop UP 2023-07-21 11:45:42 +01:00
ameye b3bbf11f0a Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-20 19:43:23 +00:00
Ebube 973517215f Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-20 20:25:32 +01:00
Ebube a3782e2dfc Added Notification and Started Wallet Withdraw 2023-07-20 20:24:54 +01:00
CHIEFSOFT\ameye 25830d5bf3 Resolve conflict 2023-07-20 06:25:51 -04:00
CHIEFSOFT\ameye 1615a7ac8a Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench
# Conflicts:
#	src/middleware/AuthRoute.jsx
2023-07-20 06:24:49 -04:00
CHIEFSOFT\ameye 232211a297 home recent 2023-07-20 06:18:56 -04:00
ameye eda3d76d4c Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-20 10:17:46 +00:00
Ebube 87f1a1e3e8 Notification for header 2023-07-20 10:22:10 +01:00
ameye 5257f89acb Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-18 20:20:31 +00:00
Ebube d4cf7419bf . 2023-07-18 20:28:30 +01:00
Ebube 1ffb732bfa . 2023-07-18 19:47:23 +01:00
Ebube 9007463f6d Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-18 19:00:21 +01:00
CHIEFSOFT\ameye a4b6b9e493 notification icons 2023-07-18 11:00:40 -04:00
CHIEFSOFT\ameye ccf820da7c bank icon 2023-07-18 07:52:58 -04:00
Ebube 7c51896bbf Wallet update 2023-07-18 10:38:58 +01:00
ameye aa80bab930 Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-17 23:30:44 +00:00
Ebube 1704fc60b4 removed hidden abilities for cvv 2023-07-18 00:20:15 +01:00
ameye c3e6c90c49 Merge branch 'collapse-icon' of WrenchBoard/Users-Wrench into master 2023-07-17 19:57:36 +00:00
victorAnumudu 1a65b1daa3 collapse-icon fixed, family icon fixed 2023-07-17 19:21:43 +01:00
ameye ba2c009896 Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-17 17:03:29 +00:00
Ebube bc2b71ecda Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-17 17:47:31 +01:00
Ebube 1d315018a4 Added error msg for card and updated password text display 2023-07-17 17:47:03 +01:00
CHIEFSOFT\ameye 56f8b75525 wrong end point on production - Ebubes error 2023-07-17 12:12:14 -04:00
Ebube 59531df377 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-17 17:03:39 +01:00
Ebube 06a7386211 another fix 2023-07-17 17:00:59 +01:00
Ebube 4bb3a11261 correction to .env production 2023-07-17 16:22:25 +01:00
Ebube f308eeca8d Corrections made on AddFund and text variable for Header 2023-07-17 16:20:57 +01:00
ameye 8e562ed1a5 Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-17 15:07:58 +00:00
Ebube 23dd7571a3 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-17 15:52:53 +01:00
Ebube 8530b2d1a0 Digits Fixed and SignOut text variable 2023-07-17 15:52:28 +01:00
ameye acdbddbc79 Merge branch 'family-icon' of WrenchBoard/Users-Wrench into master 2023-07-17 14:48:17 +00:00
victorAnumudu 15fc5f4f14 family icon added 2023-07-17 15:31:39 +01:00
ameye 2ba3b01646 Merge branch 'resource-question-page' of WrenchBoard/Users-Wrench into master 2023-07-17 12:50:09 +00:00
ameye 4e960a2f53 Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-17 12:49:59 +00:00
victorAnumudu ab700edcf2 resources question page added 2023-07-17 13:42:21 +01:00
Ebube 42e80c7a11 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-17 12:59:32 +01:00
Ebube d4472a881a Fixed digits 2023-07-17 12:59:05 +01:00
Ebube 5d12ab4f62 Made a few changes 2023-07-17 11:48:03 +01:00
ameye 8b3c586456 Merge branch 'withdrwal-popup' of WrenchBoard/Users-Wrench into master 2023-07-17 10:38:48 +00:00
ameye e456b55e16 Merge branch 'my_wallet_layout' of WrenchBoard/Users-Wrench into master 2023-07-17 10:38:41 +00:00
Ebube 89c5936212 Some fixes 2023-07-17 11:29:50 +01:00
victorAnumudu 7bedf76945 made confirm withdrawal a pop up 2023-07-17 11:07:11 +01:00
Ebube 54bf020c55 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into my_wallet_layout 2023-07-17 11:04:59 +01:00
Ebube 78145eee77 Paying using new card 2023-07-17 11:04:31 +01:00
victorAnumudu d75b6ee26c made withdrawal a pop up 2023-07-17 11:03:27 +01:00
ameye bf5c9d4671 Merge branch 'profile-bug' of WrenchBoard/Users-Wrench into master 2023-07-17 08:06:43 +00:00
victorAnumudu d2db38ba21 profile bug fixed 2023-07-17 02:01:37 +01:00
ameye eecbca6b0e Merge branch 'withdraw-page' of WrenchBoard/Users-Wrench into master 2023-07-17 00:33:24 +00:00
victorAnumudu dd1430a350 confirm naira withdrawal added 2023-07-17 01:22:12 +01:00
victorAnumudu 0eca0c52ce withdraw page added 2023-07-17 01:15:16 +01:00
ameye c2c7ad7bb4 Merge branch 'family-start-task-layout' of WrenchBoard/Users-Wrench into master 2023-07-16 23:09:30 +00:00
victorAnumudu 98ccbce4c0 family start task layout changed 2023-07-16 23:38:25 +01:00
ameye 6484640e1a Merge branch 'assign-task-layout' of WrenchBoard/Users-Wrench into master 2023-07-16 22:28:28 +00:00
ameye fa4fe35bdf Merge branch 'assign-task-bug-fixed' of WrenchBoard/Users-Wrench into master 2023-07-16 21:31:23 +00:00
victorAnumudu c106e66f44 assign task bug fixed 2023-07-16 22:13:47 +01:00
Ebube fb7913c563 Another fix 2023-07-16 01:36:27 +01:00
Ebube feb301c3c0 . 2023-07-16 01:08:37 +01:00
50 changed files with 2839 additions and 2594 deletions
+2
View File
@@ -68,6 +68,8 @@ REACT_APP_APPLE_REDIRECT_URL='http://localhost:9082/login/auth/apple'
REACT_APP_MAX_FILE_SIZE=1000000
REACT_APP_TOTAL_NUM_FILE=4
REACT_APP_LOGOUT_TEXT="Sign Out"
#apigate.lotus.g1.wrenchboard.com:76.209.103.227
#apigate.orion.g1.wrenchboard.com:76.209.103.227
+3 -1
View File
@@ -41,4 +41,6 @@ REACT_APP_GOOGLE_CLIENT_SCOPE="https://www.googleapis.com/auth/plus.login https:
REACT_APP_GOOGLE_REDIRECT_URL=http://localhost:9082/login/auth/
REACT_APP_MAX_FILE_SIZE=1000000
REACT_APP_TOTAL_NUM_FILE=4
REACT_APP_TOTAL_NUM_FILE=4
REACT_APP_LOGOUT_TEXT="Sign Out"
+3 -1
View File
@@ -48,4 +48,6 @@ REACT_APP_FACEBOOK_REDIRECT_URL="https://users.wrenchboard.com/login/auth/flogin
DISABLE_ESLINT_PLUGIN=true
REACT_APP_MAX_FILE_SIZE=1000000
REACT_APP_TOTAL_NUM_FILE=4
REACT_APP_TOTAL_NUM_FILE=4
REACT_APP_LOGOUT_TEXT="Sign Out"
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1792 1792" id="Bank"><path d="m896 78.526 896 358.4v119.466h-119.467q0 24.267-19.133 42-19.133 17.734-45.267 17.734H183.867q-26.134 0-45.267-17.734-19.133-17.733-19.133-42H0V436.926ZM238.933 675.859h238.934v716.8h119.466v-716.8h238.934v716.8h119.466v-716.8h238.934v716.8h119.466v-716.8h238.934v716.8h55.066q26.134 0 45.267 17.733 19.133 17.734 19.133 42v59.734H119.467v-59.734q0-24.266 19.133-42 19.133-17.733 45.267-17.733h55.066v-716.8zm1488.667 896q26.133 0 45.267 17.733 19.133 17.734 19.133 42v119.467H0v-119.467q0-24.266 19.133-42 19.134-17.733 45.267-17.733h1663.2z" fill="#4687ba" class="color000000 svgShape"></path></svg>

After

Width:  |  Height:  |  Size: 684 B

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 128 128" viewBox="0 0 128 128" id="Alert"><path fill="#f34093" d="M122.9,100.2L74.3,15.9c-4.6-7.9-16-7.9-20.6,0L5.1,100.2C0.5,108.1,6.2,118,15.4,118h97.3
C121.8,118,127.5,108.1,122.9,100.2z M63.9,101c-3.5-0.1-6.7-3.3-6.6-6.8c0.1-3.5,3.3-6.7,6.8-6.6c3.5,0.1,6.7,3.3,6.6,6.8
C70.6,98,67.4,101.1,63.9,101z M71.3,51.8c-0.7,7.8-1.5,15.6-2.3,23.4c-0.5,4.4-3.2,6.1-7.3,4.5c-1-0.4-2-2-2.2-3.2
C58.6,70,58,63.4,57.3,56.8c-0.3-2.8-0.5-5.6-0.8-8.5c-0.4-3.3,0.6-4.5,4-4.5c1.1,0,2.3,0,3.4,0C72,43.8,72,43.8,71.3,51.8z" class="color343433 svgShape"></path></svg>

After

Width:  |  Height:  |  Size: 621 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" id="Messages"><path fill="#4687ba" d="m447.372 413.112-17.544-52.629c-1-3.002-.674-6.23.775-9.043 13.184-25.615 18.629-55.858 12.925-87.736-8.746-48.868-44.53-89.475-90.943-105.048 11.976 28.924 15.628 61.084 9.645 92.984-12.155 64.837-64.074 116.246-129.191 127.924-8.429 1.512-16.945 2.248-25.396 2.463 19.776 21.336 46.173 36.503 75.619 41.784 31.682 5.682 61.784.393 87.322-12.594 2.802-1.425 6.007-1.742 8.99-.748l52.83 17.61c9.251 3.084 18.052-5.716 14.968-14.967z" class="color173042 svgShape"></path><path fill="#4687ba" d="M177.161 85.744C122.283 95.941 78.306 140.526 68.472 195.47c-5.704 31.878-.259 62.121 12.925 87.736 1.449 2.813 1.775 6.041.776 9.043l-17.545 52.629c-3.083 9.251 5.717 18.051 14.968 14.968l52.83-17.61c2.984-.994 6.19-.677 8.991.748 25.537 12.987 55.638 18.276 87.321 12.594 54.809-9.829 99.281-53.698 109.541-108.428 18.078-96.414-64.733-179.316-161.118-161.406zm34.938 177.536h-68.234c-6.73 0-12.185-5.454-12.185-12.185 0-6.73 5.455-12.185 12.185-12.185h68.234c6.731 0 12.185 5.455 12.185 12.185 0 6.731-5.454 12.185-12.185 12.185zm48.739-48.739H143.864c-6.73 0-12.185-5.454-12.185-12.185 0-6.73 5.455-12.185 12.185-12.185h116.973c6.731 0 12.185 5.455 12.185 12.185.001 6.731-5.453 12.185-12.184 12.185z" class="color173042 svgShape"></path></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" id="phone" x="0" y="0" version="1.1" viewBox="0 0 29 29" xml:space="preserve"><path d="M5.661 23.339c4.882 4.882 12.796 4.882 17.678 0 4.882-4.882 4.882-12.796 0-17.678s-12.796-4.882-17.678 0C.78 10.543.78 18.457 5.661 23.339zm5.545-16.613l1.86 1.86c.372.372.451.947.193 1.406l-.699 1.241a.781.781 0 0 0 .129.937l4.141 4.141a.781.781 0 0 0 .937.128l1.241-.699a1.173 1.173 0 0 1 1.406.193l1.861 1.861a1.175 1.175 0 0 1 0 1.66l-.881.881a3.135 3.135 0 0 1-3.786.493l-.084-.048a24.54 24.54 0 0 1-8.868-8.681l-.423-.706a3.128 3.128 0 0 1 .469-3.823l.844-.844a1.173 1.173 0 0 1 1.66 0z" fill="#4687ba" class="color000000 svgShape"></path></svg>

After

Width:  |  Height:  |  Size: 678 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.2" viewBox="0 0 512 512" id="Sms"><circle cx="256" cy="256" r="256" fill="#4687ba" class="color00aebb svgShape"></circle><path fill="#ffffff" d="M256 129.3c-88.4 0-160 52-160 116.2 0 26.6 12.3 51.1 33 70.7-11.6 26.2-22.6 66.2-22.6 66.2 6.1 3.1 60.9-23.9 78.4-32.8 21.4 7.7 45.6 12.1 71.2 12.1 88.4 0 160-52 160-116.2s-71.6-116.2-160-116.2zm-59.2 148.9c-5.2 3.8-12 5.7-20.4 5.7-8.3 0-15.4-2.1-21.4-6.2-6-4.1-8.8-10.3-8.7-18.5l.1-.3h15c0 4.6 1.3 7.9 4 10.1 2.7 2.2 6.3 3.2 10.9 3.2 4.1 0 7.3-.9 9.5-2.6 2.2-1.7 3.3-4 3.3-6.9 0-3-1-5.3-3.1-7.1-2.1-1.8-5.7-3.5-10.9-5.1-8.9-2.7-15.6-5.8-20.3-9.5-4.6-3.6-6.9-8.6-6.9-14.9 0-6.3 2.6-11.5 7.8-15.5 5.2-4 11.8-6 19.9-6 8.5 0 15.4 2.2 20.6 6.5 5.2 4.3 7.7 10 7.5 16.9l-.1.3h-15c0-3.8-1.2-6.8-3.5-8.9-2.3-2.1-5.6-3.1-9.8-3.1-3.8 0-6.8.9-8.8 2.8-2.1 1.8-3.1 4.2-3.1 7 0 2.6 1.1 4.8 3.4 6.4 2.3 1.7 6.2 3.5 11.7 5.3 8.5 2.4 14.9 5.5 19.4 9.4 4.4 3.9 6.7 9 6.7 15.3-.1 6.7-2.7 11.9-7.8 15.7zm99.3 4.7h-15.5v-52.6l-.3-.1-19.1 52.7h-10.5l-19.1-52.8-.3.1v52.7h-15.5v-77.1h20.3l19.6 56.8h.3l19.8-56.8H296v77.1zm62.1-4.7c-5.2 3.8-12 5.7-20.4 5.7-8.3 0-15.4-2.1-21.4-6.2-5.9-4.1-8.8-10.3-8.7-18.5l.1-.3h15c0 4.6 1.3 7.9 4 10.1 2.7 2.2 6.3 3.2 10.9 3.2 4.1 0 7.3-.9 9.5-2.6 2.2-1.7 3.3-4 3.3-6.9 0-3-1-5.3-3.1-7.1-2.1-1.8-5.7-3.5-10.9-5.1-8.9-2.7-15.7-5.8-20.3-9.5-4.6-3.6-6.9-8.6-6.9-14.9 0-6.3 2.6-11.5 7.8-15.5 5.2-4 11.8-6 19.9-6 8.5 0 15.4 2.2 20.6 6.5 5.2 4.3 7.7 10 7.5 16.9l-.1.3h-15c0-3.8-1.2-6.8-3.5-8.9-2.3-2.1-5.6-3.1-9.8-3.1-3.8 0-6.8.9-8.8 2.8-2.1 1.8-3.1 4.2-3.1 7 0 2.6 1.1 4.8 3.4 6.4 2.3 1.7 6.2 3.5 11.7 5.3 8.5 2.4 14.9 5.5 19.4 9.4 4.4 3.9 6.7 9 6.7 15.3-.1 6.7-2.6 11.9-7.8 15.7z" class="colorffffff svgShape"></path></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

+95 -91
View File
@@ -1,5 +1,5 @@
import React, { useEffect, useLayoutEffect, useState } from "react";
import { Link, useNavigate, useLocation } from "react-router-dom";
import { Link, useLocation, useNavigate } from "react-router-dom";
import linkedInLogo from "../../../assets/images/Linkedin.png";
import appleLogo from "../../../assets/images/apple-black.svg";
import facebookLogo from "../../../assets/images/facebook-4.svg";
@@ -9,18 +9,17 @@ import usersService from "../../../services/UsersService";
import InputCom from "../../Helpers/Inputs/InputCom";
import AuthLayout from "../AuthLayout";
// import { GoogleOAuthProvider } from '@react-oauth/google';
import { googleLogout, useGoogleLogin } from "@react-oauth/google";
import { useGoogleLogin } from "@react-oauth/google";
import { useDispatch } from "react-redux";
import { updateUserDetails } from "../../../store/UserDetails";
export default function Login() {
const dispatch = useDispatch();
const {state} = useLocation()
const { state } = useLocation();
let [loginType, setLoginType] = useState('');
let [loginType, setLoginType] = useState("");
const [checked, setValue] = useState(false);
const [loginLoading, setLoginLoading] = useState(false);
const [showPassword, setShowPassword] = useState(false);
@@ -30,12 +29,8 @@ export default function Login() {
// for the catch error
const [msgError, setMsgError] = useState("");
const rememberMe = () => {
setValue(!checked);
};
// To Show and Hide Password
const togglePasswordVisibility = () => {
// To Show and Hide Password
const togglePasswordVisibility = () => {
setShowPassword(!showPassword);
};
@@ -43,7 +38,7 @@ export default function Login() {
const handleLoginType = ({ target: { name } }) => {
setLoginType(name);
let currentDate = new Date();
let expirationDate = new Date(currentDate.getTime() + (24 * 60 * 60 * 1000));
let expirationDate = new Date(currentDate.getTime() + 24 * 60 * 60 * 1000);
// Convert the expiration date to the appropriate format
let expirationDateString = expirationDate.toUTCString();
document.cookie = `loginType=${name}; expires=${expirationDateString}; path=/;`;
@@ -83,7 +78,9 @@ export default function Login() {
if (regEx.test(email) == false) {
setLoginLoading(false);
setMsgError("Invalid Email");
return setTimeout(()=>{setMsgError("");},3000)
return setTimeout(() => {
setMsgError("");
}, 3000);
}
// Post Data Info for normal Login
postData = {
@@ -113,7 +110,13 @@ export default function Login() {
userApi
.logInUser(postData)
.then((res) => {
if (res.status != 200 || res.data.internal_return < 0 || !res.data.member_id || !res.data.uid || !res.data.session) {
if (
res.status != 200 ||
res.data.internal_return < 0 ||
!res.data.member_id ||
!res.data.uid ||
!res.data.session
) {
// setMsgError("Wrong, email/password");
setLoginError(true);
setLoginLoading(false);
@@ -123,7 +126,7 @@ export default function Login() {
localStorage.setItem("uid", `${res.data.uid}`);
localStorage.setItem("session_token", `${res.data.session}`);
// localStorage.setItem("session", `${res.data.session}`);
dispatch(updateUserDetails({...res.data}));
dispatch(updateUserDetails({ ...res.data }));
setTimeout(() => {
navigate("/", { replace: true });
setLoginLoading(false);
@@ -154,11 +157,12 @@ export default function Login() {
// In order to update the selected login type whenever the component renders
// useEffect(() => {
// Clear the loginType cookie if the user switches to loginfull
// document.cookie ="loginType=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
// Clear the loginType cookie if the user switches to loginfull
// document.cookie ="loginType=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
// }, []);
useLayoutEffect(()=>{ // checks the cookie in order to set the login type before components mounts
useLayoutEffect(() => {
// checks the cookie in order to set the login type before components mounts
// if(document.cookie.includes("loginType=family")){
// setLoginType('family')
// }else if(document.cookie.includes("loginType=full")){
@@ -166,33 +170,34 @@ export default function Login() {
// }else{
// setLoginType('full')
// }
function readCookie(cname) { // checks the cookie in order to set the login type before components mounts
function readCookie(cname) {
// checks the cookie in order to set the login type before components mounts
let name = cname + "=";
let decoded_cookie = decodeURIComponent(document.cookie);
let carr = decoded_cookie.split(';');
for(let i=0; i<carr.length;i++){
let carr = decoded_cookie.split(";");
for (let i = 0; i < carr.length; i++) {
let c = carr[i];
while(c.charAt(0)==' '){
c=c.substring(1);
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if(c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return 'full'
return "full";
}
let loginValue = readCookie('loginType')
setLoginType(loginValue)
let loginValue = readCookie("loginType");
setLoginType(loginValue);
if(state?.error){ //check if the login path has an error state indicating any social handle login with error
if (state?.error) {
//check if the login path has an error state indicating any social handle login with error
setMsgError("Unexpected Error, Please try again soon.");
setTimeout(()=>{
setTimeout(() => {
setMsgError("");
navigate('/login', {replace: true})
},4000)
navigate("/login", { replace: true });
}, 4000);
}
},[])
}, []);
useEffect(() => {
setMail("");
@@ -234,7 +239,9 @@ export default function Login() {
<button
name="full"
className={`login-type-btn px-4 py-1 rounded-t-2xl ${
loginType=='full' ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
loginType == "full"
? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white"
: "bg-white text-[#000] border-t-[2px]"
}`}
onClick={handleLoginType}
>
@@ -243,7 +250,9 @@ export default function Login() {
<button
name="family"
className={`login-type-btn px-4 py-1 rounded-t-2xl ${
loginType=='family' ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
loginType == "family"
? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white"
: "bg-white text-[#000] border-t-[2px]"
}`}
onClick={handleLoginType}
>
@@ -255,7 +264,7 @@ export default function Login() {
{/* for login component */}
{
loginType == 'full' ? (
loginType == "full" ? (
//user login component
<div className="p-6 input-area login-area border-2 border-[#4687ba] rounded-2xl">
<div className="input-item mb-5">
@@ -275,8 +284,8 @@ export default function Login() {
<div className="input-item mb-5">
<InputCom
labelClass="tracking-wider"
fieldClass="sm:px-6 px-2"
value={password}
fieldClass="sm:px-6 px-2 tracking-[0.25em] text-2xl"
value={password.replace(/./g, "●")}
inputHandler={handlePassword}
placeholder="● ● ● ● ● ●"
label="Password"
@@ -321,33 +330,33 @@ export default function Login() {
</button>
</div>
<div className="sm:flex sm:justify-between sm:items-center sm:space-x-2">
<BrandBtn
link="#"
imgSrc={googleLogo}
brand="Google"
onClick={googleLogin}
/>
<BrandBtn
// link={`https://appleid.apple.com/auth/authorize?response_type=code&response_mode=form_post&client_id=${process.env.REACT_APP_APPLE_CLIENT_ID}&redirect_uri=https%3A%2F%2Fwork.wrenchboard.com%2Flogin%2Fauth%2Fapple&state=4b2c4456b7&scope=name+email`}
link={`https://appleid.apple.com/auth/authorize?response_type=code&response_mode=form_post&client_id=${process.env.REACT_APP_APPLE_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_APPLE_REDIRECT_URL}&state=4b2c4456b7&scope=name+email`}
imgSrc={appleLogo}
brand="Apple"
isAnchor={true}
/>
<BrandBtn
link="#"
imgSrc={googleLogo}
brand="Google"
onClick={googleLogin}
/>
<BrandBtn
// link={`https://appleid.apple.com/auth/authorize?response_type=code&response_mode=form_post&client_id=${process.env.REACT_APP_APPLE_CLIENT_ID}&redirect_uri=https%3A%2F%2Fwork.wrenchboard.com%2Flogin%2Fauth%2Fapple&state=4b2c4456b7&scope=name+email`}
link={`https://appleid.apple.com/auth/authorize?response_type=code&response_mode=form_post&client_id=${process.env.REACT_APP_APPLE_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_APPLE_REDIRECT_URL}&state=4b2c4456b7&scope=name+email`}
imgSrc={appleLogo}
brand="Apple"
isAnchor={true}
/>
</div>
<div className="sm:flex sm:justify-between sm:items-center sm:space-x-2">
<BrandBtn
link={`https://www.facebook.com/v14.0/dialog/oauth?client_id=${process.env.REACT_APP_FACEBOOK_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_FACEBOOK_REDIRECT_URL}&scope=${process.env.REACT_APP_FACEBOOK_CLIENT_SCOPE}`}
imgSrc={facebookLogo}
brand="Facebook"
isAnchor={true}
/>
<BrandBtn
// link="https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=comma-separated-list-of-scopes&state=YOUR_STATE_VALUE"
imgSrc={linkedInLogo}
brand="LinkedIn"
isAnchor={true}
/>
<BrandBtn
link={`https://www.facebook.com/v14.0/dialog/oauth?client_id=${process.env.REACT_APP_FACEBOOK_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_FACEBOOK_REDIRECT_URL}&scope=${process.env.REACT_APP_FACEBOOK_CLIENT_SCOPE}`}
imgSrc={facebookLogo}
brand="Facebook"
isAnchor={true}
/>
<BrandBtn
// link="https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=comma-separated-list-of-scopes&state=YOUR_STATE_VALUE"
imgSrc={linkedInLogo}
brand="LinkedIn"
isAnchor={true}
/>
</div>
</div>
</div>
@@ -435,7 +444,7 @@ export default function Login() {
);
}
const BrandBtn = ({ link, imgSrc, brand, onClick, isAnchor=false }) => {
const BrandBtn = ({ link, imgSrc, brand, onClick, isAnchor = false }) => {
// const doGoogle = async () => {
// alert("start google");
// };
@@ -456,33 +465,28 @@ const BrandBtn = ({ link, imgSrc, brand, onClick, isAnchor=false }) => {
// };
return (
<div className="w-full sm:w-1/2 flex justify-center bottomMargin">
{isAnchor ?
(
{isAnchor ? (
<a
href={link}
className="w-full border border-light-purple dark:border-[#5356fb29] rounded-[0.475rem] h-[48px] flex justify-center bg-[#FAFAFA] hover:bg-[#eff2f5] hover:text-[#7e8299] transition duration-300 dark:bg-[#11131F] items-center font-medium cursor-pointer"
>
<img className="mr-3 h-6" src={imgSrc} alt="logo-icon(s)" />
<span className="text-lg text-thin-light-gray font-normal text-[15px]">
Continue with {brand}
</span>
</a>
)
:
(
href={link}
className="w-full border border-light-purple dark:border-[#5356fb29] rounded-[0.475rem] h-[48px] flex justify-center bg-[#FAFAFA] hover:bg-[#eff2f5] hover:text-[#7e8299] transition duration-300 dark:bg-[#11131F] items-center font-medium cursor-pointer"
>
<img className="mr-3 h-6" src={imgSrc} alt="logo-icon(s)" />
<span className="text-lg text-thin-light-gray font-normal text-[15px]">
Continue with {brand}
</span>
</a>
) : (
<button
onClick={onClick}
// href="#dd"
className="w-full border border-light-purple dark:border-[#5356fb29] rounded-[0.475rem] h-[48px] flex justify-center bg-[#FAFAFA] hover:bg-[#eff2f5] hover:text-[#7e8299] transition duration-300 dark:bg-[#11131F] items-center font-medium cursor-pointer"
>
<img className="mr-3 h-6" src={imgSrc} alt="logo-icon(s)" />
<span className="text-lg text-thin-light-gray font-normal text-[15px]">
Continue with {brand}
</span>
</button>
)
}
onClick={onClick}
// href="#dd"
className="w-full border border-light-purple dark:border-[#5356fb29] rounded-[0.475rem] h-[48px] flex justify-center bg-[#FAFAFA] hover:bg-[#eff2f5] hover:text-[#7e8299] transition duration-300 dark:bg-[#11131F] items-center font-medium cursor-pointer"
>
<img className="mr-3 h-6" src={imgSrc} alt="logo-icon(s)" />
<span className="text-lg text-thin-light-gray font-normal text-[15px]">
Continue with {brand}
</span>
</button>
)}
</div>
)
);
};
+2 -2
View File
@@ -205,7 +205,7 @@ export default function SignUp() {
</div>
<div className="input-item mb-5">
<InputCom
fieldClass="px-6"
fieldClass="sm:px-6 px-2 tracking-[0.25em] text-2xl"
placeholder="● ● ● ● ● ●"
label="Password"
name="password"
@@ -214,7 +214,7 @@ export default function SignUp() {
passIcon={
showPassword ? "show-password" : "hide-password"
}
value={formData.password}
value={formData.password.replace(/./g, "●")}
inputHandler={handleInputChange}
/>
</div>
@@ -158,8 +158,8 @@ const SuccessfulComponent = ({
{/* INPUT */}
<div className="mb-5">
<InputCom
fieldClass="px-6"
value={password}
fieldClass="sm:px-6 px-2 tracking-[0.25em] text-2xl"
value={password?.replace(/./g, "●")}
inputHandler={handlePassword}
placeholder="● ● ● ● ● ●"
label="Password"
@@ -171,8 +171,8 @@ const SuccessfulComponent = ({
</div>
<div className="mb-5">
<InputCom
fieldClass="px-6"
value={confirmPassword}
fieldClass="sm:px-6 px-2 tracking-[0.25em] text-2xl"
value={confirmPassword?.replace(/./g, "●")}
inputHandler={handlePassword}
placeholder="● ● ● ● ● ●"
label="Confirm Password"
@@ -63,7 +63,7 @@ const AssignTaskPopout = React.memo(({ action, details, situation, familyDetail
// API PAYLOADS
job_id: activeTask.data?.job_id,
job_uid: activeTask.data?.job_uid,
family_uid: familyDetails.uid,
family_uid: familyDetails?.uid || details?.family_uid,
job_description: activeTask.data?.description,
assign_mode: 110011,
};
+5 -2
View File
@@ -6,6 +6,7 @@ import { handlePagingFunc } from "../Pagination/HandlePagination";
import PaginatedList from "../Pagination/PaginatedList";
import familyImage from '../../assets/images/no-family-side.png'
import localImgLoad from "../../lib/localImgLoad";
export default function FamilyTable({ className, familyList, loader, popUpHandler }) {
const navigate = useNavigate();
@@ -54,6 +55,7 @@ export default function FamilyTable({ className, familyList, loader, popUpHandle
last_login,
task_count,
family_uid,
banner
} = props;
let addedDate = added?.split(" ")[0];
let LoginDate = last_login?.split(" ")[0];
@@ -64,9 +66,10 @@ export default function FamilyTable({ className, familyList, loader, popUpHandle
>
<td className=" py-4">
<div className="flex space-x-2 items-center w-full">
<div className="w-full h-[60px] rounded-full overflow-hidden flex justify-center items-center flex-[0.1] min-w-[60px]">
<div className="w-[60px] h-[60px] rounded-full overflow-hidden flex justify-center items-center flex-[0.1]">
<img
src={dataImage1}
// src={dataImage1}
src={localImgLoad(`images/icons/${banner}`)}
alt="data"
className="w-full h-full"
/>
@@ -1,4 +1,6 @@
import React from "react";
import localImgLoad from "../../../lib/localImgLoad";
export default function ProfileInfo({
profileImg,
@@ -12,7 +14,7 @@ export default function ProfileInfo({
<div className="flex justify-center">
<div className="w-full relative">
<img
src={profileImg}
src={localImgLoad(`images/icons/${accountDetails.banner}`)}
alt=""
className="sm:w-[180px] sm:h-[180px] w-[120px] h-[120px] rounded-full overflow-hidden object-cover"
/>
+3 -3
View File
@@ -504,11 +504,11 @@ export default function Icons({ name }) {
></path>
</svg>
) : name === "atm-card" ? (
<img className="w-[20px]" src={ATMCard} alt="card" />
<img className="w-[30px]" src={ATMCard} alt="card" />
) : name === "visa-card" ? (
<img className="w-[20px]" src={VisaCard} alt="card" />
<img className="w-[30px]" src={VisaCard} alt="card" />
) : name === "master-card" ? (
<img className="w-[20px]" src={MasterCard} alt="card" />
<img className="w-[30px]" src={MasterCard} alt="card" />
) : name === "new-dashboard" ? (
<img className="w-[17px] h-[17px]" src={localImgLoad('images/icons/dashboard.svg')} alt="dashboard" />
) : name === "new-family" ? (
@@ -21,6 +21,9 @@ export default function InputCom({
blurHandler,
spanTag,
inputBg,
onInput,
maxLength = 30,
minLength = 0,
direction,
error,
}) {
@@ -29,13 +32,13 @@ export default function InputCom({
// for Min Length:
const minLengthValidation = () => {
const inputConfig = inputConfigs[inputRef?.current?.name]?.minLength;
return inputConfig || 0;
return inputConfig || minLength;
};
// for MaxLength
const maxLengthValidation = () => {
const inputConfig = inputConfigs[inputRef?.current?.name]?.maxLength;
return inputConfig || 30;
return inputConfig || maxLength;
};
// for Patterns
@@ -63,7 +66,9 @@ export default function InputCom({
</span>
)}
{/* displays error is any */}
{error && <span className="text-[12px] text-red-500 italic">{error}</span>}
{error && (
<span className="text-[12px] text-red-500 italic">{error}</span>
)}
</label>
)}
{forgotPassword && (
@@ -76,7 +81,11 @@ export default function InputCom({
)}
</div>
<div
className={`input-wrapper w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-base ${inputClass ? inputClass : "text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] border"}`}
className={`input-wrapper w-full rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-base ${
inputClass
? inputClass
: "text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] border"
}`}
>
<input
placeholder={placeholder}
@@ -88,6 +97,7 @@ export default function InputCom({
type={type}
id={name}
name={name}
onInput={onInput}
minLength={minLengthValidation()}
maxLength={maxLengthValidation()}
// pattern={inputPatterns()}
@@ -104,10 +114,7 @@ export default function InputCom({
</div>
)}
{passIcon && (
<div
className="absolute right-6 bottom-3 z-10"
onClick={onClick}
>
<div className="absolute right-6 bottom-3 z-10" onClick={onClick}>
<Icons name={passIcon} />
</div>
)}
@@ -128,7 +135,8 @@ const inputConfigs = {
amount: { minLength: 1, maxLength: 9, pattern: "[0-9]+" },
description: { minLength: 5, maxLength: 299 },
title: { minLength: 5, maxLength: 149 },
job_detail: { minLength: 4, maxLength: 1440 }
job_detail: { minLength: 4, maxLength: 1440 },
cardNum: { minLength: 4, maxLength: 19 },
};
/* Numbers Only: <input type="text" pattern="[0-9]*" /> strictly numbers
+36
View File
@@ -0,0 +1,36 @@
const TimeDifference = ({ time }) => {
const currentTime = new Date();
const providedTime = new Date(time);
const timeDifference = currentTime - providedTime; // Difference in milliseconds
const minutes = Math.floor(timeDifference / (1000 * 60));
const hours = Math.floor(timeDifference / (1000 * 60 * 60));
const days = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
const months = Math.floor(timeDifference / (1000 * 60 * 60 * 24 * 30));
if (minutes < 1) {
return "Just now";
} else if (minutes < 60) {
return `${minutes} ${minutes === 1 ? "minute" : "minutes"} ago`;
} else if (hours < 12) {
return `${hours} ${hours === 1 ? "hour" : "hours"} ago`;
} else if (hours < 24) {
return "Today";
} else if (days < 2) {
return "Tomorrow";
} else if (days < 7) {
return `${days} ${days === 1 ? "day" : "days"} ago`;
} else if (months < 1) {
const weeks = Math.floor(days / 7);
return `${weeks} ${weeks === 1 ? "week" : "weeks"} ago`;
} else if (months < 6) {
return `${months} ${months === 1 ? "month" : "months"} ago`;
}else if (months < 8) {
return `"More than 6 months ago"`;
} else {
return time?.split(" ")[0];
}
};
export default TimeDifference;
@@ -2,7 +2,7 @@ import { useRef, useState } from "react";
import OfferCard from "../Cards/OfferCard";
import Icons from "../Helpers/Icons";
import SliderCom from "../Helpers/SliderCom";
import OfferJobPopout from "../jobPopout/OfferJobPopout";
import FamilyOfferJobPopout from "../jobPopout/FamilyOfferJobPopout";
export default function MyOffersFamilyTable({ className, familyOffers }) {
let [offerPopout, setOfferPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW
@@ -127,7 +127,7 @@ export default function MyOffersFamilyTable({ className, familyOffers }) {
{/* Offer Job Popout */}
{offerPopout.show && (
<OfferJobPopout
<FamilyOfferJobPopout
details={offerPopout.data}
onClose={() => {
setOfferPopout({ show: false, data: {} });
+125 -111
View File
@@ -1,115 +1,129 @@
import React, {useState} from 'react'
import { Link } from 'react-router-dom'
import RecentActivityTable from './WalletComponent/RecentActivityTable'
import PurchasesTable from './WalletComponent/PurchasesTable'
import CouponTable from './WalletComponent/CouponTable'
import LoadingSpinner from '../Spinners/LoadingSpinner'
import { PriceFormatter } from '../Helpers/PriceFormatter'
import React from "react";
import { Link } from "react-router-dom";
import { PriceFormatter } from "../Helpers/PriceFormatter";
import LoadingSpinner from "../Spinners/LoadingSpinner";
function Balance({wallet, coupon}) {
return (
<div className="content-wrapper">
{/* heading */}
<div className="sm:flex justify-between items-center mb-6">
<div className="mb-5 sm:mb-0">
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
Wallet
</h1>
</div>
<div className="slider-btns flex space-x-4">
</div>
</div>
<div className='w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin'>
{/* WALLET SECTION */}
<div className="lg:w-4/4 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-full bg-white dark:bg-dark-white rounded-2xl shadow min-h-[520px]">
<div className='flex items-baseline justify-between'>
{/*<h2 className='text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Wallet</h2>*/}
{/*<p className='text-base text-slate-500 dark:text-white'>Add New Wallet</p>*/}
</div>
{/* wallet balance */}
{wallet.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
wallet.data.length ?
wallet.data.map((item, index)=> (
<div key={index} className="p-3 md:flex items-center flex-wrap my-3 border-t-2 border-slate-400 wallet-box">
<div className='text-slate-900 w-full md:w-1/2 flex space-x-3 items-start justify-start'>
<div className='balance-info bal-col1'>
<p className='py-2'></p>
<span className='text-xl text-dark-gray dark:text-white'><b>{item.description}</b></span>
<p className='text-base text-slate-500'>{item.symbol}</p>
</div>
<div className='balance-info'>
<p className='py-2'>Balance</p>
<span className='py-1 px-2 bg-green-100 text-green-500 rounded-lg flex flex-start gap-1'>{PriceFormatter(item.amount * 0.01, item.code)}</span>
</div>
<div className='balance-info'>
<p className='py-2'>Escrow</p>
<span className='py-1 px-2 bg-red-100 text-red-500 rounded-lg flex flex-start gap-1'>{PriceFormatter(item.escrow * 0.01, item.code)}</span>
</div>
</div>
<div className='w-full my-2 md:my-0 md:w-1/2 flex space-x-2 items-center justify-start md:justify-end'>
{
item.action_type != 'AC_AD_FD_ONLY' ?
<Link to='transfer-fund' className='px-2 py-1 flex items-center gap-2 user-balance cursor-pointer h-[48px] rounded-full relative bg-purple lg:text-xl text-lg font-bold text-white'>Transfer</Link>:''
}
<Link to='add-fund' state={{currency:item.description}} className='px-2 py-1 flex items-center gap-2 user-balance cursor-pointer h-[48px] rounded-full relative bg-green lg:text-xl text-lg font-bold text-white'>
<span className="">
<svg xmlns="http://www.w3.org/2000/svg" width="38"
height="38" viewBox="0 0 42 42" fill="none"><path
d="M21 0C16.8466 0 12.7865 1.23163 9.33303 3.53914C5.8796 5.84665 3.18798 9.1264 1.59854 12.9636C0.00909901 16.8009 -0.406771 21.0233 0.403518 25.0969C1.21381 29.1705 3.21386 32.9123 6.15077 35.8492C9.08767 38.7861 12.8295 40.7862 16.9031 41.5965C20.9767 42.4068 25.1991 41.9909 29.0364 40.4015C32.8736 38.812 36.1534 36.1204 38.4609 32.667C40.7684 29.2135 42 25.1534 42 21C41.994 15.4323 39.7796 10.0944 35.8426 6.15741C31.9056 2.22045 26.5677 0.00602189 21 0ZM28 22.75H22.75V28C22.75 28.4641 22.5656 28.9092 22.2374 29.2374C21.9093 29.5656 21.4641 29.75 21 29.75C20.5359 29.75 20.0908 29.5656 19.7626 29.2374C19.4344 28.9092 19.25 28.4641 19.25 28V22.75H14C13.5359 22.75 13.0908 22.5656 12.7626 22.2374C12.4344 21.9092 12.25 21.4641 12.25 21C12.25 20.5359 12.4344 20.0907 12.7626 19.7626C13.0908 19.4344 13.5359 19.25 14 19.25H19.25V14C19.25 13.5359 19.4344 13.0908 19.7626 12.7626C20.0908 12.4344 20.5359 12.25 21 12.25C21.4641 12.25 21.9093 12.4344 22.2374 12.7626C22.5656 13.0908 22.75 13.5359 22.75 14V19.25H28C28.4641 19.25 28.9093 19.4344 29.2374 19.7626C29.5656 20.0907 29.75 20.5359 29.75 21C29.75 21.4641 29.5656 21.9092 29.2374 22.2374C28.9093 22.5656 28.4641 22.75 28 22.75Z"
fill="white"></path>
</svg>
</span>
<span className='text-white'>Add Credit</span>
</Link>
</div>
</div>
))
:
wallet.error ?
(
<div className="md:flex items-center flex-wrap mt-3">
<p className='text-base'>Opps! An Error occurred, please try again</p>
</div>
)
:
(
<div className="md:flex items-center flex-wrap mt-3">
<p className='text-base'>No Wallets Found!</p>
</div>
)
}
{/* end of wallet balance */}
</div>
</div>
{/* END OF WALLET SECTION */}
</div>
{/*<div className='w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin'>*/}
{/* /!* COUPON SECTION *!/*/}
{/* <div className="lg:w-3/4 w-full mb-10 lg:mb-0">*/}
{/* <div className="wallet w-full md:p-8 p-4 h-full max-h-[500px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">*/}
{/* <h2 className='text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Coupons</h2>*/}
{/* {coupon.loading ?*/}
{/* <LoadingSpinner size='16' color='sky-blue' />*/}
{/* :*/}
{/* <CouponTable coupon={coupon} />*/}
{/* }*/}
{/* </div>*/}
{/* </div>*/}
{/* /!* END OF COUPON SECTION *!/*/}
{/*</div>*/}
function Balance({ wallet, coupon }) {
return (
<div className="content-wrapper">
{/* heading */}
<div className="sm:flex justify-between items-center mb-6">
<div className="mb-5 sm:mb-0">
<h1 className="text-26 font-bold text-dark-gray dark:text-white">
Wallet
</h1>
</div>
)
<div className="slider-btns flex space-x-4"></div>
</div>
<div className="w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin">
{/* WALLET SECTION */}
<div className="lg:w-4/4 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-full bg-white dark:bg-dark-white rounded-2xl shadow min-h-[520px]">
<div className="flex items-baseline justify-between">
{/*<h2 className='text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Wallet</h2>*/}
{/*<p className='text-base text-slate-500 dark:text-white'>Add New Wallet</p>*/}
</div>
{/* wallet balance */}
{wallet.loading ? (
<LoadingSpinner size="16" color="sky-blue" />
) : wallet.data.length ? (
wallet.data.map((item, index) => (
<div
key={index}
className="p-3 md:flex items-center flex-wrap my-3 border-t-2 border-slate-400 wallet-box"
>
<div className="text-slate-900 w-full md:w-1/2 flex space-x-3 items-start justify-start">
<div className="balance-info bal-col1">
<p className="py-2"></p>
<span className="text-xl text-dark-gray dark:text-white">
<b>{item.description}</b>
</span>
<p className="text-base text-slate-500">{item.symbol}</p>
</div>
<div className="balance-info">
<p className="py-2">Balance</p>
<span className="py-1 px-2 bg-green-100 text-green-500 rounded-lg flex flex-start gap-1">
{PriceFormatter(item.amount * 0.01, item.code)}
</span>
</div>
<div className="balance-info">
<p className="py-2">Escrow</p>
<span className="py-1 px-2 bg-red-100 text-red-500 rounded-lg flex flex-start gap-1">
{PriceFormatter(item.escrow * 0.01, item.code)}
</span>
</div>
</div>
<div className="w-full my-2 md:my-0 md:w-1/2 flex space-x-2 items-center justify-start md:justify-end">
{item.action_type != "AC_AD_FD_ONLY" ? (
<Link
to="transfer-fund"
className="px-2 py-1 flex items-center gap-2 user-balance cursor-pointer h-[48px] rounded-full relative bg-purple lg:text-xl text-lg font-bold text-white"
>
Transfer
</Link>
) : (
""
)}
<Link
to="add-fund"
state={{ currency: item.description }}
className="px-2 py-1 flex items-center gap-2 user-balance cursor-pointer h-[48px] rounded-full relative bg-green lg:text-xl text-lg font-bold text-white"
>
<span className="">
<svg
xmlns="http://www.w3.org/2000/svg"
width="38"
height="38"
viewBox="0 0 42 42"
fill="none"
>
<path
d="M21 0C16.8466 0 12.7865 1.23163 9.33303 3.53914C5.8796 5.84665 3.18798 9.1264 1.59854 12.9636C0.00909901 16.8009 -0.406771 21.0233 0.403518 25.0969C1.21381 29.1705 3.21386 32.9123 6.15077 35.8492C9.08767 38.7861 12.8295 40.7862 16.9031 41.5965C20.9767 42.4068 25.1991 41.9909 29.0364 40.4015C32.8736 38.812 36.1534 36.1204 38.4609 32.667C40.7684 29.2135 42 25.1534 42 21C41.994 15.4323 39.7796 10.0944 35.8426 6.15741C31.9056 2.22045 26.5677 0.00602189 21 0ZM28 22.75H22.75V28C22.75 28.4641 22.5656 28.9092 22.2374 29.2374C21.9093 29.5656 21.4641 29.75 21 29.75C20.5359 29.75 20.0908 29.5656 19.7626 29.2374C19.4344 28.9092 19.25 28.4641 19.25 28V22.75H14C13.5359 22.75 13.0908 22.5656 12.7626 22.2374C12.4344 21.9092 12.25 21.4641 12.25 21C12.25 20.5359 12.4344 20.0907 12.7626 19.7626C13.0908 19.4344 13.5359 19.25 14 19.25H19.25V14C19.25 13.5359 19.4344 13.0908 19.7626 12.7626C20.0908 12.4344 20.5359 12.25 21 12.25C21.4641 12.25 21.9093 12.4344 22.2374 12.7626C22.5656 13.0908 22.75 13.5359 22.75 14V19.25H28C28.4641 19.25 28.9093 19.4344 29.2374 19.7626C29.5656 20.0907 29.75 20.5359 29.75 21C29.75 21.4641 29.5656 21.9092 29.2374 22.2374C28.9093 22.5656 28.4641 22.75 28 22.75Z"
fill="white"
></path>
</svg>
</span>
<span className="text-white">Add Credit</span>
</Link>
</div>
</div>
))
) : wallet.error ? (
<div className="md:flex items-center flex-wrap mt-3">
<p className="text-base">
Opps! An Error occurred, please try again
</p>
</div>
) : (
<div className="md:flex items-center flex-wrap mt-3">
<p className="text-base">No Wallets Found!</p>
</div>
)}
{/* end of wallet balance */}
</div>
</div>
{/* END OF WALLET SECTION */}
</div>
{/*<div className='w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin'>*/}
{/* /!* COUPON SECTION *!/*/}
{/* <div className="lg:w-3/4 w-full mb-10 lg:mb-0">*/}
{/* <div className="wallet w-full md:p-8 p-4 h-full max-h-[500px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">*/}
{/* <h2 className='text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Coupons</h2>*/}
{/* {coupon.loading ?*/}
{/* <LoadingSpinner size='16' color='sky-blue' />*/}
{/* :*/}
{/* <CouponTable coupon={coupon} />*/}
{/* }*/}
{/* </div>*/}
{/* </div>*/}
{/* /!* END OF COUPON SECTION *!/*/}
{/*</div>*/}
</div>
);
}
export default Balance
export default Balance;
+137 -86
View File
@@ -1,29 +1,38 @@
import React, { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { Form, Formik } from "formik";
import { useEffect, useState } from "react";
import { useSelector } from "react-redux";
import * as Yup from "yup";
import usersService from "../../../services/UsersService";
import Icons from "../../Helpers/Icons";
import InputCom from "../../Helpers/Inputs/InputCom";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
import { Form, Formik } from "formik";
import { useSelector } from "react-redux";
import * as Yup from "yup";
import Icons from "../../Helpers/Icons";
const validationSchema = Yup.object().shape({
name: Yup.string()
.min(3, "3 chars min.")
.max(50, "50 chars max.")
.required("required"),
cardNum: Yup.string()
.min(3, "3 chars min.")
.max(25, "25 chars max.")
.min(6, "not a card number")
.max(19, "16 chars max.") //16 chars + 3 spaces
.test("luhn-validation", "Invalid Card Number", (value) => {
const sanitizedNumber = value?.replace(/\D/g, "");
const digits = Array?.from(sanitizedNumber, Number);
for (let i = digits.length - 2; i >= 0; i -= 2) {
digits[i] *= 2;
if (digits[i] > 9) {
digits[i] -= 9;
}
}
const sum = digits.reduce((acc, digit) => acc + digit, 0);
return sum % 10 === 0;
})
.required("required"),
code: Yup.string()
.min(3, "3 chars min.")
.max(25, "25 chars max.")
.required("required"),
state: Yup.string()
.min(3, "3 chars min.")
.min(2, "2 chars min.")
.max(25, "25 chars max.")
.required("required"),
address: Yup.string()
@@ -45,7 +54,6 @@ const validationSchema = Yup.object().shape({
});
const initialValues = {
name: "",
cardNum: "",
code: "",
state: "",
@@ -56,25 +64,54 @@ const initialValues = {
};
function AddFundDollars(props) {
const navigate = useNavigate();
const apiCall = new usersService();
let countryWallet = props.walletItem.country;
const [tab, setTab] = useState("previous");
const [loader, setLoader] = useState(false);
const { userDetails } = useSelector((state) => state?.userDetails);
const { firstname, lastname } = userDetails;
const [prevCardDetails, setPrevCardDetails] = useState({});
const [payListCards, setPayListCards] = useState({ loading: true, data: [] });
let __awaitComponent = props.confirmCredit.show.awaitConfirm;
let __acceptComponent = props.confirmCredit.show.awaitConfirm;
const [cardIcons, setCardIcons] = useState("atm-card");
const [prevCardError, setPrevCardError] = useState("");
const { firstname, lastname } = userDetails;
// Handling Card Icons
const handleCards = (event) => {
const { name, value } = event.target;
if (name == "cardNum") {
// Check if the first character is 4 or 5 and set the card icon accordingly
const cardIcon =
value.length > 0
? value[0] === "4"
? "visa-card"
: value[0] === "5"
? "master-card"
: "atm-card"
: "atm-card";
setCardIcons(cardIcon);
}
};
// Handling card change
const handleInputChange = (event) => {
const { name, value } = event.target;
setPrevCardDetails((prevState) => ({
...prevState,
[name]: value,
}));
};
// Handling card number grouping
const handleCardNumberChange = (value) => {
return value
?.replace(/\s/g, "") // Remove existing spaces
.match(/.{1,4}/g) // Group every four characters
?.join(" ");
};
// card slicer
const indexOfFirstItem = 0;
const indexOfLastItem =
indexOfFirstItem + Number(process.env.REACT_APP_ITEM_PER_PAGE);
@@ -83,78 +120,74 @@ function AddFundDollars(props) {
indexOfLastItem
);
// Submission for both prev and new cards
const handleSubmit = async (values, helpers) => {
props.setInputError("");
if (!props.input || props.input === "0") {
props.setInputError("Please Enter Amount");
setTimeout(() => props.setInputError(""), 5000);
return;
}
if (isNaN(props.input)) {
props.setInputError("Amount must be a Number");
setTimeout(() => props.setInputError(""), 5000);
return;
}
if (tab === "previous") {
if (!prevCardDetails) {
// To check if card is empty
if (Object.keys(prevCardDetails).length === 0) {
setPrevCardError("No card selected!");
setTimeout(() => setPrevCardError(""), 5000);
return;
}
props.setConfirmCredit((prev) => ({
...prev,
show: { awaitConfirm: { loader: true } },
}));
let stateData = {
amount: Number(props.input) * 100,
currency: props.walletItem?.code,
};
try {
const res = await apiCall.getStartCredit(stateData);
if (res.data.internal_return < 0) {
props.setConfirmCredit((prev) => ({
...prev,
show: { awaitConfirm: { loader: false } },
}));
props.setInputError("An Error Occurred");
setTimeout(() => props.setInputError(""), 5000);
return;
}
const _response = res.data;
stateData.amount = Number(props.input);
stateData.card = prevCardDetails["payment-card"];
stateData.cardType = "prev";
stateData = { ...stateData, ..._response };
setTimeout(() => {
props.setConfirmCredit({
show: {
awaitConfirm: { loader: false, state: true },
acceptConfirm: { loader: false, state: false },
},
data: stateData,
});
}, 1500);
} catch (error) {
props.setConfirmCredit((prev) => ({
...prev,
show: { awaitConfirm: { loader: false } },
}));
console.log(error);
}
}
if (tab === "new") {
const stateData = {
amount: Number(props.input),
currency: props.currency,
...values,
};
props.setConfirmCredit((prev) => ({
...prev,
show: { awaitConfirm: { loader: true } },
}));
// Rest of the code for tab "new"
let stateData = {
amount: Number(props.input) * 100,
currency: props.walletItem?.code,
};
try {
const res = await apiCall.getStartCredit(stateData);
if (res.data.internal_return < 0) {
props.setInputError("An Error Occurred");
throw new Error("An Error Occurred");
}
const _response = res.data;
stateData.amount = Number(props.input);
stateData.card =
tab === "previous"
? prevCardDetails["payment-card"]
: { ...values, cvv: values.cvv };
stateData.cardType = tab === "previous" ? "prev" : "new";
stateData = { ...stateData, ..._response };
setTimeout(() => {
props.setConfirmCredit({
show: {
awaitConfirm: { loader: false, state: true },
acceptConfirm: { loader: false, state: false },
},
data: stateData,
});
}, 1500);
} catch (error) {
props.setInputError(error.message);
setTimeout(() => props.setInputError(""), 5000);
props.setConfirmCredit((prev) => ({
...prev,
show: { awaitConfirm: { loader: false } },
}));
console.log(error);
}
};
@@ -221,8 +254,8 @@ function AddFundDollars(props) {
{/* END OF switch button */}
{/* previous tab */}
{tab === "previous" ? (
<div className="p-4 previous-details w-full min-h-[16rem] flex flex-col justify-between items-center">
{tab === "previous" && (
<div className="p-4 previous-details w-full min-h-[16rem] flex flex-col">
{payListCards.loading ? (
<LoadingSpinner size="10" color="sky-blue" />
) : payListCards?.data?.length ? (
@@ -267,8 +300,13 @@ function AddFundDollars(props) {
</button>
</div>
)}
<p className="text-base italic text-red-500 h-5">
{prevCardError && prevCardError}
</p>
</div>
) : (
)}
{tab === "new" && (
<div className="new-details w-full max-h-[23rem]">
<div className="w-full flex flex-col justify-between">
<Formik
@@ -297,17 +335,21 @@ function AddFundDollars(props) {
<InputCom
fieldClass="px-6"
spanTag="*"
iconName="master-card visa-card atm-card"
iconName={cardIcons}
label="Card Number"
type="text"
name="cardNum"
onInput={handleCards}
placeholder="Enter Card Number"
value={props.values.cardNum}
value={handleCardNumberChange(
props.values.cardNum
)}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
error={props.errors.cardNum}
/>
</div>
{/* Expire Year, Year */}
<div className="sm:grid gap-5 grid-cols-2 flex-[0.4]">
<div className="field w-full mb-6 xl:mb-0 col-span-1">
@@ -348,7 +390,11 @@ function AddFundDollars(props) {
expireMonth.map((item, index) => (
<option
key={index}
value={item.value}
value={
Number(item.value) < 10
? "0" + item.value
: item.value
}
>
{item.name}
</option>
@@ -357,6 +403,7 @@ function AddFundDollars(props) {
</div>
</div>
</div>
<div className="field w-full mb-6 xl:mb-0 col-span-1">
<div className="select-option">
<div
@@ -404,17 +451,18 @@ function AddFundDollars(props) {
</div>
</div>
{/* Address and CVV */}
<div className="flex items-center flex-1 gap-3 my-2">
{/* Address and CVV */}
<div className="field w-full col-span-1 flex-[0.4]">
<InputCom
fieldClass="px-6"
spanTag="*"
iconName="atm-card"
iconName={cardIcons}
label="CVV"
type="text"
name="cvv"
placeholder="CVV"
maxLength={3}
value={props.values.cvv}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
@@ -444,10 +492,11 @@ function AddFundDollars(props) {
fieldClass="px-6"
spanTag="*"
label="Postal Code"
type="text"
type="number"
name="code"
placeholder="Postal Code"
value={props.values.code}
maxLength={6}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
error={props.errors.code}
@@ -461,7 +510,7 @@ function AddFundDollars(props) {
type="text"
name="state"
placeholder="State"
value={props.values.state}
value={props.values.state.toUpperCase()}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
error={props.errors.state}
@@ -481,9 +530,9 @@ function AddFundDollars(props) {
</button>
<button
type="submit"
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"
className="px-4 py-1 h-11 max-w-[115px] w-full flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
{loader ? (
{props.confirmCredit?.show?.awaitConfirm?.loader ? (
<LoadingSpinner size="6" color="sky-blue" />
) : (
<>
@@ -501,6 +550,7 @@ function AddFundDollars(props) {
</div>
)}
</div>
{tab == "previous" && (
<div className="md:py-8 px-[38px] add-fund-btn flex justify-end items-center gap-4 py-4">
<button
@@ -511,8 +561,9 @@ function AddFundDollars(props) {
</button>
<button
onClick={handleSubmit}
name="previous"
type="button"
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"
className="px-4 py-1 h-11 max-w-[115px] w-full flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
{props.confirmCredit?.show?.awaitConfirm?.loader ? (
<LoadingSpinner size="6" color="sky-blue" />
@@ -1,7 +1,6 @@
import React from "react";
function CompleteConfirmCredit({ onClose, confirmCredit }) {
console.log(confirmCredit);
const { data } = confirmCredit;
return (
<div className="logout-modal-body w-full flex flex-col items-center">
@@ -10,7 +9,12 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl">
<div className="px-4 md:p-8 py-4 add-fund-info">
<div className="field w-full mb-3 min-h-[45px]">
<div className="flex flex-col gap-4">
<div
className={`flex flex-col gap-4 ${
data?.result !== "Charge success" &&
"h-[328px] items-center justify-center"
}`}
>
{/* Success Icon for now */}
<div className="flex items-center w-full justify-center">
{data?.result == "Charge success" ? (
@@ -57,34 +61,38 @@ function CompleteConfirmCredit({ onClose, confirmCredit }) {
</h1>
</div>
<div className="flex items-center gap-8">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Amount({data?.currency || ""})
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{`${data?.symbol || ""} ${
Number(data?.amount * 0.01).toLocaleString() || ""
}`}
</span>
</div>
{data?.internal_return >= 0 ? (
<>
<div className="flex items-center gap-8">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Amount({data?.currency || ""})
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{`${data?.symbol || ""} ${
Number(data?.amount * 0.01).toLocaleString() || ""
}`}
</span>
</div>
<div className="flex items-center gap-8">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Wallet Balance
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{data?.curr_balance}
</span>
</div>
<div className="flex items-center gap-8">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Wallet Balance
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{data?.curr_balance}
</span>
</div>
<div className="flex items-center gap-8">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Confirmation Number
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{data?.confirmation}
</span>
</div>
<div className="flex items-center gap-8">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Confirmation Number
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{data?.confirmation}
</span>
</div>
</>
) : null}
</div>
</div>
</div>
+231 -142
View File
@@ -1,11 +1,90 @@
import { FlutterWaveButton, closePaymentModal } from "flutterwave-react-v3";
import React, { useState } from "react";
import { useSelector } from "react-redux";
import { useDispatch } from "react-redux";
import { useNavigate } from "react-router-dom";
import { toast } from "react-toastify";
import usersService from "../../../services/UsersService";
import { tableReload } from "../../../store/TableReloads";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
function ThePaymentText({ value, type }) {
const cardDetails = value;
value.description =
type === "new"
? cardDetails.cardNum[0] === "4"
? "Visa"
: cardDetails.cardNum[0] == "5"
? "Master"
: "ATM"
: value.description;
value.digits = type === "new" ? cardDetails.cardNum.slice(-4) : value.digits;
return (
<div className="my-2 flex items-center gap-5">
<div className="card-details flex items-center gap-3">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1 space-x-1">
{value.description} Card
</h1>
<p className="text-base font-bold text-dark-gray dark:text-white tracking-wide">
Bank **************{value.digits}
</p>
</div>
</div>
);
}
function AmountSection({ currency, amount, country }) {
const formattedAmount = Number(amount).toFixed(2);
return (
<div
className={`flex items-center ${country == "US" ? "gap-14" : "gap-4"}`}
>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Amount({currency})
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{formattedAmount}
</span>
</div>
);
}
function TransactionFeeSection({ currency, fee, country }) {
const formattedFee = Number(fee).toFixed(2);
return (
<div
className={`flex items-center border-b border-gray-600 ${
country == "US" ? "gap-[2.7rem]" : "gap-4"
}`}
>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Transaction Fee
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{formattedFee}
</span>
</div>
);
}
function TotalSection({ currency, amount, fee, country }) {
const total = Number(amount) + Number(fee);
const formattedTotal = total.toFixed(2);
return (
<div
className={`flex items-center ${
country == "US" ? "gap-[8rem]" : "gap-[6.3rem]"
}`}
>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Total
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{formattedTotal}
</span>
</div>
);
}
function ConfirmAddFund({
confirmCredit,
onClose,
@@ -14,68 +93,26 @@ function ConfirmAddFund({
}) {
const __confirmData = confirmCredit?.data;
const __confirmCountry = walletItem?.country;
const __confirmCardDetails = __confirmData.card
? JSON.parse(__confirmData.card)
: "";
let { userDetails } = useSelector((state) => state.userDetails); // TO GET LOGGEDIN USER DETAILS
let [requestStatus, setRequestStatus] = useState({
message: "",
loading: false,
status: false,
}); // STATE FOR API REQUEST
const __confirmCardDetails =
__confirmData.cardType === "prev"
? JSON.parse(__confirmData.card)
: __confirmData.card;
const apiURL = new usersService();
const navigate = useNavigate();
const dispatch = useDispatch();
//FUNCTION TO HANDLE SUBMIT
const onSuccessPayment = () => {
setRequestStatus({ message: "", loading: true, status: false });
let reqData = { amount: __confirmData?.account, currency: "NGN" };
apiURL
.startTopUp(reqData)
.then((res) => {
if (res.data.internal_return < 0) {
setRequestStatus({
message: "Could not finish transaction",
loading: false,
status: false,
});
toast.success("Opps! something went wrong");
}
// do something
setRequestStatus({
message: "Topup successful",
loading: false,
status: true,
});
toast.success("Account Topup was successful");
setTimeout(() => {
navigate("/my-wallet", { replace: true });
}, 1000);
})
.catch((err) => {
// do something
setRequestStatus({
message: "Opps! An Error Occured",
loading: false,
status: false,
});
toast.success("Opps! something went wrong");
});
};
const [requestStatus, setRequestStatus] = useState({
message: "",
loading: false,
status: false,
});
const config = {
public_key: process.env.REACT_APP_FLUTTERWAVE_APIKEY,
tx_ref: Date.now(),
amount: __confirmData?.amount,
currency: "NGN",
payment_options: "card,mobilemoney,ussd",
customer: {
email: `${userDetails.email}`,
phone_number: userDetails.phone,
name: `${userDetails.lastname} ${userDetails.firstname}`,
},
customizations: {
title: "WrenchBoard",
description: "Topup Payment",
@@ -88,12 +125,47 @@ function ConfirmAddFund({
text: "Proceed",
callback: (response) => {
onSuccessPayment();
closePaymentModal(); // this will close the modal programmatically
closePaymentModal();
},
onClose: () => {},
};
// Handling Previous Card
const onSuccessPayment = () => {
setRequestStatus({ message: "", loading: true, status: false });
const reqData = { amount: __confirmData?.account, currency: "NGN" };
apiURL
.startTopUp(reqData)
.then((res) => {
if (res.data.internal_return < 0) {
setRequestStatus({
message: "Could not finish transaction",
loading: false,
status: false,
});
toast.success("Opps! something went wrong");
} else {
setRequestStatus({
message: "Topup successful",
loading: false,
status: true,
});
toast.success("Account Topup was successful");
setTimeout(() => {
navigate("/my-wallet", { replace: true });
}, 1000);
}
})
.catch((err) => {
setRequestStatus({
message: "Opps! An Error Occured",
loading: false,
status: false,
});
toast.success("Opps! something went wrong");
});
};
const handlePrevCard = async () => {
const { amount, credit_reference, currency } = __confirmData;
const { card_uid } = __confirmCardDetails;
@@ -124,18 +196,16 @@ function ConfirmAddFund({
return;
}
return setTimeout(
() =>
setConfirmCredit((prev) => ({
...prev,
show: {
awaitConfirm: { loader: false, state: false },
acceptConfirm: { loader: false, state: true },
},
data: _response,
})),
1500
);
setTimeout(() => {
setConfirmCredit((prev) => ({
...prev,
show: {
awaitConfirm: { loader: false, state: false },
acceptConfirm: { loader: false, state: true },
},
data: _response,
}));
}, 1500);
} catch (error) {
setConfirmCredit((prev) => ({
...prev,
@@ -147,18 +217,68 @@ function ConfirmAddFund({
}
};
const ThePaymentText = ({ value }) => (
<div className="my-2 flex items-center gap-5">
<div className="card-details flex items-center gap-3">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{value.description} Card
</h1>
<p className="text-base font-bold text-dark-gray dark:text-white tracking-wide">
Bank **************{value.digits}
</p>
</div>
</div>
);
const handleNewCard = async () => {
const { amount, credit_reference, uid } = __confirmData;
const { address, cardNum, cvv, expirationMonth, expirationYear } =
__confirmCardDetails;
const reqData = {
amount: amount * 100,
cardnumber: cardNum.replace(/\s/g, ""),
credit_reference,
cvc: cvv,
description: address,
exp_month: expirationMonth,
exp_year: expirationYear,
paymenttype: 100,
uid,
};
try {
setConfirmCredit((prev) => ({
...prev,
show: {
acceptConfirm: { loader: true },
},
}));
const res = await apiURL.getPaidNewCard(reqData);
const _response = res.data;
if (res.data.internal_return < 0) {
setConfirmCredit((prev) => ({
...prev,
show: {
awaitConfirm: { loader: false, state: false },
acceptConfirm: { loader: false, state: true },
},
data: _response,
}));
return;
}
setTimeout(() => {
dispatch(tableReload({ type: "WALLETTABLE" }));
setConfirmCredit((prev) => ({
...prev,
show: {
awaitConfirm: { loader: false, state: false },
acceptConfirm: { loader: false, state: true },
},
data: _response,
}));
}, 1500);
} catch (error) {
setConfirmCredit((prev) => ({
...prev,
show: {
acceptConfirm: { loader: false },
},
}));
setTimeout(() => onClose, 10000);
console.log(error);
}
};
// console.log(confirmCredit?.data);
return (
<div className="content-wrapper w-full h-[32rem]">
@@ -166,76 +286,45 @@ function ConfirmAddFund({
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl">
<div className="px-4 md:p-8 py-4 add-fund-info">
<div className="field w-full mb-3 min-h-[45px]">
{confirmCredit?.show?.awaitConfirm?.state ? (
{confirmCredit?.show?.awaitConfirm?.state && (
<div className="flex flex-col gap-2">
{/* Amount */}
<div
className={`flex items-center ${
__confirmCountry == "US" ? "gap-14" : "gap-4"
}`}
>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Amount({__confirmData?.currency})
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{`${walletItem?.symbol} ${
Number(__confirmData?.amount).toLocaleString() || ""
}`}
</span>
</div>
{/* Transaction Fee */}
<div
className={`flex items-center border-b border-gray-600 ${
__confirmCountry == "US" ? "gap-[2.7rem]" : "gap-4"
}`}
>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Transaction Fee
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{`${walletItem?.symbol} ${
Number(__confirmData?.fee).toLocaleString() || ""
}`}
</span>
</div>
{/* Total */}
<div
className={`flex items-center ${
__confirmCountry == "US" ? "gap-[8rem]" : "gap-4"
}`}
>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
Total
</h1>
<span className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
{`${walletItem?.symbol} ${
(
Number(__confirmData?.amount) +
Number(__confirmData?.fee)
).toLocaleString() || ""
}`}
</span>
</div>
{__confirmCountry == "US" && (
<AmountSection
currency={__confirmData?.currency}
amount={__confirmData?.amount}
country={__confirmCountry}
/>
<TransactionFeeSection
currency={__confirmData?.currency}
fee={__confirmData?.fee}
country={__confirmCountry}
/>
<TotalSection
currency={__confirmData?.currency}
amount={__confirmData?.amount}
fee={__confirmData?.fee}
country={__confirmCountry}
/>
{__confirmCountry === "US" && (
<div className="flex items-center gap-8">
<label
htmlFor="payment"
className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1"
>
{__confirmCountry == "US" && "Payment Method"}
Payment Method
</label>
<span className="text-[#181c32] dark:text-white ">
{__confirmCardDetails ? (
<ThePaymentText value={__confirmCardDetails} />
) : null}
<span className="text-[#181c32] dark:text-white">
<ThePaymentText
value={__confirmCardDetails}
type={__confirmData?.cardType}
/>
</span>
</div>
)}
<div
className={`${
__confirmCountry == "US" ? "gap-[3.7rem]" : "gap-8"
__confirmCountry === "US"
? "gap-[3.7rem]"
: "gap-[1.81rem]"
} flex items-center`}
>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
@@ -246,13 +335,13 @@ function ConfirmAddFund({
</span>
</div>
</div>
) : null}
)}
</div>
</div>
<div
className={
__confirmCountry == "US" ? "min-h-[96px]" : "min-h-[200px]"
__confirmCountry === "US" ? "min-h-[96px]" : "min-h-[157px]"
}
></div>
<hr />
@@ -263,13 +352,13 @@ function ConfirmAddFund({
>
Cancel
</button>
{__confirmCountry == "US" && (
{__confirmCountry === "US" && (
<button
className="px-4 h-11 flex justify-center items-center btn-gradient text-white text-base rounded-full"
onClick={
__confirmData?.cardType === "prev"
? handlePrevCard
: () => console.log("Test me")
: handleNewCard
}
>
{confirmCredit?.show?.acceptConfirm?.loader ? (
@@ -279,7 +368,7 @@ function ConfirmAddFund({
)}
</button>
)}
{__confirmCountry == "NG" && (
{__confirmCountry === "NG" && (
<FlutterWaveButton
{...fwConfig}
className="px-2 py-1 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
@@ -0,0 +1,203 @@
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import { toast } from "react-toastify";
import InputCom from "../../Helpers/Inputs/InputCom";
import ModalCom from "../../Helpers/ModalCom";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
import usersService from "../../../services/UsersService";
function ConfirmNairaWithdraw({ payment, wallet, action, situation, state }) {
const apiURL = new usersService();
const navigate = useNavigate();
let [requestStatus, setRequestStatus] = useState({
message: "",
loading: false,
status: false,
});
let [pageLoading, setPageLoading] = useState(true);
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = () => {
setRequestStatus({ message: "", loading: true, status: false });
let reqData = {
amount: Number(state.amount * 100),
Fee: Number(state.fee),
recipient_uid: Number(state.details?.recipient_uid),
wallet_uid: wallet.wallet_uid,
};
apiURL
.sendMoney(reqData)
.then((res) => {
if (res.data.internal_return < 0) {
setRequestStatus({
message: "Could not perform transaction",
loading: false,
status: false,
});
return;
}
setRequestStatus({
message: "transfer successful",
loading: false,
status: true,
});
toast.success("Transfer sucessful");
setTimeout(() => {
navigate("/my-wallet", { replace: true });
window.location.reload(true);
}, 1000);
})
.catch((error) => {
setRequestStatus({
message: "Opps! something went wrong! Try Again",
loading: false,
status: false,
});
});
};
console.log(state)
return (
<ModalCom action={action} situation={situation} className="edit-popup">
<div className="logout-modal-wrapper lw-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="w-full">
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
<h2 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
{`Withdraw from ${wallet.description} Wallet : ${wallet.symbol}${(
wallet.amount * 0.01
).toFixed(2)}`}
</h2>
<button
type="button"
className="text-[#374557] dark:text-red-500"
onClick={action}
>
<svg
width="36"
height="36"
viewBox="0 0 36 36"
fill="none"
className="fill-current"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
fill=""
fillOpacity="0.6"
/>
<path
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
fill="#"
fillOpacity="0.6"
/>
</svg>
</button>
</div>
<hr />
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl shadow">
<div className="px-4 md:px-8 py-4 add-fund-info">
<h2 className="my-2 text-slate-900 dark:text-white text-sm xl:text-xl font-medium">
{/* Confirm Withdraw to Account */}
</h2>
{/* AMOUNT */}
<div className="field w-full mb-3">
<InputCom
fieldClass="px-6"
label="Amount:"
type="text"
name="amount"
value={state?.amount || ""}
disable={true}
/>
</div>
{/* RECIPIENT ACC: */}
<div className="field w-full mb-3">
<InputCom
fieldClass="px-6"
label="Recipient Acc:"
type="text"
name="recipient"
value={state?.details.recipient || ""}
disable={true}
/>
</div>
{/* PROCESSING FEE: */}
<div className="field w-full mb-3">
<InputCom
fieldClass="px-6"
label="Processing Fee:"
type="text"
name="processingFee"
value={(state?.fee * 0.01).toFixed(2) || ""}
disable={true}
/>
</div>
{/* TOTAL */}
<div className="field w-full mb-3">
<InputCom
fieldClass="px-6"
label="Total"
type="text"
name="total"
value={(state?.total * 0.01).toFixed(2) || ""}
disable={true}
/>
</div>
{/* COMMENT/NOTE */}
<div className="field w-full mb-3">
<InputCom
fieldClass="px-6"
label="Comment/Note:"
type="text"
name="comment"
value={state?.comment || ""}
disable={true}
/>
</div>
</div>
<hr />
{requestStatus.message && (
<p
className={`text-base ${
requestStatus.status ? "text-green-500" : "text-red-500"
} px-4 md:px-8 py-4`}
>
{requestStatus.message}
</p>
)}
<div className="px-4 md:px-8 py-4 add-fund-btn flex justify-end items-center gap-2">
<button
type="button"
onClick={action}
className="border-gradient text-base tracking-wide px-4 py-2 rounded-full"
>
<span className="text-gradient">Cancel</span>
</button>
{requestStatus.loading ? (
<LoadingSpinner size="8" color="sky-blue" />
) : (
<button
onClick={handleSubmit}
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
>
Transfer
</button>
)}
</div>
</div>
</div>
</div>
</ModalCom>
);
}
export default ConfirmNairaWithdraw;
+14 -7
View File
@@ -24,13 +24,20 @@ const CreditPopup = ({ details, onClose, situation, walletItem }) => {
<div className="logout-modal-wrapper lw-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
{confirmCredit?.show?.acceptConfirm?.loader
? "Confirming Credit..."
: confirmCredit?.show?.awaitConfirm?.state
? "Confirm Credit Add"
: confirmCredit?.show?.acceptConfirm?.state
? "Credit Add Completed"
: "Add Credit"}
{confirmCredit?.show?.acceptConfirm?.state &&
confirmCredit?.data?.internal_return < 0 ? (
"Credit Unsuccessful"
) : (
<>
{confirmCredit?.show?.acceptConfirm?.loader
? "Confirming Credit..."
: confirmCredit?.show?.awaitConfirm?.state
? "Confirm Credit Add"
: confirmCredit?.show?.acceptConfirm?.state
? "Credit Add Completed"
: "Add Credit"}
</>
)}
</h1>
<button
type="button"
@@ -0,0 +1,795 @@
import { Form, Formik } from "formik";
import React, { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import usersService from "../../../services/UsersService";
import InputCom from "../../Helpers/Inputs/InputCom";
import ModalCom from "../../Helpers/ModalCom";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
const initialValues = {
amount: "",
comment: "",
previousAccount: {
recipientID: "",
},
newAccount: {
country: "",
bank: "",
accountNumber: "",
accountType: "",
state: "",
city: "",
},
};
function NairaWithdraw({
wallet,
action,
situation,
setShowConfirmNairaWithdraw,
}) {
const apiCall = new usersService(); // API CLASS CALL
const navigate = useNavigate();
const [tab, setTab] = useState("previous");
let [requestStatus, setRequestStatus] = useState(false);
const [errorMsgs, setErrorMsgs] = useState(initialValues);
let [sendMoneyFee, setSendMoneyFee] = useState({
loading: false,
fee: 0,
total: 0,
}); // HOLD THE VALUE FOR walletSEND MONEY FEE
// Previous Account
let [recipients, setRecipients] = useState({
// FOR COUPON HISTORY
loading: true,
data: [],
error: false,
});
// New Account
let [allCountries, setAllCountries] = useState({
// STATE TO HOLD LIST OF COUNTRIES
loading: true,
data: [],
});
let [bankName, setBankName] = useState({
// STATE TO HOLD LIST OF BANK NAME
loading: false,
data: [],
});
let [accType, setAccType] = useState({
// STATE TO HOLD LIST ACCOUNT TYPE
loading: true,
data: [],
});
// Handling card change
const handleBankOptions = (event) => {
const { name, value } = event.target;
setBankName((prev) => ({ loading: true, data: [] }));
apiCall
.getCountryBank({ country: value })
.then((res) => {
if (res.data.internal_return < 0) {
setBankName((prev) => ({ loading: false, data: [] }));
return;
}
setBankName((prev) => ({ loading: false, data: res.data.result_list }));
})
.catch((error) => {
setBankName((prev) => ({ loading: false, data: [] }));
});
};
//FUNCTION TO GET RECIPIENT LIST
const getRecipients = () => {
apiCall
.getRecipient()
.then((res) => {
if (res.data.internal_return < 0) {
// success but no data
setRecipients((prev) => ({ ...prev, loading: false }));
return;
}
setRecipients((prev) => ({
...prev,
loading: false,
data: res.data.result_list,
}));
})
.catch((error) => {
setRecipients((prev) => ({ ...prev, loading: false, error: true }));
});
};
// FUNCTION TO GET COUNTRIES
const getCountry = () => {
apiCall
.getSignupCountryData()
.then((res) => {
if (res.data.internal_return < 0) {
setAllCountries((prev) => ({ loading: false, data: [] }));
return;
}
setAllCountries((prev) => ({
loading: false,
data: res.data.signup_country,
}));
})
.catch((error) => {
setAllCountries((prev) => ({ loading: false, data: [] }));
});
};
// FUNCTION TO GET ACCOUNT TYPES
const getAccountTypes = () => {
apiCall
.getAccountTypes()
.then((res) => {
if (res.data.internal_return < 0) {
setAccType((prev) => ({ loading: false, data: [] }));
return;
}
setAccType((prev) => ({ loading: false, data: res.data.result_list }));
})
.catch((error) => {
setAccType((prev) => ({ loading: false, data: [] }));
});
};
useEffect(() => {
getCountry(); // TO LOAD LIST COUNTRY
getAccountTypes(); // TO LOAD LIST ACCOUNT TYPES
}, []);
//FUNCTION TO GET SEND MONEY FEE
const getSendMoneyFee = ({ target: { value } }) => {
setSendMoneyFee({ loading: true, fee: 0, total: 0 });
let amount = value;
if (Number(amount) <= 0 || amount == "" || isNaN(amount)) {
setSendMoneyFee({ loading: false, fee: 0, total: 0 });
return;
}
apiCall
.getSendMoneyFee(Number(amount * 100))
.then((res) => {
setSendMoneyFee({
loading: false,
fee: res.data.processing_fee,
total: res.data.total_amount,
});
})
.catch((error) => {
setSendMoneyFee({ loading: false, fee: 0, total: 0 });
});
};
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = async (values, helpers) => {
try {
// Validate the form using Yup validation schema
// await validationSchema.validate(values, { abortEarly: false });
// If validation passes, proceed with form submission
console.log("Form data is valid!", values);
if (!values?.amount) {
setErrorMsgs({ amount: "Please enter an amount" });
setTimeout(() => setErrorMsgs({ amount: "" }), 1000);
return;
}
if (values?.comment?.length >= 50) {
setErrorMsgs({ comment: "50 chars max" });
setTimeout(() => setErrorMsgs({ comment: "" }), 1000);
}
// form submission logic here
if (tab === "previous") {
if (!values?.previousAccount?.recipientID) {
setErrorMsgs({
previousAccount: { recipientID: "Please select an option" },
});
setTimeout(
() => setErrorMsgs({ previousAccount: { recipientID: "" } }),
1000
);
}
setRequestStatus(true);
// Ensure recipientDetails is an array and not undefined
const recipientDetails = recipients.data?.filter(
(item) => item.recipient_uid === values.previousAccount?.recipientID
);
// Ensure recipientDetails is not empty
if (!recipientDetails || recipientDetails.length === 0) {
// Handle the case when recipientDetails is empty or undefined
setRequestStatus(false);
return;
}
const stateData = {
amount: values.amount,
comment: values.comment,
wallet_uid: wallet.wallet_uid,
...sendMoneyFee,
details: { ...recipientDetails[0] },
};
setTimeout(() => {
setRequestStatus(false);
// navigate("confirm-withdraw-naira", { state: stateData });
action();
setShowConfirmNairaWithdraw({ show: true, state: stateData });
}, 1000);
}
if (tab === "new") {
const { accountNumber, accountType, bank, city, country, state } =
values?.newAccount;
}
} catch (errors) {
// If validation fails, handle the validation errors
throw new Error("Validation errors:", errors);
//
}
};
useEffect(() => {
getRecipients();
}, []);
return (
<ModalCom action={action} situation={situation} className="edit-popup">
<div className="logout-modal-wrapper lw-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl">
<div className="w-full">
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
{`Withdraw from ${wallet.description} Wallet : ${wallet.symbol}${(
wallet.amount * 0.01
).toFixed(2)}`}
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
onClick={action}
>
<svg
width="36"
height="36"
viewBox="0 0 36 36"
fill="none"
className="fill-current"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
fill=""
fillOpacity="0.6"
/>
<path
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
fill="#"
fillOpacity="0.6"
/>
</svg>
</button>
</div>
<div className="add-fund w-full md:p-8 p-4 bg-white dark:bg-dark-white h-full rounded-2xl">
<Formik
initialValues={initialValues}
// validationSchema={validationSchema}
onSubmit={handleSubmit}
>
{(props) => {
return (
<Form className="transfer-fund-info">
{/* Amount Form */}
<div className="flex flex-col">
<div className="field w-full">
<InputCom
fieldClass="px-4"
parentClass="flex items-center gap-1 justify-between"
labelClass="flex-[0.2] mb-0"
inputClass="flex-[0.8] max-w-[12rem]"
label="Amount:"
type="number"
name="amount"
placeholder="0"
direction="rtl"
value={props.values.amount}
inputHandler={props.handleChange}
blurHandler={(e) => {
getSendMoneyFee(e);
}}
/>
{errorMsgs?.amount && (
<p className="sm:text-sm text-[12px] text-red-500 sm:text-left text-right sm:translate-y-0 translate-y-1">
{errorMsgs.amount}
</p>
)}
</div>
<div className="field w-full">
<InputCom
fieldClass="px-4 transfer-field"
parentClass="flex items-center gap-1 justify-between"
labelClass="flex-[0.2] mb-0"
inputClass="flex-[0.8] transfer-field max-w-[12rem]"
label="Fee:"
type="text"
name="fee"
direction="rtl"
value={
sendMoneyFee.loading
? "loading"
: (sendMoneyFee.fee * 0.01).toFixed(2)
}
disable={true}
/>
</div>
<div className="field w-full">
<InputCom
fieldClass="px-4 transfer-field"
parentClass="flex items-center gap-1 justify-between"
labelClass="flex-[0.2] mb-0"
inputClass="flex-[0.8] transfer-field max-w-[12rem]"
label="Total:"
type="text"
name="total"
direction="rtl"
value={
sendMoneyFee.loading
? "loading"
: (sendMoneyFee.total * 0.01).toFixed(2)
}
disable={true}
/>
</div>
<div className="field w-full mb-3 flex gap-1 justify-between">
<label className="text-[#181c32] dark:text-white text-base font-semibold flex flex-[0.2] mt-2.5">
Comment:
</label>
<textarea
style={{ resize: "none" }}
className="text-base px-4 py-2 rounded-md sm:max-w-[550px] max-w-[250px] text-dark-gray dark:text-white w-full bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none flex-[0.8]"
name="comment"
value={props.values.comment}
onChange={props.handleChange}
onBlur={props.handleBlur}
cols="30"
rows="2"
/>
</div>
</div>
{/* Account Selector */}
<div className=" flex items-center gap-[8rem]">
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-tighter my-1">
To:
</h1>
<div className="my-1 flex items-center gap-2">
<label
onClick={() => setTab("previous")}
htmlFor="previous"
className="cursor-pointer flex items-center gap-1"
>
<input
type="radio"
id="previous"
name="choice"
value="previous"
checked={tab === "previous"}
className={`p-2 text-lg font-bold text-slate-600 dark:text-white border pointer-events-none w-7 h-7 ${
tab == "previous" ? "" : ""
} tracking-wide transition duration-200`}
/>
Previous Account
</label>
<label
onClick={() => setTab("new")}
htmlFor="new"
className="cursor-pointer flex items-center gap-1"
>
<input
id="new"
type="radio"
name="choice"
value="new"
checked={tab === "new"}
className={`p-2 text-lg font-bold text-slate-600 dark:text-white border pointer-events-none w-7 h-7 ${
tab == "new" ? "" : ""
} tracking-wide transition duration-200`}
/>
New Account{" "}
</label>
</div>
</div>
<div className="">
{tab == "previous" && (
<>
<div className="w-full">
<div className="relative my-3 md:flex items-center px-4">
<div className="transfer-input w-full flex items-center justify-end">
{/* <label className="text-[#181c32] dark:text-white text-base font-semibold block flex-[0.2] mb-0 mt-3"></label> */}
<div className="flex flex-col gap-3 flex-[0.8] items-center">
<select
className="sm:w-full w-48 text-base p-2 text-dark-gray dark:text-white rounded-md border border-slate-300 outline-0 flex-[0.8]"
value={
props.values.previousAccount?.recipientID
}
name="previousAccount.recipientID"
onChange={props.handleChange}
onBlur={props.handleBlur}
>
{recipients.loading ? (
<option
className="text-slate-500 text-lg"
value=""
>
Loading...
</option>
) : recipients.data.length ? (
<>
<option
className="text-slate-500 text-lg"
value=""
>
{errorMsgs.previousAccount
?.recipientID
? errorMsgs.previousAccount
.recipientID
: "Select..."}
</option>
{recipients.data.map((item, index) => (
<option
key={index}
value={item.recipient_uid}
className="text-slate-500 text-lg"
>
{item.recipient}
</option>
))}
</>
) : recipients.error ? (
<option
className="text-slate-500 text-lg"
value=""
>
Could'nt load, !
</option>
) : (
<option
className="text-slate-500 text-lg"
value=""
>
No Recipient Found!
</option>
)}
</select>
<div className="flex justify-end relative w-full">
{errorMsgs.previousAccount?.recipientID &&
errorMsgs.previousAccount
?.recipientID && (
<p className="sm:text-sm text-[12px] text-red-500 absolute sm:top-1 -top-20 sm:left-0 left-[160px]">
{
errorMsgs.previousAccount
?.recipientID
}
</p>
)}
</div>
</div>
</div>
</div>
</div>
<div className="h-[7.6rem]"></div>
</>
)}
{tab == "new" && (
<div className="w-full mt-3 rounded-md bg-slate-100">
<div className="relative fields w-full flex flex-col p-4">
<div className="flex flex-[2] min-h-[52px]">
{/* country */}
<div className="add-recipient w-full flex items-center flex-1 xl:mb-0">
<label
htmlFor="newAccount.country"
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex flex-[0.3]"
>
Country{" "}
<span className="text-red-500">*</span>
</label>
<select
className="w-full text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 flex-[0.6] rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding"
name="newAccount.country"
value={props.values.newAccount?.country}
onChange={
props.handleChange || handleBankOptions
}
>
{allCountries.loading ? (
<option
className="text-slate-500 text-lg"
value=""
>
Loading...
</option>
) : allCountries.data?.length ? (
<>
<option
className="text-slate-500 text-lg"
value=""
>
{errorMsgs.newAccount?.country
? errorMsgs.newAccount.country
: "Select..."}
</option>
{allCountries.data.map((item, index) => (
<option
key={index}
className="text-slate-500 text-lg"
value={item[0]}
>
{item[1]}
</option>
))}
</>
) : (
<option
className="text-slate-500 text-lg"
value=""
>
No Options Found!
</option>
)}
</select>
{/* {props.errors.country &&
props.touched.country && (
<p className="text-sm text-red-500">
{props.errors.country}
</p>
)} */}
</div>
{/* bank name */}
<div className="add-recipient w-full flex items-center flex-1">
<label
htmlFor="newAccount.bank"
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex flex-[0.4]"
>
Bank Name{" "}
<span className="text-red-500">*</span>
</label>
<select
className="w-full text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 flex-[0.6] rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding "
name="newAccount.bank"
value={props.values.newAccount?.bank}
onChange={props.handleChange}
onBlur={props.handleBlur}
>
{bankName.loading ? (
<option
className="text-slate-500 text-lg"
value=""
>
Loading...
</option>
) : bankName.data?.length ? (
<>
<option
className="text-slate-500 text-lg"
value=""
>
Select...
</option>
{bankName.data?.map((item, index) => (
<option
key={index}
className="text-slate-500 text-lg"
value={item.code}
>
{item.name}
</option>
))}
</>
) : (
<option
className="text-slate-500 text-lg"
value=""
>
No Options Found!
</option>
)}
</select>
{/* {props.errors.bank && props.touched.bank && (
<p className="text-sm text-red-500">
{props.errors.bank}
</p>
)} */}
</div>
</div>
<div className="flex flex-[2] gap-4">
{/* ACCOUNT NUMBER */}
<div className="field w-full flex-[1.4] flex items-center gap-2">
<label
htmlFor="newAccount.accountNumber"
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex items-center flex-1"
>
Account Number{" "}
<span className="text-red-500">*</span>
</label>
<InputCom
fieldClass="px-6"
inputClass="flex items-center max-w-[15rem]"
type="text"
name="newAccount.accountNumber"
placeholder="Account No"
value={props.values.newAccount?.accountNumber}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{/* {props.errors.accountNumber &&
props.touched.accountNumber && (
<p className="text-sm text-red-500">
{props.errors.accountNumber}
</p>
)} */}
</div>
{/* Account Type */}
<div className="add-recipient w-full flex flex-1 items-center">
<label
htmlFor="newAccount.accountType"
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex flex-[0.3]"
>
Type <span className="text-red-500">*</span>
</label>
<select
className="w-full text-base p-2 text-dark-gray dark:text-white border border-slate-300 outline-0 flex-[0.6] rounded-full h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding flex-grow"
name="newAccount.accountType"
value={props.values.newAccount?.accountType}
onChange={props.handleChange}
onBlur={props.handleBlur}
>
{accType.loading ? (
<option
className="text-slate-500 text-lg"
value=""
>
Loading...
</option>
) : accType.data?.length ? (
<>
<option
className="text-slate-500 text-lg"
value=""
>
Select...
</option>
{accType.data?.map((item, index) => (
<option
key={index}
className="text-slate-500 text-lg"
value={item.value}
>
{item.name}
</option>
))}
</>
) : (
<option
className="text-slate-500 text-lg"
value=""
>
No Options Found!
</option>
)}
</select>
{/* {props.errors.accountType &&
props.touched.accountType && (
<p className="text-sm text-red-500">
{props.errors.accountType}
</p>
)} */}
</div>
</div>
<div className="flex items-center flex-1">
{/* state */}
<div className="field w-full flex items-center gap-4 flex-[0.4]">
<label
htmlFor="newAccount.state"
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex flex-[0.4]"
>
State <span className="text-red-500">*</span>
</label>
<InputCom
fieldClass="px-6"
inputClass="max-w-[10rem]"
type="text"
name="newAccount.state"
placeholder="State/Province"
value={props.values.newAccount?.state}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{/* {props.errors.state && props.touched.state && (
<p className="text-sm text-red-500">
{props.errors.state}
</p>
)} */}
</div>
{/* city */}
<div className="field w-full flex items-center flex-[0.4]">
<label
htmlFor="newAccount.city"
className="input-label text-[#181c32] dark:text-white text-base font-semibold inline-flex flex-[0.4]"
>
City <span className="text-red-500">*</span>
</label>
<InputCom
fieldClass="px-6"
type="text"
inputClass="max-w-[10rem]"
name="newAccount.city"
placeholder="City"
value={props.values.newAccount?.city}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{/* {props.errors.city && props.touched.city && (
<p className="text-sm text-red-500">
{props.errors.city}
</p>
)} */}
</div>
</div>
{/* end of inputs for new accounts */}
</div>
</div>
)}
</div>
<div className="transfer-fund-btn flex justify-end items-center gap-2 py-4">
<button
type="button"
onClick={action}
className="border-gradient text-base tracking-wide px-4 py-2 rounded-full"
>
<span className="text-gradient">Cancel</span>
</button>
<button
type="submit"
disabled={
props.isSubmitting || sendMoneyFee.loading
? true
: false
}
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer min-w-[100px] flex justify-center items-center"
>
{requestStatus ? (
<LoadingSpinner size="6" color="sky-blue" />
) : (
"Continue"
)}
</button>
</div>
</Form>
);
}}
</Formik>
</div>
</div>
</div>
</ModalCom>
);
}
export default NairaWithdraw;
+40 -92
View File
@@ -4,132 +4,80 @@ import React, {
useCallback,
useEffect,
useMemo,
useReducer,
useState,
} from "react";
import { Routes, Route, Outlet, Navigate } from "react-router-dom";
import { useSelector } from "react-redux";
import usersService from "../../services/UsersService";
import Layout from "../Partials/Layout";
import LoadingSpinner from "../Spinners/LoadingSpinner";
// const AddFund = lazy(() => import("./AddFund"));
// const ConfirmAddFund = lazy(() => import("./ConfirmAddFund"));
// const TransferFund = lazy(() => import("./TransferFund"));
const WalletBox = lazy(() => import("./WalletBox"));
// const AddRecipient = lazy(() => import("./AddRecipient"));
// const ConfirmTransfer = lazy(() => import("./ConfirmTransfer"));
function Wallet() {
return (
<Layout>
<Outlet />
</Layout>
);
}
const initialState = {
loading: true,
data: [],
error: false,
};
// Currently learning better about useReducer, so I converted this since it seemed like something complex
const reducer = (state, action) => {
switch (action.type) {
case "FETCH_SUCCESS":
return {
...state,
loading: false,
data: action.payload,
};
case "FETCH_ERROR":
return {
...state,
loading: false,
error: true,
};
default:
return state;
}
};
const WalletRoutes = () => {
const apiCall = useMemo(() => new usersService(), []);
const [walletList, dispatchWalletList] = useReducer(reducer, initialState);
const [paymentHistory, dispatchPaymentHistory] = useReducer(
reducer,
initialState
);
const { walletTable } = useSelector((state) => state.tableReload);
const [walletList, setWalletList] = useState({
loading: true,
data: [],
reload: false,
});
const [paymentHistory, setPaymentHistory] = useState({
loading: true,
data: [],
});
const getWalletList = useCallback(() => {
apiCall
.getUserWallets(null)
return apiCall
.getUserWallets()
.then((res) => {
if (res.data.internal_return < 0) {
dispatchWalletList({ type: "FETCH_SUCCESS", payload: [] });
setWalletList({ loading: false, data: [] });
} else {
dispatchWalletList({
type: "FETCH_SUCCESS",
payload: res.data.result_list,
});
setWalletList({ loading: true, data: [] });
setTimeout(
() =>
setWalletList({ loading: false, data: res.data?.result_list }),
500
);
}
})
.catch(() => {
dispatchWalletList({ type: "FETCH_ERROR" });
setWalletList({ loading: false, data: [] });
});
}, [apiCall]);
const getPaymentHistory = useCallback(() => {
apiCall
return apiCall
.getPaymentHx()
.then((res) => {
if (res.data.internal_return < 0) {
dispatchPaymentHistory({ type: "FETCH_SUCCESS", payload: [] });
setPaymentHistory({ loading: false, data: [] });
} else {
dispatchPaymentHistory({
type: "FETCH_SUCCESS",
payload: res.data.result_list,
});
setPaymentHistory({ loading: false, data: res.data?.result_list });
}
})
.catch(() => {
dispatchPaymentHistory({ type: "FETCH_ERROR" });
setPaymentHistory({ loading: false, data: [] });
});
}, [apiCall]);
useEffect(() => {
let isMounted = true;
if (isMounted) {
getWalletList();
getPaymentHistory();
}
return () => {
isMounted = false;
const fetchData = async () => {
await Promise.all([getWalletList(), getPaymentHistory()]);
};
}, [getWalletList, getPaymentHistory]);
if (walletList.loading) {
fetchData();
}
}, [walletTable, walletList.loading]);
console.log(walletTable);
return (
<Routes>
<Route
element={
<Suspense fallback={<LoadingSpinner size="16" color="sky-blue" />}>
<Wallet />
</Suspense>
}
>
<Route
index
element={
<Suspense fallback={<LoadingSpinner size="16" color="sky-blue" />}>
<WalletBox wallet={walletList} payment={paymentHistory} />
</Suspense>
}
/>
<Route path="*" element={<Navigate to="/" />} />
</Route>
</Routes>
<Layout>
<Suspense fallback={<LoadingSpinner size="16" color="sky-blue" />}>
<WalletBox wallet={walletList} payment={paymentHistory} />
</Suspense>
</Layout>
);
};
+79 -40
View File
@@ -1,49 +1,88 @@
import React from 'react'
import { Link } from 'react-router-dom';
import React, { useCallback, useState } from "react";
import ConfirmNairaWithdraw from "./Popup/ConfirmNairaWithdraw";
import NairaWithdraw from "./Popup/NairaWithdraw";
import usersService from "../../services/UsersService";
function WalletAction({ walletItem, payment, openPopUp }) {
const [showNairaWithdraw, setShowNairaWithdraw] = useState(false); // DETERMINES WHEN NAIRA WITHDRAWAL POPS UP
const [countries, setCountries] = useState([]);
const [showConfirmNairaWithdraw, setShowConfirmNairaWithdraw] = useState({
show: false,
state: {},
}); // DETERMINES WHEN CONFIRM NAIRA WITHDRAWAL POPS UP
const userApi = new usersService();
// Get Country Api
const getCountryList = useCallback(async () => {
const res = await userApi.getSignupCountryData();
try {
if (res.status === 200) {
const { signup_country } = await res.data;
setCountries(signup_country);
} else if (res.data.result !== 100) {
setCountries("Nothing see here!");
}
} catch (error) {
throw new Error(error);
}
}, []);
function WalletAction({walletItem, payment, openPopUp}) {
return (
<div className="counters w-full flex justify-between gap-2">
<div className='w-1/2 flex justify-center items-center'>
<Link
to="transfer-fund"
className={`${
walletItem.code != "NAIRA" && "invisible"
} px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white`}
>
Spend
</Link>
</div>
<div className='w-1/2 flex justify-center items-center'>
<div className="w-1/2 flex justify-center items-center">
<button
className='px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white'
onClick={() => {
openPopUp({
payment: payment,
currency: walletItem?.description,
});
}}
onClick={() => {
setShowNairaWithdraw(true);
}}
className={`${
walletItem.code != "NAIRA" && "invisible"
} px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white`}
>
{/* <span className="">
<svg
xmlns="http://www.w3.org/2000/svg"
width="38"
height="38"
viewBox="0 0 42 42"
fill="none"
>
<path
d="M21 0C16.8466 0 12.7865 1.23163 9.33303 3.53914C5.8796 5.84665 3.18798 9.1264 1.59854 12.9636C0.00909901 16.8009 -0.406771 21.0233 0.403518 25.0969C1.21381 29.1705 3.21386 32.9123 6.15077 35.8492C9.08767 38.7861 12.8295 40.7862 16.9031 41.5965C20.9767 42.4068 25.1991 41.9909 29.0364 40.4015C32.8736 38.812 36.1534 36.1204 38.4609 32.667C40.7684 29.2135 42 25.1534 42 21C41.994 15.4323 39.7796 10.0944 35.8426 6.15741C31.9056 2.22045 26.5677 0.00602189 21 0ZM28 22.75H22.75V28C22.75 28.4641 22.5656 28.9092 22.2374 29.2374C21.9093 29.5656 21.4641 29.75 21 29.75C20.5359 29.75 20.0908 29.5656 19.7626 29.2374C19.4344 28.9092 19.25 28.4641 19.25 28V22.75H14C13.5359 22.75 13.0908 22.5656 12.7626 22.2374C12.4344 21.9092 12.25 21.4641 12.25 21C12.25 20.5359 12.4344 20.0907 12.7626 19.7626C13.0908 19.4344 13.5359 19.25 14 19.25H19.25V14C19.25 13.5359 19.4344 13.0908 19.7626 12.7626C20.0908 12.4344 20.5359 12.25 21 12.25C21.4641 12.25 21.9093 12.4344 22.2374 12.7626C22.5656 13.0908 22.75 13.5359 22.75 14V19.25H28C28.4641 19.25 28.9093 19.4344 29.2374 19.7626C29.5656 20.0907 29.75 20.5359 29.75 21C29.75 21.4641 29.5656 21.9092 29.2374 22.2374C28.9093 22.5656 28.4641 22.75 28 22.75Z"
// fill="white"
className="stroke-black fill-white"
></path>
</svg>
</span> */}
<span className="">Add Credit</span>
Spend
</button>
</div>
</div>
<div className="w-1/2 flex justify-center items-center">
<button
className="px-4 h-10 flex justify-center items-center btn-gradient text-base rounded-full text-white"
onClick={() => {
openPopUp({
payment: payment,
currency: walletItem?.description,
});
}}
>
<span className="">Add Credit</span>
</button>
</div>
{showNairaWithdraw && (
<NairaWithdraw
wallet={walletItem}
action={() => {
setShowNairaWithdraw((prev) => !prev);
}}
situation={showNairaWithdraw}
setShowConfirmNairaWithdraw={setShowConfirmNairaWithdraw}
/>
)}
{showConfirmNairaWithdraw.show && (
<ConfirmNairaWithdraw
wallet={walletItem}
state={showConfirmNairaWithdraw.state}
action={() => {
setShowConfirmNairaWithdraw((prev) => ({
...prev,
show: !prev.show,
}));
}}
situation={showConfirmNairaWithdraw.show}
/>
)}
</div>
)
);
}
export default WalletAction
export default WalletAction;
+1 -237
View File
@@ -1,7 +1,7 @@
import LoadingSpinner from "../Spinners/LoadingSpinner";
import WalletItemCard from "./WalletItemCard";
export default function WalletBox({ wallet, coupon, payment }) {
export default function WalletBox({ wallet, payment }) {
return (
<>
<div className="my-wallet-wrapper w-full mb-10">
@@ -18,243 +18,7 @@ export default function WalletBox({ wallet, coupon, payment }) {
</div>
))
) : null}
{/*<div className="flex-1">*/}
{/* <CurrentBalanceWidget />*/}
{/*</div>*/}
{/* <div className="flex-1">*/}
{/* <div className="my-wallets w-full h-full bg-white dark:bg-dark-white rounded-lg p-6">*/}
{/* <div className="mb-4">*/}
{/* <h1 className="text-xl font-bold tracking-wide text-dark-gray dark:text-white">*/}
{/* My Wallet*/}
{/* </h1>*/}
{/* </div>*/}
{/* <div className="content-area">*/}
{/* <div className="flex justify-between items-center mb-6">*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div className="account-name flex space-x-4 items-center">*/}
{/* <div className="icon w-14 h-14 transition duration-300 ease-in-out rounded-full flex justify-center items-center bg-light-purple dark:bg-dark-light-purple ">*/}
{/* <img src={bank1} alt="" />*/}
{/* </div>*/}
{/* <div className="name">*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white tracking-wide">*/}
{/* MetaMask*/}
{/* </p>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div>*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white text-right mb-3">*/}
{/* $734.79*/}
{/* </p>*/}
{/* <p className="text-sm text-thin-light-gray">*/}
{/* New Add*/}
{/* <span className="text-light-green ml-1">*/}
{/* +324.75*/}
{/* </span>*/}
{/* </p>*/}
{/* </div>*/}
{/* <div>*/}
{/*<span className="dark:text-thin-light-gray text-[#374557]">*/}
{/* <svg*/}
{/* width="6"*/}
{/* height="26"*/}
{/* viewBox="0 0 6 26"*/}
{/* fill="none"*/}
{/* className="fill-current"*/}
{/* xmlns="http://www.w3.org/2000/svg"*/}
{/* >*/}
{/* <circle cx="3" cy="3" r="3" fillOpacity="0.6" />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="12.75"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="22.5"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* </svg>*/}
{/*</span>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="flex justify-between items-center mb-6">*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div className="account-name flex space-x-4 items-center">*/}
{/* <div className="icon w-14 h-14 transition duration-300 ease-in-out rounded-full flex justify-center items-center bg-light-purple dark:bg-dark-light-purple ">*/}
{/* <img src={bank2} alt="" />*/}
{/* </div>*/}
{/* <div className="name">*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white tracking-wide">*/}
{/* Coinbase Wallet*/}
{/* </p>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div>*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white text-right mb-3">*/}
{/* $734.79*/}
{/* </p>*/}
{/* <p className="text-sm text-thin-light-gray">*/}
{/* New Add*/}
{/* <span className="text-light-green ml-1">*/}
{/* +324.75*/}
{/* </span>*/}
{/* </p>*/}
{/* </div>*/}
{/* <div>*/}
{/*<span className="dark:text-thin-light-gray text-[#374557]">*/}
{/* <svg*/}
{/* width="6"*/}
{/* height="26"*/}
{/* viewBox="0 0 6 26"*/}
{/* fill="none"*/}
{/* className="fill-current"*/}
{/* xmlns="http://www.w3.org/2000/svg"*/}
{/* >*/}
{/* <circle cx="3" cy="3" r="3" fillOpacity="0.6" />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="12.75"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="22.5"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* </svg>*/}
{/*</span>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="flex justify-between items-center mb-6">*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div className="account-name flex space-x-4 items-center">*/}
{/* <div className="icon w-14 h-14 transition duration-300 ease-in-out rounded-full flex justify-center items-center bg-light-purple dark:bg-dark-light-purple ">*/}
{/* <img src={bank3} alt="" />*/}
{/* </div>*/}
{/* <div className="name">*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white tracking-wide">*/}
{/* Bitski*/}
{/* </p>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div>*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white text-right mb-3">*/}
{/* $734.79*/}
{/* </p>*/}
{/* <p className="text-sm text-thin-light-gray">*/}
{/* New Add*/}
{/* <span className="text-light-green ml-1">*/}
{/* +324.75*/}
{/* </span>*/}
{/* </p>*/}
{/* </div>*/}
{/* <div>*/}
{/*<span className="dark:text-thin-light-gray text-[#374557]">*/}
{/* <svg*/}
{/* width="6"*/}
{/* height="26"*/}
{/* viewBox="0 0 6 26"*/}
{/* fill="none"*/}
{/* className="fill-current"*/}
{/* xmlns="http://www.w3.org/2000/svg"*/}
{/* >*/}
{/* <circle cx="3" cy="3" r="3" fillOpacity="0.6" />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="12.75"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="22.5"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* </svg>*/}
{/*</span>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="flex justify-between items-center mb-6">*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div className="account-name flex space-x-4 items-center">*/}
{/* <div className="icon w-14 h-14 transition duration-300 ease-in-out rounded-full flex justify-center items-center bg-light-purple dark:bg-dark-light-purple ">*/}
{/* <img src={bank4} alt="" />*/}
{/* </div>*/}
{/* <div className="name">*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white tracking-wide">*/}
{/* WalletConnect*/}
{/* </p>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* <div className="flex space-x-5 items-center">*/}
{/* <div>*/}
{/* <p className="text-xl font-bold text-dark-gray dark:text-white text-right mb-3">*/}
{/* $734.79*/}
{/* </p>*/}
{/* <p className="text-sm text-thin-light-gray">*/}
{/* New Add*/}
{/* <span className="text-light-green ml-1">*/}
{/* +324.75*/}
{/* </span>*/}
{/* </p>*/}
{/* </div>*/}
{/* <div>*/}
{/*<span className="dark:text-thin-light-gray text-[#374557]">*/}
{/* <svg*/}
{/* width="6"*/}
{/* height="26"*/}
{/* viewBox="0 0 6 26"*/}
{/* fill="none"*/}
{/* className="fill-current"*/}
{/* xmlns="http://www.w3.org/2000/svg"*/}
{/* >*/}
{/* <circle cx="3" cy="3" r="3" fillOpacity="0.6" />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="12.75"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* <circle*/}
{/* cx="3"*/}
{/* cy="22.5"*/}
{/* r="3"*/}
{/* fillOpacity="0.6"*/}
{/* />*/}
{/* </svg>*/}
{/*</span>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
{/* </div>*/}
</div>
{/* flex space-x-11 */}
{/*<div className="recent-and-investment grid lg:grid-cols-2 grid-cols-1 2xl:gap-[40px] xl:gap-7 gap-4 lg:h-[416px] w-full justify-between">*/}
{/* <div className=" h-full">*/}
{/* <RecentTransactionWidget />*/}
{/* </div>*/}
{/* <div className=" h-full">*/}
{/* <InvestmentSection />*/}
{/* </div>*/}
{/*</div>*/}
</div>
</div>
</>
File diff suppressed because it is too large Load Diff
@@ -166,22 +166,22 @@ export default function ManageInterestOffer(props) {
<div className="w-full">
{/* switch button */}
<div className="my-1 flex items-center border-b border-slate-300">
<div className="pl-7 my-2 flex items-center border-b border-slate-300 gap-3">
<button
name="info"
onClick={(e) => setTab(e.target.name)}
className={`p-2 text-lg font-bold text-slate-600 dark:text-white border ${
tab == "info" ? "border-sky-blue" : "border-slate-300"
} tracking-wide transition duration-200`}
className={`px-4 py-1 rounded-t-2xl ${
tab == "info" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
}`}
>
Info
</button>
<button
name="message"
onClick={(e) => setTab(e.target.name)}
className={`p-2 text-lg font-bold text-slate-600 dark:text-white border ${
tab == "message" ? "border-sky-blue" : "border-slate-300"
} tracking-wide transition duration-200`}
className={`px-4 py-1 rounded-t-2xl ${
tab == "message" ? "bg-[#4687ba] border-[2px] border-[#4687ba] text-white" : "bg-white text-[#000] border-t-[2px]"
}`}
>
Messages ({messageList.data.length})
</button>
+1 -1
View File
@@ -1,7 +1,7 @@
const PaginatedList = ({ onClick, prev, next, data, start, stop }) => {
if (data?.length > process.env.REACT_APP_ITEM_PER_PAGE) {
return (
<div className="p-3 flex justify-center items-center min-h-[70px] space-x-2 border-t-2">
<div className="p-3 flex justify-center items-center min-h-[70px] space-x-2 border-t-2 w-full">
{/* Render pagination buttons */}
{!prev && (
<button
+87 -283
View File
@@ -1,4 +1,4 @@
import React, { useContext, useState, useEffect } from "react";
import React, { useContext, useEffect, useMemo, useState } from "react";
import { Link, useLocation } from "react-router-dom";
import bank1 from "../../assets/images/bank-1.png";
import bank2 from "../../assets/images/bank-2.png";
@@ -6,28 +6,31 @@ import bank3 from "../../assets/images/bank-3.png";
import bank4 from "../../assets/images/bank-4.png";
import profileImg from "../../assets/images/profile-pic.jpg";
import useToggle from "../../hooks/useToggle";
import usersService from "../../services/UsersService";
import DarkModeContext from "../Contexts/DarkModeContext";
import Icons from "../Helpers/Icons";
import ModalCom from "../Helpers/ModalCom";
import SearchCom from "../Helpers/SearchCom";
import WalletHeader from "../MyWallet/WalletHeader";
import usersService from "../../services/UsersService";
import siteLogo from "../../assets/images/wrenchboard.png";
import { useDispatch, useSelector } from "react-redux";
import Flag from "../../assets/images/united-states.svg";
import { useSelector } from "react-redux";
import siteLogo from "../../assets/images/wrenchboard.png";
import formattedDate from "../../lib/fomattedDate";
import { updateNotifications } from "../../store/notifications";
import TimeDifference from "../Helpers/TimeDifference";
export default function Header({ logoutModalHandler, sidebarHandler }) {
const [balanceDropdown, setbalanceValue] = useToggle(false);
const [notificationDropdown, setNotificationValue] = useToggle(false);
const [userProfileDropdown, setProfileDropdown] = useToggle(false);
const [moneyPopup, setPopup] = useToggle(false);
const [toggleNotification, setToggleNotification] = useToggle(false);
const darkMode = useContext(DarkModeContext);
const { userDetails } = useSelector((state) => state?.userDetails);
const [myWalletList, setMyWalletList] = useState([]);
const api = new usersService();
const api = useMemo(() => new usersService(), []);
const dispatch = useDispatch();
const { notifications } = useSelector((state) => state?.notifications); // NOTIFICATION STORE
const getMyWalletList = async () => {
try {
@@ -85,10 +88,6 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
setbalanceValue.set(false);
};
const setNotification = () => {
setToggleNotification.toggle();
};
// getting the location of head
let { pathname } = useLocation();
@@ -102,6 +101,8 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
let { firstname, lastname, email, profile_pic } = userDetails;
let userEmail = email?.split("@")[0];
// console.log("Notify: ", notifications?.data?.raw);
return (
<>
<div className="header-wrapper backdrop-blur-sm bg-[#efedfe5e]/60 dark:bg-transparent w-full h-full flex items-center xl:px-0 md:px-10 px-5">
@@ -251,8 +252,10 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
className="lg:w-[48px] lg:h-[48px] w-[38px] h-[38px] bg-white flex justify-center items-center rounded-full overflow-hidden relative"
>
<Icons name="notification" />
<span className="absolute right-2 top-2 z-10 text-xs lg:w-5 lg:h-5 w-4 h-4 flex justify-center items-center rounded-full primary-gradient text-white">
10
<span className="absolute right-2 top-2 z-10 text-xs lg:w-5 lg:h-5 w-4 h-4 flex justify-center items-center rounded-full primary-gradient text-white cursor-default">
{notifications?.loading
? "●"
: notifications?.data?.length}
</span>
</div>
<div
@@ -265,190 +268,51 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
Recent Notifications
</h3>
</div>
<div className="content px-7 pb-7">
<ul>
<li className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple">
<div className="notifications flex space-x-4 items-center">
<div className="icon">
<svg
width="52"
height="52"
viewBox="0 0 52 52"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="26" cy="26" r="26" fill="#27AE60" />
<path
d="M21.5404 30.2033C22.185 29.6102 22.818 29.0287 23.451 28.4456C27.4582 24.759 31.4637 21.0724 35.4709 17.3859C35.7849 17.0968 36.0973 16.8044 36.4146 16.517C36.697 16.2611 37.021 16.0834 37.4014 16.0186C38.2055 15.884 38.782 16.4987 38.5877 17.2878C38.5112 17.5985 38.3634 17.8776 38.1574 18.1202C33.9574 23.0362 29.7575 27.9505 25.5576 32.8648C24.5641 34.0261 23.5739 35.1891 22.5787 36.3487C22.3129 36.6594 21.9906 36.8903 21.5786 36.9734C21.2347 37.0431 20.9091 36.975 20.6316 36.779C20.399 36.6145 20.1631 36.4284 19.9937 36.2041C17.7708 33.2237 15.5562 30.2365 13.3465 27.2461C13.0757 26.8789 12.9462 26.4486 13.0209 25.9901C13.1422 25.2342 14.046 24.7274 14.8085 24.9982C15.0445 25.083 15.2721 25.2225 15.4698 25.3787C17.4634 26.957 19.4504 28.5453 21.4391 30.1302C21.4673 30.1535 21.4972 30.1734 21.5404 30.2033Z"
fill="white"
/>
</svg>
</div>
<div className="name">
<p className="text-base text-dark-gray dark:text-white font-medium mb-2">
Your Account has been created
<span className="ml-1 font-bold">
successfully done
</span>
</p>
<p className="text-sm text-thin-light-gray font-medium">
23 house ago
</p>
</div>
</div>
</li>
<li className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple">
<div className="notifications flex space-x-4 items-center">
<div className="icon">
<svg
width="52"
height="52"
viewBox="0 0 52 52"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="26" cy="26" r="26" fill="#5356FB" />
<path
d="M25.9481 24.3684C25.4776 24.213 25.0352 24.1246 24.6425 23.9303C21.1636 22.2082 17.6912 20.4687 14.2167 18.7379C13.962 18.6106 13.7656 18.4466 13.7613 18.1423C13.757 17.8251 13.9534 17.6481 14.221 17.5143C17.6718 15.7943 21.1226 14.07 24.5712 12.3456C25.564 11.8493 26.5416 11.9054 27.5214 12.3996C29.7377 13.5153 31.9627 14.6203 34.1834 15.7295C35.3164 16.295 36.4473 16.8625 37.5781 17.4301C37.6429 17.4625 37.7076 17.4927 37.7745 17.5251C38.0335 17.6459 38.2126 17.8337 38.2126 18.1337C38.2126 18.438 38.0205 18.6084 37.7659 18.7336C36.1581 19.5343 34.5525 20.3392 32.9447 21.1399C31.0887 22.0657 29.2414 23.0045 27.3746 23.9066C26.93 24.1224 26.4272 24.2173 25.9481 24.3684Z"
fill="white"
/>
<path
d="M25.0538 33.4541C25.0538 35.3834 25.056 37.3128 25.0517 39.2421C25.0495 39.9284 24.6632 40.1701 24.0309 39.8787C20.8671 38.422 17.7012 36.9696 14.5439 35.5021C13.5274 35.0295 13.0095 34.2029 13.0052 33.085C12.9965 29.4076 13.0008 25.7302 13.003 22.0528C13.003 21.3428 13.4023 21.0795 14.0367 21.373C17.3084 22.8815 20.5779 24.3987 23.8518 25.9007C24.6827 26.2827 25.0668 26.9042 25.0603 27.8128C25.0474 29.6947 25.056 31.5744 25.056 33.4562C25.056 33.4541 25.056 33.4541 25.0538 33.4541Z"
fill="white"
/>
<path
d="M26.9187 33.4002C26.9187 31.5076 26.923 29.6149 26.9165 27.7223C26.9144 26.8676 27.305 26.2785 28.0711 25.9246C31.3644 24.4053 34.6598 22.8903 37.953 21.3731C38.553 21.0969 38.9652 21.3451 38.9652 21.999C38.9695 25.7131 38.976 29.425 38.9609 33.1391C38.9566 34.2764 38.3739 35.0706 37.3488 35.5454C34.7893 36.728 32.2276 37.9085 29.6681 39.089C29.1199 39.3415 28.5739 39.594 28.0279 39.8465C27.2855 40.1875 26.9165 39.9565 26.9165 39.1494C26.9165 37.233 26.9165 35.3145 26.9165 33.3981C26.9187 33.4002 26.9187 33.4002 26.9187 33.4002Z"
fill="white"
/>
</svg>
</div>
<div className="name">
<p className="text-base text-dark-gray dark:text-white font-medium mb-2">
You upload your frast product
<span className="ml-1 font-bold">
successfully done
</span>
</p>
<p className="text-sm text-thin-light-gray font-medium">
23 house ago
</p>
</div>
</div>
</li>
<li className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple">
<div className="notifications flex space-x-4 items-center">
<div className="icon">
<svg
width="52"
height="52"
viewBox="0 0 52 52"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="26" cy="26" r="26" fill="#F539F8" />
<path
d="M36.2507 24.2795C35.8857 25.5416 35.5884 26.7445 35.1694 27.9018C35.0663 28.1874 34.5662 28.505 34.2452 28.5084C30.4894 28.5523 26.7335 28.5371 22.9777 28.5388C22.4218 28.5388 22.067 28.2651 21.9403 27.7329C21.3456 25.2459 20.7458 22.7589 20.1781 20.2668C20.0058 19.5133 20.3488 19.0487 21.0753 19.0436C24.1367 19.0233 27.1981 19.0352 30.3356 19.0352C30.2984 20.6605 30.7411 22.0814 31.9728 23.1644C33.1774 24.2305 34.6017 24.5481 36.2507 24.2795Z"
fill="white"
/>
<path
d="M21.1615 29.4088C23.689 29.4088 26.1726 29.4088 28.6562 29.4088C30.2816 29.4088 31.9069 29.4054 33.5322 29.4105C34.2891 29.4122 34.7183 29.7518 34.7385 30.338C34.7588 30.9547 34.3162 31.3298 33.5288 31.3298C29.2256 31.3332 24.924 31.3332 20.6208 31.3298C19.749 31.3298 19.5074 31.1169 19.3165 30.2367C18.4987 26.4555 17.6743 22.676 16.8717 18.8914C16.7771 18.4471 16.6031 18.197 16.1452 18.0568C15.096 17.7358 14.0671 17.3472 13.0314 16.9823C12.1613 16.6748 11.8386 16.2051 12.0751 15.6019C12.3083 15.0055 12.8135 14.8535 13.6397 15.1407C14.9254 15.5867 16.1993 16.0665 17.4985 16.472C18.1541 16.6765 18.4666 17.0465 18.6052 17.7088C19.3976 21.4714 20.2204 25.2272 21.0364 28.9847C21.0601 29.0962 21.1006 29.2077 21.1615 29.4088Z"
fill="white"
/>
<path
d="M30.9336 19.6116C30.9218 17.2665 32.8225 15.3607 35.1676 15.3692C37.4654 15.3759 39.3577 17.2851 39.3543 19.5947C39.3509 21.8975 37.4519 23.8016 35.149 23.8067C32.8479 23.8118 30.9455 21.9195 30.9336 19.6116ZM36.9416 17.7396C36.1797 18.5556 35.4329 19.3565 34.5459 20.3077C34.1218 19.7315 33.7788 19.2686 33.3869 18.7381C32.9932 19.1503 32.733 19.4224 32.5641 19.6015C33.2838 20.3448 33.9714 21.0528 34.6067 21.71C35.6373 20.676 36.6983 19.6133 37.8489 18.4593C37.6614 18.3106 37.4367 18.1316 37.2103 17.9525C37.1393 17.8933 37.0667 17.8393 36.9416 17.7396Z"
fill="white"
/>
<path
d="M32.4861 32.1105C33.9779 32.097 35.1944 33.2695 35.2231 34.7495C35.2518 36.2549 34.0286 37.4899 32.5114 37.4899C31.0297 37.4899 29.8183 36.2853 29.8115 34.8103C29.8065 33.3286 30.9993 32.1257 32.4861 32.1105ZM33.7059 34.7918C33.7042 34.1379 33.1906 33.6074 32.5452 33.5939C31.8761 33.5787 31.3186 34.1312 31.322 34.8053C31.3254 35.4524 31.8474 35.9896 32.4861 36.0065C33.1551 36.0234 33.7093 35.4726 33.7059 34.7918Z"
fill="white"
/>
<path
d="M21.557 37.4897C20.0668 37.4779 18.8707 36.28 18.874 34.8017C18.8791 33.276 20.0871 32.0917 21.6212 32.1086C23.1012 32.1255 24.289 33.3453 24.2721 34.8304C24.2535 36.3155 23.0438 37.4999 21.557 37.4897ZM22.7667 34.8034C22.7684 34.1242 22.2142 33.5785 21.5401 33.5954C20.9049 33.6123 20.3625 34.1614 20.3625 34.7932C20.3608 35.4268 20.8981 35.9827 21.53 36.0046C22.2007 36.0283 22.765 35.4792 22.7667 34.8034Z"
fill="white"
/>
</svg>
</div>
<div className="name">
<p className="text-base text-dark-gray dark:text-white font-medium mb-2">
<span className="ml-1 font-bold">Thank you !</span>
you made your frast sell
<span className="ml-1 font-bold">232.98 ETH</span>
</p>
<p className="text-sm text-thin-light-gray font-medium">
23 house ago
</p>
</div>
</div>
</li>
<li className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple">
<div className="notifications flex space-x-4 items-center">
<div className="icon">
<svg
width="52"
height="52"
viewBox="0 0 52 52"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="26" cy="26" r="26" fill="#56CCF2" />
<path
d="M23.1046 14.0017C24.5421 14.0092 25.6981 14.1643 26.7653 14.7031C28.6197 15.6394 29.6086 17.1912 29.8931 19.2172C30.0752 20.5117 29.9292 21.7911 29.6191 23.0509C29.2443 24.5682 28.7386 26.0388 27.9348 27.3889C27.4215 28.2514 26.7833 29.007 25.9223 29.5474C24.3253 30.5513 22.3942 30.449 20.8228 29.287C19.8745 28.5855 19.2017 27.6598 18.6703 26.6228C17.9102 25.1356 17.4842 23.5431 17.1907 21.9085C17.0236 20.9798 16.9664 20.0526 17.117 19.1179C17.5053 16.6975 18.9021 15.1366 21.19 14.3344C21.8929 14.0875 22.6185 13.9852 23.1046 14.0017Z"
fill="white"
/>
<path
d="M31.4126 39.0001C31.3434 39.0001 31.2847 39.0001 31.2245 39.0001C24.8936 39.0001 18.5628 39.0001 12.2319 39.0001C12.0061 39.0001 11.9986 39.0001 12.0001 38.7788C12.0062 37.8727 11.9926 36.9636 12.0317 36.0589C12.0739 35.1197 12.5601 34.4032 13.2901 33.8418C14.0126 33.2879 14.8465 32.9688 15.7059 32.7039C17.4248 32.174 19.192 31.9016 20.9786 31.7481C22.538 31.6141 24.1004 31.6081 25.6628 31.6924C26.0842 31.7149 26.5027 31.7691 26.9241 31.7962C27.0731 31.8068 27.1078 31.8655 27.1078 32.0085C27.1032 33.4098 27.4073 34.7374 28.1223 35.9521C28.8703 37.224 29.9134 38.1858 31.2245 38.8616C31.2802 38.8902 31.3359 38.9173 31.3915 38.9474C31.3991 38.9534 31.3991 38.967 31.4126 39.0001Z"
fill="white"
/>
<path
d="M29.4634 30.8568C29.5432 30.8568 29.6109 30.8568 29.6786 30.8568C30.6886 30.8568 31.6971 30.8568 32.7071 30.8568C32.9328 30.8568 32.9344 30.8568 32.9344 30.622C32.9344 29.612 32.9344 28.6035 32.9344 27.5935C32.9344 27.5273 32.9344 27.4596 32.9344 27.3828C33.9278 27.3828 34.8986 27.3828 35.8936 27.3828C35.8936 28.5388 35.8936 29.6858 35.8936 30.8553C37.0646 30.8553 38.2116 30.8553 39.3691 30.8553C39.3691 31.8322 39.3691 32.788 39.3691 33.7648C38.2161 33.7648 37.0676 33.7648 35.8951 33.7648C35.8951 34.9404 35.8951 36.0934 35.8951 37.2584C35.8168 37.2629 35.7611 37.2689 35.7054 37.2689C34.8444 37.2689 33.9835 37.2659 33.1225 37.2734C32.972 37.2749 32.9298 37.2328 32.9298 37.0823C32.9359 36.0557 32.9328 35.0292 32.9328 34.0027C32.9328 33.9349 32.9328 33.8672 32.9328 33.7754C31.7693 33.7754 30.6224 33.7754 29.4634 33.7754C29.4634 32.794 29.4634 31.8397 29.4634 30.8568Z"
fill="white"
/>
</svg>
</div>
<div className="name">
<p className="text-base text-dark-gray dark:text-white font-medium mb-2">
Your Account has been created
<span className="ml-1 font-bold">
successfully done
</span>
</p>
<p className="text-sm text-thin-light-gray font-medium">
23 house ago
</p>
</div>
</div>
</li>
<li className="content-item py-5">
<div className="notifications flex space-x-4 items-center">
<div className="icon">
<svg
width="52"
height="52"
viewBox="0 0 52 52"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<circle cx="26" cy="26" r="26" fill="#9B51E0" />
<path
d="M32.8582 12.0043C33.1083 12.133 33.182 12.3469 33.1777 12.6144C33.169 13.1493 33.1748 13.6856 33.1748 14.2551C33.2962 14.2551 33.3931 14.2551 33.4899 14.2551C34.7664 14.2566 36.0414 14.2566 37.3179 14.258C38.0581 14.2595 38.3833 14.5978 38.3674 15.3365C38.3269 17.1449 38.1404 18.9346 37.6142 20.6737C37.2124 22.0051 36.6457 23.2483 35.602 24.2154C34.9558 24.8139 34.1925 25.1782 33.3165 25.2866C33.1517 25.3068 33.0953 25.3661 33.0606 25.5295C32.4737 28.2963 30.8314 30.1019 28.1209 30.9288C28.0038 30.9649 27.9099 30.9924 27.9099 31.1558C27.9157 32.8688 27.9157 34.5819 27.9171 36.2949C27.9171 36.3209 27.9287 36.3469 27.9417 36.399C28.0328 36.4033 28.1296 36.412 28.2265 36.412C28.8004 36.4134 29.3743 36.4163 29.9482 36.4106C30.1968 36.4077 30.3804 36.4958 30.525 36.7055C31.1032 37.5454 31.6901 38.3809 32.2742 39.2165C32.3942 39.3885 32.5113 39.5894 32.3537 39.7629C32.2409 39.8858 32.0356 39.987 31.8708 39.9884C28.0805 40.0014 24.2886 39.9971 20.4982 40C20.2959 40 20.1166 39.9653 20.0082 39.7716C19.8925 39.5634 19.9764 39.39 20.0978 39.2165C20.6775 38.3881 21.2586 37.5613 21.8296 36.7271C21.9858 36.5002 22.1824 36.4077 22.4498 36.4106C23.1047 36.4178 23.7595 36.412 24.4433 36.412C24.4491 36.2949 24.4578 36.198 24.4578 36.1012C24.4592 34.4879 24.4549 32.876 24.4621 31.2627C24.4635 31.0589 24.4086 30.9736 24.199 30.9086C21.5651 30.0875 19.9316 28.3325 19.3374 25.6335C19.2839 25.3907 19.2015 25.3083 18.9457 25.2678C17.6865 25.0726 16.7382 24.3744 16.0111 23.3524C15.1712 22.1713 14.7332 20.8254 14.4382 19.4275C14.152 18.0701 14.0205 16.6924 14.0002 15.3047C13.9901 14.579 14.3226 14.2551 15.0526 14.2537C16.319 14.2523 17.5868 14.2508 18.8531 14.2508C18.9529 14.2508 19.0526 14.2508 19.1957 14.2508C19.1957 13.9949 19.1957 13.7535 19.1957 13.5121C19.1957 13.2114 19.203 12.9107 19.1943 12.61C19.1856 12.3426 19.2637 12.1272 19.5138 12C23.9619 12.0043 28.4101 12.0043 32.8582 12.0043ZM26.1853 16.6086C25.9092 17.1666 25.62 17.6465 25.4307 18.1641C25.2283 18.7177 24.8871 18.9404 24.3089 18.9635C23.7624 18.9866 23.2203 19.1124 22.6305 19.1991C22.7259 19.3003 22.7852 19.3654 22.8488 19.4275C23.3114 19.88 23.7812 20.3253 24.2308 20.7893C24.3146 20.876 24.3681 21.0423 24.3551 21.1623C24.3161 21.5237 24.2351 21.8793 24.173 22.2378C24.1108 22.6064 24.0515 22.9765 23.9836 23.3928C24.6703 23.0314 25.3107 22.7062 25.9395 22.3592C26.1231 22.258 26.2604 22.2682 26.4382 22.365C27.0671 22.7091 27.706 23.0358 28.3609 23.3784C28.3609 23.2974 28.3681 23.2439 28.3595 23.1948C28.2453 22.5313 28.1383 21.8663 28.0096 21.2056C27.972 21.0105 28.014 20.8847 28.1571 20.7517C28.543 20.3918 28.9146 20.0145 29.2948 19.6473C29.435 19.5114 29.5824 19.3827 29.7834 19.2006C28.9999 19.0878 28.3103 18.9808 27.6179 18.8912C27.3938 18.8623 27.2492 18.7929 27.1466 18.5645C26.856 17.9256 26.5279 17.2982 26.1853 16.6086ZM36.6442 16.013C35.4661 16.013 34.3269 16.013 33.195 16.013C33.195 18.537 33.195 21.0365 33.195 23.6053C33.4986 23.4767 33.779 23.3928 34.0219 23.2468C34.7982 22.7799 35.2406 22.0398 35.5832 21.2331C36.053 20.1287 36.3089 18.9664 36.465 17.7824C36.5402 17.197 36.5835 16.61 36.6442 16.013ZM19.1798 23.5548C19.1798 21.0264 19.1798 18.5197 19.1798 16.0072C18.0291 16.0072 16.8972 16.0072 15.7581 16.0072C15.7552 16.0607 15.7494 16.0954 15.7509 16.1301C15.839 17.5786 16.0328 19.0098 16.4794 20.3947C16.7512 21.236 17.0909 22.0528 17.7053 22.7163C18.1029 23.1471 18.5698 23.4579 19.1798 23.5548Z"
fill="white"
/>
</svg>
</div>
<div className="name">
<p className="text-base text-dark-gray dark:text-white font-medium mb-2">
Your Account has been created
<span className="ml-1 font-bold">
successfully done
</span>
</p>
<p className="text-sm text-thin-light-gray font-medium">
23 house ago
</p>
</div>
</div>
</li>
{notifications?.data?.length && notifications?.data?.map((item, idx) =>
{
if(idx < 5){
return (
<li
className={`content-item ${
idx == 4
? "py-5 "
: "py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple"
}`}
key={idx}
>
<div className="notifications flex space-x-4 items-center">
<div className="icon max-w-[52px] max-h-[52px] w-full h-full rounded-full object-cover">
<img
src={require(`../../assets/images/notifications/${item?.icon}`)}
alt="icon"
className="w-full h-full"
/>
</div>
<div className="name">
<p className="text-base text-dark-gray dark:text-white font-medium mb-2">
{item?.title}
{/* <span className="ml-1 font-bold">
successfully done
</span> */}
</p>
<p className="text-sm text-thin-light-gray font-medium">
<TimeDifference
time={item?.date}
key={item?.uid}
/>
</p>
</div>
</div>
</li>
)
}
})
}
</ul>
<div className="add-money-btn flex justify-center items-center">
<Link
to="/notification"
@@ -472,10 +336,10 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
</Link>
</div>
{/* profile */}
<div className="user-profile relative lg:block hidden">
<div className="user-profile relative">
<div
onClick={() => handlerProfile()}
className="flex items-center space-x-3.5"
className="hidden lg:flex items-center space-x-3.5"
>
{/* profile-image */}
<div className="lg:w-[62px] lg:h-[62px] w-[50px] h-[50px] rounded-full overflow-hidden">
@@ -489,9 +353,26 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
<h1 className="text-xl font-bold text-dark-gray dark:text-white">
{firstname}
</h1>
{userDetails && userDetails?.account_type !== "FAMILY" && <p className="text-sm text-thin-light-gray">@{userEmail}</p>}
{userDetails && userDetails?.account_type !== "FAMILY" && (
<p className="text-sm text-thin-light-gray">@{userEmail}</p>
)}
</div>
</div>
<div className="for-mobile-profile lg:hidden block">
<div
// to="/profile"
onClick={() => handlerProfile()}
className="lg:w-[62px] lg:h-[62px] w-[50px] h-[50px] rounded-full overflow-hidden block"
>
<img
src={profileImg}
alt="profile"
className="w-full h-full"
/>
</div>
</div>
<div
className={`profile-dropdown w-[293px] z-30 bg-white dark:bg-dark-white absolute lg:right-16 -right-[16px] rounded-lg ${
userProfileDropdown ? "active" : ""
@@ -502,7 +383,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
</div>
<div className="heading border-b dark:border-[#5356fb29] border-light-purple px-7 py-2">
<h3 className="text-xl font-bold text-dark-gray dark:text-white">
{`${firstname} ${lastname}`}
{`${firstname} ${lastname}`}
</h3>
</div>
<div className="content">
@@ -529,84 +410,6 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
</li>
{userDetails && userDetails?.account_type !== "FAMILY" && (
<>
<li className="content-item relative my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="#" className="notifications">
<div className="name">
<p className="flex items-center justify-between text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
<span>Reports</span> <span>&gt;</span>
</p>
</div>
</Link>
{/* report list items*/}
<div
className="inner-list-items absolute rounded-lg"
onClick={setNotification}
>
<ul className="p-3">
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="/referral" className="notifications">
<div className="name">
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
Referrals
</p>
</div>
</Link>
</li>
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="#" className="notifications">
<div className="name">
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
Billing
</p>
</div>
</Link>
</li>
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="#" className="notifications">
<div className="name">
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
Payments
</p>
</div>
</Link>
</li>
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="#" className="notifications">
<div className="name">
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
Completed Jobs
</p>
</div>
</Link>
</li>
<li className="content-item my-1 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="#" className="notifications">
<div className="name">
<p className="text-sm py-1 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
Previous Task
</p>
</div>
</Link>
</li>
</ul>
<hr />
<div className="px-7 py-3 cursor-pointer flex items-center">
<div
className={`h-6 w-8 mr-1 p-1 ${
toggleNotification
? "bg-sky-blue flex justify-end items-center"
: "bg-slate-200"
} rounded-full transition`}
>
<div className="w-4 h-full bg-white rounded-full"></div>
</div>
<p className="text-sm py-2 px-4 text-slate-400 dark:text-white">
Notifications
</p>
</div>
</div>
{/* end report list items*/}
</li>
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg">
<Link to="#" className="notifications">
<div className="name">
@@ -675,7 +478,7 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
<li className="content-item my-2 hover:bg-slate-100 transition duration-500 rounded-lg cursor-pointer">
<div className="name" onClick={logoutModalHandler}>
<p className="text-sm py-2 px-4 text-dark-gray dark:text-white hover:text-sky-blue transition font-medium">
Sign Out
{process.env.REACT_APP_LOGOUT_TEXT}
</p>
</div>
</li>
@@ -684,14 +487,15 @@ export default function Header({ logoutModalHandler, sidebarHandler }) {
</div>
</div>
</div>
<div className="for-mobile-profile lg:hidden block">
<Link
to="/profile"
{/* <div className="for-mobile-profile lg:hidden block">
<div
// to="/profile"
onClick={() => handlerProfile()}
className="lg:w-[62px] lg:h-[62px] w-[50px] h-[50px] rounded-full overflow-hidden block"
>
<img src={profileImg} alt="profile" className="w-full h-full" />
</Link>
</div>
</div>
</div> */}
</div>
</div>
</div>
+1 -2
View File
@@ -8,7 +8,6 @@ import Header from "./Header";
import MobileSidebar from "./MobileSideBar";
import RightSideBar from "./RightSideBar";
import Sidebar from "./Sidebar";
import usersService from "../../services/UsersService";
export default function Layout({ children }) {
const { drawer } = useSelector((state) => state.drawer);
@@ -179,7 +178,7 @@ export default function Layout({ children }) {
type="button"
className="text-white primary-gradient text-18 tracking-wide px-4 py-3 rounded-full"
>
Yes Logout
{`Yes ${process.env.REACT_APP_LOGOUT_TEXT}`}
</button>
<button
onClick={logoutModalHandler}
+67 -64
View File
@@ -8,7 +8,12 @@ import {
import DarkModeContext from "../Contexts/DarkModeContext";
import Icons from "../Helpers/Icons";
export default function MobileSidebar({ sidebar, action, logoutModalHandler, myJobList }) {
export default function MobileSidebar({
sidebar,
action,
logoutModalHandler,
myJobList,
}) {
let { userDetails } = useSelector((state) => state.userDetails);
const darkMode = useContext(DarkModeContext);
@@ -110,74 +115,72 @@ export default function MobileSidebar({ sidebar, action, logoutModalHandler, myJ
{/* menu and settings item */}
{userDetails?.account_type !== "FAMILY" && (
<div
className={`menu-item transition-all duration-300 ease-in-out ${
sidebar ? "mb-5" : "mb-2"
}`}
>
<div className="heading mb-5">
<h1 className="title text-xl font-bold text-sky-blue">
Family
</h1>
</div>
<div className="items">
<ul className="flex flex-col space-y-6">
<ListItem
title="Family Corner"
route="/acc-family"
iconName="new-family"
sidebar={sidebar}
/>
</ul>
</div>
</div>
<div
className={`menu-item transition-all duration-300 ease-in-out ${
sidebar ? "mb-5" : "mb-2"
}`}
>
<div className="heading mb-5">
<h1 className="title text-xl font-bold text-sky-blue">Family</h1>
</div>
<div className="items">
<ul className="flex flex-col space-y-6">
<ListItem
title="Family Corner"
route="/acc-family"
iconName="new-family"
sidebar={sidebar}
/>
</ul>
</div>
</div>
)}
{userDetails?.account_type !== "FAMILY" && (
<>
{!userDetails?.post_jobs ? (
<div
className={`menu-item transition-all duration-300 ease-in-out bg-[#f0f8ff] dark:bg-dark-white rounded-2xl p-3 ${
sidebar ? "mb-5" : "mb-2 rounded-none p-0"
}`}
>
<div className="heading mb-5">
<h1 className="title text-xl font-bold text-sky-blue">
Job Post
</h1>
</div>
<div className="items">
<ul className="flex flex-col space-y-6">
<li className="item group">
<NavLink
to="/start-job"
className={`nav-item flex items-center ${
((navData) => (navData.isActive ? "active" : ""),
sidebar
? "justify-start space-x-3.5"
: "justify-center")
<div
className={`menu-item transition-all duration-300 ease-in-out bg-[#f0f8ff] dark:bg-dark-white rounded-2xl p-3 ${
sidebar ? "mb-5" : "mb-2 rounded-none p-0"
}`}
>
<div className="heading mb-5">
<h1 className="title text-xl font-bold text-sky-blue">
Job Post
</h1>
</div>
<div className="items">
<ul className="flex flex-col space-y-6">
<li className="item group">
<NavLink
to="/start-job"
className={`nav-item flex items-center ${
((navData) => (navData.isActive ? "active" : ""),
sidebar
? "justify-start space-x-3.5"
: "justify-center")
}`}
>
<span className="item-icon group-hover:bg-purple group-hover:text-white w-8 h-8 flex justify-center items-center transition-all duration-300 ease-in-out bg-light-purple dark:bg-dark-light-purple rounded-full text-dark-gray dark:text-white dark:text-lighter-gray">
<Icons name="people-two" />
</span>
<span
className={`item-content group-hover:text-sky-blue text-[18px] transition-all duration-300 ease-in-out text-lighter-gray relative font-medium ${
sidebar ? "active flex-1" : "w-0"
}`}
>
<span className="item-icon group-hover:bg-purple group-hover:text-white w-8 h-8 flex justify-center items-center transition-all duration-300 ease-in-out bg-light-purple dark:bg-dark-light-purple rounded-full text-dark-gray dark:text-white dark:text-lighter-gray">
<Icons name="people-two" />
</span>
<span
className={`item-content group-hover:text-sky-blue text-[18px] transition-all duration-300 ease-in-out text-lighter-gray relative font-medium ${
sidebar ? "active flex-1" : "w-0"
}`}
>
Enable Job Post
</span>
</NavLink>
</li>
</ul>
</div>
Enable Job Post
</span>
</NavLink>
</li>
</ul>
</div>
</div>
) : myJobList?.data?.result_list?.length ? (
<div
className={`menu-item transition-all duration-300 ease-in-out ${
sidebar ? "mb-5" : "mb-2"
}`}
className={`menu-item transition-all duration-300 ease-in-out ${
sidebar ? "mb-5" : "mb-2"
}`}
>
<div className="heading mb-5">
<h1 className="title text-xl font-bold text-sky-blue">
@@ -212,9 +215,9 @@ export default function MobileSidebar({ sidebar, action, logoutModalHandler, myJ
</div>
) : (
<div
className={`menu-item transition-all duration-300 ease-in-out ${
sidebar ? "mb-5" : "mb-2"
}`}
className={`menu-item transition-all duration-300 ease-in-out ${
sidebar ? "mb-5" : "mb-2"
}`}
>
<div className="heading mb-5">
<h1 className="title text-xl font-bold text-sky-blue">
@@ -245,14 +248,14 @@ export default function MobileSidebar({ sidebar, action, logoutModalHandler, myJ
className="signout-btn flex items-center space-x-1 p-2.5 w-2/3 h-[52px] bg-sky-blue transition duration-300 ease-in-out hover:bg-gray-900 rounded-full"
>
<span className="">
<Icons name='new-logout' />
<Icons name="new-logout" />
</span>
<span
className={`signout-btn-content text-white text-xl font-bold ${
sidebar ? "active" : ""
}`}
>
Signout
{process.env.REACT_APP_LOGOUT_TEXT}
</span>
</button>
) : (
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -66,6 +66,7 @@ export default function Resources(props) {
return blogItems?.blogdata?.length
}else if(name == 'onsale'){
return onSaleProducts?.length
// return null
}else if(name == 'owned'){
return ownProducts?.length
}else if(name == 'created'){
@@ -88,6 +89,7 @@ export default function Resources(props) {
>
{tabValue.content}
</span>
{tabValue.name != 'onsale' &&
<span
className={`w-5 h-5 group-hover:bg-pink group-hover:text-white text-[10px] rounded-full absolute -top-2 -right-5 flex justify-center items-center ${
isActive
@@ -95,9 +97,9 @@ export default function Resources(props) {
: "text-thin-light-gray bg-[#F2B8FD]"
}`}
>
{/* 16 blog, onsale, owned,created */}
{countNumber(tabValue.name)}
</span>
}
</li>
);
};
+27 -9
View File
@@ -1,26 +1,44 @@
import ProductCardStyleTwo from "../../Cards/ProductCardStyleTwo";
import DataIteration from "../../Helpers/DataIteration";
import SearchCom from "../../Helpers/SearchCom";
import localImgLoad from "../../../lib/localImgLoad";
export default function QuestionsTab({ className, products }) {
return (
<>
<div className={`onsale-tab-wrapper w-full ${className || ""}`}>
<div className="main-container w-full">
<div className="filter-section w-full items-center sm:flex justify-between mb-6">
{/* filter-search */}
<div className="sm:w-1/2 w-full sm:pr-20 pr-0 mb-5 sm:mb-0">
<SearchCom />
<div className="filter-section w-fullmb-6">
<h1 className="text-xl lg:text-2xl font-bold text-dark-gray dark:text-white tracking-wide">Ask our A.I</h1>
<div className="mt-2 lg:grid grid-cols-2 gap-2 h-full lg:h-[500px]">
<div className="h-full mb-5 lg:mb-0">
<img className="w-full h-full rounded-2xl" src={localImgLoad(`images/resources-ask.jpg`)} alt='AI' />
</div>
<div className="p-8 bg-white rounded-2xl h-full">
<div 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">
<select className="input-field px-2 placeholder:text-base text-dark-gray w-full h-full tracking-wide dark:bg-[#11131F] bg-[#fafafa] focus:ring-0 focus:outline-none">
<option className="rounded-full">Find answer on:</option>
</select>
</div>
{/* filter-search */}
<div className="w-full my-5 border-2 rounded-full">
<SearchCom />
</div>
<div className="w-full flex justify-end items-center border-b-2 pb-4">
<button
className="btn-gradient text-base tracking-wide px-4 py-2 rounded-full text-white cursor-pointer"
>
Search
</button>
</div>
</div>
</div>
</div>
<div className="content-section w-full-width">
{/* <div className="content-section w-full-width">
<div className="grid lg:grid-cols-3 sm:grid-cols-2 grid-cols-1 gap-[30px]">
</div>
</div>
</div> */}
</div>
</div>
</>
@@ -1,8 +1,3 @@
import React, { useEffect, useState } from "react";
import method1 from "../../../assets/images/payment-method-1.png";
import method2 from "../../../assets/images/payment-method-2.png";
import method3 from "../../../assets/images/payment-method-3.png";
import method4 from "../../../assets/images/payment-method-4.png";
import CardList from "./CardList";
@@ -0,0 +1,107 @@
import { useState } from "react";
import method1 from "../../../assets/images/icons/bank.svg";
import localImgLoad from "../../../lib/localImgLoad";
import { PaginatedList, handlePagingFunc } from "../../Pagination";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
export default function RecipientAccountTab({
recipientAccount,
setRecipientAccount,
}) {
const cardList = recipientAccount?.data?.result_list;
const handleDeleteCardModal = () => {
setRecipientAccount((prev) => ({ ...prev, state: !prev.state }));
};
const [currentPage, setCurrentPage] = useState(0);
const indexOfFirstItem = Number(currentPage);
const indexOfLastItem =
Number(indexOfFirstItem) + Number(process.env.REACT_APP_ITEM_PER_PAGE);
const currentCardList = cardList?.slice(indexOfFirstItem, indexOfLastItem);
const handlePagination = (e) => {
handlePagingFunc(e, setCurrentPage);
};
return (
<>
<div className="payment-method-tab w-full">
<div className="payment-item-wrapper w-full">
<ul className="payment-items w-full min-h-[400px]">
{recipientAccount?.loading ? (
<div className="w-full h-[300px] flex justify-center items-center">
<LoadingSpinner size="8" color="sky-blue" />
</div>
) : cardList?.length ? (
currentCardList.map((item) => {
let image =
item.description &&
localImgLoad(
`images/settings/${item.description.toLowerCase()}.svg`
);
let addedDate = item?.added?.split(" ")[0];
return (
<li
key={item.recipient_id}
className="sm:flex justify-between items-center w-full py-3 border-b border-light-purple dark:border-[#5356fb29] "
>
<div className="flex space-x-5 mb-2 sm:mb-0">
<div className="w-[70px] h-[70px] flex items-center justify-center rounded-full sm:bg-light-purple dark:bg-dark-light-purple ">
<img
src={image ? image : method1}
className="w-[50px] h-[50px]"
alt="payment"
/>
</div>
<div className="flex flex-col justify-around">
<p className="sm:text-xl text-lg tracking-wide text-dark-gray dark:text-white">
Added: {addedDate}
</p>
<p className="text-thin-light-gray sm:text-18 text-base tracking-wide">
{item?.recipient}
</p>
</div>
</div>
<div>
<button
type="button"
onClick={() => {
// setRecipientAccount({ state: true, data: item });
console.log("Testing...")
}}
className="w-[95px] sm:h-[46px] h-[40px] rounded-full btn-gradient text-white sm:text-18 text-md tracking-wide"
>
Delete
</button>
</div>
</li>
);
})
) : (
<h1 className="font-bold text-xl text-dark-gray dark:text-white whitespace-nowrap">
No Cards Found
</h1>
)}
</ul>
{/* PAGINATION BUTTON */}
<PaginatedList
onClick={handlePagination}
prev={currentPage == 0 ? true : false}
next={
currentPage + Number(process.env.REACT_APP_ITEM_PER_PAGE) >=
cardList?.length
? true
: false
}
data={cardList}
start={indexOfFirstItem}
stop={indexOfLastItem}
/>
{/* END OF PAGINATION BUTTON */}
</div>
</div>
</>
);
}
+73 -6
View File
@@ -1,6 +1,13 @@
import React, { useRef, useState } from "react";
import React, {
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import cover from "../../assets/images/profile-info-cover.png";
import profile from "../../assets/images/profile-info-profile.png";
import usersService from "../../services/UsersService";
import Icons from "../Helpers/Icons";
import Layout from "../Partials/Layout";
import {
@@ -13,11 +20,13 @@ import {
PrivacyPolicyTab,
TermsConditionTab,
} from "./Tabs";
import RecipientAccountTab from "./Tabs/RecipientAccountTab";
export default function Settings({ faq }) {
const [profileImg, setProfileImg] = useState(profile);
const [coverImg, setCoverImg] = useState(cover);
const [reloadCardList, setReloadCardList] = useState(false) // STATE TO DETERMINE WHEN CARD LIST RELOADS. EG: WHEN USER DELETES A CARD
// profile img
const profileImgInput = useRef(null);
const browseProfileImg = () => {
@@ -47,6 +56,7 @@ export default function Settings({ faq }) {
}
};
const apiCall = useMemo(() => new usersService(), []);
// Tabs Handling
const tabs = [
{
@@ -63,30 +73,36 @@ export default function Settings({ faq }) {
},
{
id: 3,
name: "recipients-account",
title: "Recipients Account",
iconName: "bank-card",
},
{
id: 4,
name: "notification",
title: "Notification Setting",
iconName: "notification-setting",
},
{
id: 4,
id: 5,
name: "login_activity",
title: "Login Activity",
iconName: "login-activity",
},
{
id: 5,
id: 6,
name: "password",
title: "Change Password",
iconName: "password-hover",
},
{
id: 6,
id: 7,
name: "faq",
title: "FAQ",
iconName: "block-question",
},
{
id: 7,
id: 8,
name: "privacy",
title: "Privacy Policy",
iconName: "page-right",
@@ -103,6 +119,48 @@ export default function Settings({ faq }) {
setTab(value);
};
// Recipient Account
const [recipientAccount, setRecipientAccount] = useState({
state: false,
loader: false,
msg: "",
data: null,
});
const getRecipientAccount = useCallback(async () => {
setRecipientAccount((prev) => ({ loader: true }));
let res;
try {
res = await apiCall.getRecipient();
res = res.data;
if (res?.internal_return < 0) {
setRecipientAccount((prev) => ({
loader: false,
msg: "Sorry, something went wrong",
}));
setTimeout(() => setRecipientAccount((prev) => prev), 5000);
return;
}
return setTimeout(() => {
setRecipientAccount((prev) => ({ loader: false, data: res }));
});
} catch (error) {
setRecipientAccount((prev) => ({
loader: false,
msg: "Sorry, an error occurred",
}));
setTimeout(() => setRecipientAccount((prev) => prev), 5000);
return;
}
}, [apiCall]);
useEffect(() => {
getRecipientAccount();
}, [reloadCardList]);
return (
<>
<Layout>
@@ -162,6 +220,15 @@ export default function Settings({ faq }) {
<PaymentMathodsTab />
</div>
)}
{tab === "recipients-account" && (
<div className="tab-item">
<RecipientAccountTab
recipientAccount={recipientAccount}
setRecipientAccount={setRecipientAccount}
setReloadCardList={setReloadCardList}
/>
</div>
)}
{tab === "notification" && (
<div className="tab-item">
<NotificationSettingTab />
@@ -0,0 +1,261 @@
import React, { useState } from "react";
import Detail from "./popoutcomponent/Detail";
import ModalCom from "../Helpers/ModalCom";
import { useNavigate } from "react-router-dom";
import usersService from "../../services/UsersService";
import LoadingSpinner from "../Spinners/LoadingSpinner";
import localImgLoad from "../../lib/localImgLoad";
import { tableReload } from "../../store/TableReloads";
import { useDispatch } from "react-redux";
function FamilyOfferJobPopout({ details, onClose, situation }) {
const apiUrl = new usersService();
const navigate = useNavigate();
const dispatch = useDispatch();
const [requestStatus, setRequestStatus] = useState({
loading: false,
status: false,
message: "",
trigger: "",
});
//FUNCTION TO HANDLE AN OFFER
const handleOffer = ({ target: { name } }) => {
const reqData = {
// offer_result: 100,
offer_code: details.contract,
contract: details.contract,
};
//logic to determine the button pressed and set reqDate accordingly
if (name == "accept") {
setRequestStatus({
loading: true,
status: false,
message: "",
trigger: "offer",
});
reqData.offer_result = 100;
}
if (name == "reject") {
setRequestStatus({
loading: true,
status: false,
message: "",
trigger: "reject",
});
reqData.offer_result = 333;
}
// API CALL
apiUrl
.offersResponse(reqData)
.then((response) => {
if (response.status != 200 || response.data.internal_return < 0) {
setRequestStatus({
loading: false,
status: false,
message: `Unable to ${name} Offer, try again later`,
trigger: "",
});
return;
}
setRequestStatus({
loading: false,
status: true,
message: `Offer ${name}ed Successfully`,
trigger: "",
});
setTimeout(() => {
onClose();
dispatch(tableReload({ type: "MYTASKTABLE" }));
navigate("/mytask", { replace: true });
setRequestStatus({
loading: false,
status: false,
message: "",
trigger: "",
});
}, 2000);
})
.catch((error) => {
setRequestStatus({
loading: false,
status: false,
message: `Opps! An Error Occurred`,
trigger: "",
});
})
.finally(() => {
setTimeout(() => {
setRequestStatus({
loading: false,
status: false,
message: "",
trigger: "",
});
}, 5000);
});
};
return (
<ModalCom action={onClose} situation={situation}>
<div className="logout-modal-wrapper lw-[90%] md:w-[768px] h-full lg:h-auto bg-white dark:bg-dark-white lg:rounded-2xl overflow-y-auto">
<div className="logout-modal-header w-full flex items-center justify-between lg:p-6 px-[30px] py-[23px] border-b dark:border-[#5356fb29] border-light-purple">
<h1 className="text-26 font-bold text-dark-gray dark:text-white tracking-wide">
Start Task
</h1>
<button
type="button"
className="text-[#374557] dark:text-red-500"
onClick={onClose}
>
<svg
width="36"
height="36"
viewBox="0 0 36 36"
fill="none"
className="fill-current"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M36 16.16C36 17.4399 36 18.7199 36 20.0001C35.7911 20.0709 35.8636 20.2554 35.8385 20.4001C34.5321 27.9453 30.246 32.9248 22.9603 35.2822C21.9006 35.6251 20.7753 35.7657 19.6802 35.9997C18.4003 35.9997 17.1204 35.9997 15.8401 35.9997C15.5896 35.7086 15.2189 35.7732 14.9034 35.7093C7.77231 34.2621 3.08728 30.0725 0.769671 23.187C0.435002 22.1926 0.445997 21.1199 0 20.1599C0 18.7198 0 17.2798 0 15.8398C0.291376 15.6195 0.214408 15.2656 0.270759 14.9808C1.71321 7.69774 6.02611 2.99691 13.0428 0.700951C14.0118 0.383805 15.0509 0.386897 15.9999 0C17.2265 0 18.4532 0 19.6799 0C19.7156 0.124041 19.8125 0.136067 19.9225 0.146719C27.3 0.868973 33.5322 6.21922 35.3801 13.427C35.6121 14.3313 35.7945 15.2484 36 16.16ZM33.011 18.0787C33.0433 9.77105 26.3423 3.00309 18.077 2.9945C9.78479 2.98626 3.00344 9.658 2.98523 17.8426C2.96667 26.1633 9.58859 32.9601 17.7602 33.0079C26.197 33.0577 32.9787 26.4186 33.011 18.0787Z"
fill=""
fillOpacity="0.6"
/>
<path
d="M15.9309 18.023C13.9329 16.037 12.007 14.1207 10.0787 12.2072C9.60071 11.733 9.26398 11.2162 9.51996 10.506C9.945 9.32677 11.1954 9.0811 12.1437 10.0174C13.9067 11.7585 15.6766 13.494 17.385 15.2879C17.9108 15.8401 18.1633 15.7487 18.6375 15.258C20.3586 13.4761 22.1199 11.7327 23.8822 9.99096C24.8175 9.06632 26.1095 9.33639 26.4967 10.517C26.7286 11.2241 26.3919 11.7413 25.9133 12.2178C24.1757 13.9472 22.4477 15.6855 20.7104 17.4148C20.5228 17.6018 20.2964 17.7495 20.0466 17.9485C22.0831 19.974 24.0372 21.8992 25.9689 23.8468C26.9262 24.8119 26.6489 26.1101 25.4336 26.4987C24.712 26.7292 24.2131 26.3441 23.7455 25.8757C21.9945 24.1227 20.2232 22.3892 18.5045 20.6049C18.0698 20.1534 17.8716 20.2269 17.4802 20.6282C15.732 22.4215 13.9493 24.1807 12.1777 25.951C11.7022 26.4262 11.193 26.7471 10.4738 26.4537C9.31345 25.9798 9.06881 24.8398 9.98589 23.8952C11.285 22.5576 12.6138 21.2484 13.9387 19.9355C14.5792 19.3005 15.2399 18.6852 15.9309 18.023Z"
fill="#"
fillOpacity="0.6"
/>
</svg>
</button>
</div>
<div className="md:flex bg-white rounded-lg shadow-lg">
<div className="p-4 w-full md:w-3/4 md:border-r-2">
<div className="flex gap-2">
<div className="image-wrapper w-32">
<img className="w-full h-auto" src={localImgLoad(`images/taskbanners/${details.banner}`)} alt='Banner-Image' />
</div>
<div className="details-wrapper">
<p className="text-lg my-5 font-semibold text-slate-900 tracking-wide">
{details.title}
</p>
{/* INPUT SECTION */}
<div className="my-2 md:flex">
<Detail
label="Date"
value={
(details.offer_added && details.offer_added?.split(" ")[0]) ||
"default"
}
/>
</div>
<div className="my-2 md:flex">
<Detail label="Description" value={details.description} />
</div>
<div className="my-2 md:flex">
<Detail
label="Offer Expire"
value={details.expire && details.expire.split(" ")[0]}
/>
</div>
<div className="my-2 md:flex">
<Detail label="Price" value={details.thePrice} />
</div>
<div className="my-2 md:flex">
<Detail
label="Duration"
value={`${details.timeline_days} day(s)`}
/>
</div>
<div className="my-2 md:flex">
<Detail
label="Detail"
value={details.job_description || details.description}
/>
</div>
</div>
</div>
</div>
{/* ACTION SECTION */}
<div className="p-4 w-full md:w-1/4 h-full">
<div className="my-3 md:flex md:justify-center">
{requestStatus.loading && requestStatus.trigger == "offer" ? (
<LoadingSpinner size={8} color="sky-blue" />
) : (
<button
name="accept"
onClick={handleOffer}
disabled={requestStatus.loading}
className="px-2 py-2 w-20 flex justify-center items-center border-2 border-green-900 bg-green-500 text-base rounded-2xl text-white"
>
I am ready to start
</button>
)}
</div>
{/* <div className="mt-10 md:mt-20 md:flex md:justify-center">
{requestStatus.loading && requestStatus.trigger == "reject" ? (
<LoadingSpinner size={8} color="sky-blue" />
) : (
<button
name="reject"
onClick={handleOffer}
disabled={requestStatus.loading}
className="px-2 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
Reject Offer
</button>
)}
</div> */}
{/* ERROR DISPLAY AND SUBMIT BUTTON */}
{requestStatus.message != "" &&
(!requestStatus.status ? (
<div
className={`relative p-4 my-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
>
{requestStatus.message}
</div>
) : (
requestStatus.status && (
<div
className={`relative p-4 my-4 text-green-700 bg-slate-200 border-slate-800 mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]`}
>
{requestStatus.message}
</div>
)
))}
{/* End of error or success display */}
</div>
</div>
{/* close button */}
<div className="p-6 flex justify-end">
<button
onClick={onClose}
disabled={requestStatus.loading}
type="button"
className="border-gradient text-18 tracking-wide px-2 py-2 rounded-full"
>
<span className="text-gradient">Cancel</span>
</button>
</div>
{/* end of close button */}
</div>
</ModalCom>
);
}
export default FamilyOfferJobPopout;
+17
View File
@@ -0,0 +1,17 @@
export default function formattedDate(dateString) {
const parts = dateString.split(" ");
const datePart = parts[0];
const timePart = parts[1];
const [month, day, year] = datePart.split("-").map(Number);
let [hour, minute] = timePart.slice(0, -2).split(":").map(Number);
// Convert 12-hour time to 24-hour time if necessary
if (timePart.endsWith("PM") && hour !== 12) {
hour += 12;
} else if (timePart.endsWith("AM") && hour === 12) {
hour = 0;
}
return new Date(year, month - 1, day, hour, minute);
}
+118 -21
View File
@@ -1,12 +1,15 @@
import { useEffect, useState, useCallback, useMemo } from "react";
import { Navigate, Outlet, useLocation, useNavigate } from "react-router-dom";
import usersService from "../services/UsersService";
import LoadingSpinner from "../components/Spinners/LoadingSpinner";
import { useCallback, useEffect, useMemo, useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import { Navigate, Outlet, useNavigate } from "react-router-dom";
import LoadingSpinner from "../components/Spinners/LoadingSpinner";
import formattedDate from "../lib/fomattedDate";
import usersService from "../services/UsersService";
import { commonHeadBanner } from "../store/CommonHeadBanner";
import { recentActivitiesData } from "../store/RecentActivitiesData";
import { updateUserDetails } from "../store/UserDetails";
import { updateJobs } from "../store/jobLists";
import { updateNotifications } from "../store/notifications";
import { updateUserJobList } from "../store/userJobList";
import { commonHeadBanner } from "../store/CommonHeadBanner";
const AuthRoute = ({ redirectPath = "/login", children }) => {
const apiCall = useMemo(() => new usersService(), []);
@@ -18,9 +21,11 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
const { jobListTable } = useSelector((state) => state.tableReload);
const { userDetails:{username, uid} } = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
const {
userDetails: { username, uid },
} = useSelector((state) => state?.userDetails); // CHECKS IF USER Details are avaliable, to determine if user is active
let loggedIn = username && uid ? true : false // variable to determine if user is logged in
let loggedIn = username && uid ? true : false; // variable to determine if user is logged in
useEffect(() => {
//Removing Data stored at localStorage after session expires
@@ -84,7 +89,7 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
return;
}
setLoadProfileDetails(res.data);
dispatch(updateUserDetails({...res.data, loggedIn:true}));
dispatch(updateUserDetails({ ...res.data }));
setIsLogin({ loading: false, status: true });
})
.catch((error) => {
@@ -95,6 +100,66 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}
}, []);
useEffect(() => {
const getNotifications = () => {
// function to load user notification
dispatch(updateNotifications({ loading: true }));
apiCall
.getMyNotifications()
.then((res) => {
if (res.data.internal_return < 0) {
dispatch(updateNotifications({ loading: false, data: null }));
return;
}
setLoadProfileDetails(res.data);
const _raw = res.data?.result_list;
//Sort the notifications in ascending order based on the API time
const _sorted = _raw?.sort((a, b) => {
const timeA = new Date(a?.date)?.getTime();
const timeB = new Date(b?.date)?.getTime();
return timeA - timeB;
});
// header component
const _header = _sorted?.slice(0, 5);
// Notification Layout
const _today = _sorted?.slice(0, 7);
const _days = () => {
const sevenDaysAgo = new Date();
sevenDaysAgo.setDate(new Date() - 7);
return _sorted?.filter((notification) => {
const notificationDate = new Date(
formattedDate(notification?.date)
);
return notificationDate >= sevenDaysAgo;
});
};
// Dispatch all notifications, sorted, and recent based on their filter type
dispatch(
updateNotifications({
loading: false,
// data: {
// raw: _raw,
// today: _today,
// // days: _days(),
// sort: _sorted,
// header: _header,
// },
data: _sorted
})
);
})
.catch((error) => {
dispatch(updateNotifications({ loading: false, data: null }));
});
};
getNotifications();
}, []);
useEffect(() => {
const getMyJobList = async () => {
dispatch(updateUserJobList({ loading: true, data: [] }));
@@ -126,22 +191,54 @@ const AuthRoute = ({ redirectPath = "/login", children }) => {
}, [apiCall, dispatch]);
//FUNCTION TO GET COMMON HEAD DATA
useEffect(()=>{
apiCall.getHeroJBanners().then((res) => {
if (res.data.internal_return < 0) {
return;
}
dispatch(commonHeadBanner(res.data));
})
.catch((error) => {
console.log('ERROR ', error)
});
},[])
useEffect(() => {
apiCall
.getHeroJBanners()
.then((res) => {
if (res.data.internal_return < 0) {
return;
}
dispatch(commonHeadBanner(res.data));
})
.catch((error) => {
console.log("ERROR ", error);
});
}, []);
//
//FUNCTION TO GET COMMON HEAD DATA
useEffect(() => {
apiCall
.getRecentActivitiedData()
.then((res) => {
// debugger;
if (res.data?.internal_return < 0) {
return;
}
dispatch(recentActivitiesData(res.data));
})
.catch((error) => {
console.log("ERROR ", error);
});
}, []);
// useEffect(() => {
// apiCall
// .getHeroJBanners()
// .then((res) => {
// if (res.data.internal_return < 0) {
// return;
// }
// dispatch(commonHeadBanner(res.data));
// })
// .catch((error) => {
// console.log("ERROR ", error);
// });
// }, []);
//
return isLogin.loading && !loggedIn ? (
<LoadingSpinner size="32" color="sky-blue" height="h-screen" />
) :
!isLogin.status && !loggedIn ? (
) : !isLogin.status && !loggedIn ? (
<Navigate to={redirectPath} replace />
) : (
children || <Outlet />
+27 -3
View File
@@ -147,6 +147,16 @@ class usersService {
return this.postAuxEnd("/homebanners", postData);
}
getRecentActivitiedData() {
var postData = {
uuid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
page: 0,
limit: 100,
};
return this.postAuxEnd("/dashrecent", postData);
}
getGetPendingJobs() {
var postData = {
uuid: localStorage.getItem("uid"),
@@ -216,6 +226,7 @@ class usersService {
return this.postAuxEnd("/sendmoneyfee", postData);
}
// Start Credit for Cards
getStartCredit(value) {
var postData = {
uid: localStorage.getItem("uid"),
@@ -227,6 +238,7 @@ class usersService {
return this.postAuxEnd("/startcredit", postData);
}
// Paying using Previous Cards
getPaidPrevCard(value) {
var postData = {
uid: localStorage.getItem("uid"),
@@ -238,6 +250,18 @@ class usersService {
return this.postAuxEnd("/payprevcard", postData);
}
// Paying using New Card
getPaidNewCard(value) {
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: 11054,
...value,
};
return this.postAuxEnd("/paynewcard", postData);
}
getFamilySampleTasks() {
var postData = {
uid: localStorage.getItem("uid"),
@@ -455,8 +479,8 @@ class usersService {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
senderid: localStorage.getItem("member_id"),
action: 33020,
mode: 100,
...reqData,
};
return this.postAuxEnd("/sendmoney", postData);
@@ -590,13 +614,13 @@ class usersService {
}
// END POINT TO GET BANK NAME
getCountryBank() {
getCountryBank(value) {
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: 11183,
// country: "NG",
...value,
};
return this.postAuxEnd("/countrybanks", postData);
}
+20
View File
@@ -0,0 +1,20 @@
import { createSlice } from "@reduxjs/toolkit";
const initialState = {
recentActivitiesData: {}
};
export const recentActivitiesDataSlice = createSlice({
name: "recentActivitiesData",
initialState,
reducers: {
recentActivitiesData: (state,action) => {
state.recentActivitiesData = {...action.payload}
},
},
});
// Action creators are generated for each case reducer function
export const { recentActivitiesData } = recentActivitiesDataSlice.actions;
export default recentActivitiesDataSlice.reducer;
+5 -1
View File
@@ -5,7 +5,8 @@ const initialState = {
pendingListTable: false,
myTaskTable: false,
othersInterestedTable: false,
couponTable: false
couponTable: false,
walletTable: false,
};
export const tableReloadSlice = createSlice({
@@ -29,6 +30,9 @@ export const tableReloadSlice = createSlice({
case "COUPONTABLE":
state.couponTable = !state.couponTable;
return;
case "WALLETTABLE":
state.walletTable = !state.walletTable;
return;
default:
return state;
}
+22
View File
@@ -0,0 +1,22 @@
import { createSlice } from "@reduxjs/toolkit";
const initialState = {
notifications: {
loading: false,
data: null,
},
};
export const notificationsSlice = createSlice({
name: "notifications",
initialState,
reducers: {
updateNotifications: (state, action) => {
state.notifications = { ...action.payload };
},
},
});
export const { updateNotifications } = notificationsSlice.actions;
export default notificationsSlice.reducer;
+7 -5
View File
@@ -1,11 +1,12 @@
import { configureStore } from "@reduxjs/toolkit";
import drawerReducer from "./drawer";
import commonHeadBannerReducer from "./CommonHeadBanner";
import tableReloadReducer from "./TableReloads";
import userDetailReducer from "./UserDetails";
import jobReducer from "./jobLists";
import tableReloadReducer from "./TableReloads";
import userJobListReducer from './userJobList'
import commonHeadBannerReducer from './CommonHeadBanner'
import notificationsReducer from "./notifications";
import userJobListReducer from "./userJobList";
export default configureStore({
reducer: {
@@ -14,6 +15,7 @@ export default configureStore({
jobLists: jobReducer,
tableReload: tableReloadReducer,
userJobList: userJobListReducer,
commonHeadBanner: commonHeadBannerReducer
commonHeadBanner: commonHeadBannerReducer,
notifications: notificationsReducer,
},
});
});
+1 -5
View File
@@ -1,9 +1,5 @@
import WalletRoutes from "../components/MyWallet/Wallet";
export default function MyWalletPage() {
return (
<>
<WalletRoutes />
</>
);
return <WalletRoutes />;
}
-1
View File
@@ -1,4 +1,3 @@
import React from "react";
import Notification from "../components/Notification";
export default function notification() {