Compare commits

...

80 Commits

Author SHA1 Message Date
victorAnumudu 0bac836eb8 confirm transfer page added 2023-04-28 09:52:23 +01:00
ameye 76621a87c5 Merge branch 'verify-signup' of WrenchBoard/Users-Wrench into master 2023-04-28 01:51:46 +00:00
Ebube 7c2be04fac Added intervals for the requests for the verification 2023-04-28 02:08:04 +01:00
Ebube d23408d0ab added complete signup handler 2023-04-27 22:54:27 +01:00
ameye e94655a2a7 Merge branch 'transfer_money_validation' of WrenchBoard/Users-Wrench into master 2023-04-27 16:04:59 +00:00
victorAnumudu 94ced78c82 tranfer fund input validation done 2023-04-27 17:01:30 +01:00
Ebube 63f2ee3e6c removed a field 2023-04-27 14:01:12 +01:00
ameye b3582be38c Merge branch 'adding_recipient' of WrenchBoard/Users-Wrench into master 2023-04-27 12:58:03 +00:00
ameye 73cc1ef485 Merge branch 'verify-signup' of WrenchBoard/Users-Wrench into master 2023-04-27 12:57:59 +00:00
Ebube fb1745b0ad changed queryParams name 2023-04-27 13:52:42 +01:00
victorAnumudu 39b3218545 merged master to branch 2023-04-27 13:52:21 +01:00
victorAnumudu e26330af9a handling adding recipient done 2023-04-27 13:49:19 +01:00
ameye ccc43bb55d Merge branch 'verify-signup' of WrenchBoard/Users-Wrench into master 2023-04-27 12:29:37 +00:00
Ebube 2b0d344dfa lest touch b4 pr 2023-04-27 13:11:56 +01:00
ameye 53b9db85a5 Merge branch 'recipient_account_num__match' of WrenchBoard/Users-Wrench into master 2023-04-27 10:10:38 +00:00
victorAnumudu ecdd8f9180 validates that account number is a number 2023-04-27 11:08:11 +01:00
victorAnumudu 25dcfecfaf made validates that account number matches retype account number 2023-04-27 10:47:05 +01:00
DESKTOP-GBA0BK8\Admin ed638f5c0f Honeofferc card 2023-04-27 05:24:18 -04:00
DESKTOP-GBA0BK8\Admin 033d87fdf6 My Jobs listimg 2023-04-27 05:09:35 -04:00
Ebube babed484b2 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into verify-signup 2023-04-27 10:07:52 +01:00
Ebube e2b4aaa105 added the rest 2023-04-27 10:07:10 +01:00
ameye ce01b2637b Merge branch 'add_recipient_validation' of WrenchBoard/Users-Wrench into master 2023-04-27 09:01:07 +00:00
Ebube d91241dad9 added verify emali endpoint 2023-04-27 08:34:07 +01:00
Ebube 1ad3b74610 added checkers 2023-04-27 08:31:25 +01:00
victorAnumudu d94ff616a9 added validation to add recipient page 2023-04-27 04:26:11 +01:00
DESKTOP-GBA0BK8\Admin f87dbcbe5e Jobs format 2023-04-26 22:40:15 -04:00
DESKTOP-GBA0BK8\Admin 4df1589222 my jobs list 2023-04-26 22:13:41 -04:00
Ebube 886b73ffa3 fixing signup 2023-04-27 02:44:09 +01:00
Ebube 6cb0871d34 added html validation 2023-04-27 02:37:04 +01:00
Ebube 3ed764e8f4 Added a check up email v 2023-04-27 02:28:59 +01:00
Ebube c87fc4f32d Added verify link 2023-04-27 02:25:03 +01:00
ameye 75015e84d2 Merge branch 'add_recipient_country' of WrenchBoard/Users-Wrench into master 2023-04-26 11:57:49 +00:00
tokslaw7 24a5b8e785 Attempt fix 2023-04-26 11:40:51 +00:00
tolik 03ca576e16 Fix build 2023-04-26 19:25:47 +08:00
victorAnumudu 8886544024 Merge branch 'master' into add_recipient_country 2023-04-26 12:06:39 +01:00
victorAnumudu cadd2aa4c4 added recipient country, bank name and account types from API 2023-04-26 12:03:33 +01:00
tolik 104cd15f64 Attempt to fix 2023-04-26 18:49:58 +08:00
tolik 3acdbfb6e0 Remove volume maps for node_modules & vendors 2023-04-26 18:29:41 +08:00
tolik f30600816b Map node_modules 2023-04-26 18:11:32 +08:00
tolik 627774c910 Dev/prod env support 2023-04-26 17:25:58 +08:00
DESKTOP-GBA0BK8\Admin ee59990d85 sntx error 2023-04-25 20:56:41 -04:00
DESKTOP-GBA0BK8\Admin 7f4d8f3ff0 Hero Top data parts 2023-04-25 20:45:25 -04:00
ameye b888e9f5df Merge branch 'profile_validation' of WrenchBoard/Users-Wrench into master 2023-04-25 19:08:01 +00:00
victorAnumudu e6153e0b3d update profile validation with formik and yup 2023-04-25 19:57:40 +01:00
DESKTOP-GBA0BK8\Admin 02fe8cb399 npm i yup npm i formik 2023-04-25 08:40:18 -04:00
ameye 0819105fcb Merge branch 'profile_page_styling' of WrenchBoard/Users-Wrench into master 2023-04-25 12:28:13 +00:00
victorAnumudu 9070d99b1d profile page styling 2023-04-25 13:24:24 +01:00
ameye 2da53ecc2e Merge branch 'profile_preload_info' of WrenchBoard/Users-Wrench into master 2023-04-25 10:23:14 +00:00
victorAnumudu 3c4ebc402e made profile page to be pre filled 2023-04-25 10:34:28 +01:00
ameye a18e87e0d6 Merge branch 'profile_update' of WrenchBoard/Users-Wrench into master 2023-04-25 08:34:26 +00:00
ameye 7762c394a4 Merge branch 'implement-reset-password-pages' of WrenchBoard/Users-Wrench into master 2023-04-25 08:34:17 +00:00
victorAnumudu 66cdf50891 Profile update implementation 2023-04-25 09:26:20 +01:00
Ebube c45815d437 Made time lesser 2023-04-25 08:44:49 +01:00
Ebube f86ac54e5c everything works! 2023-04-25 08:29:45 +01:00
Ebube 636651aa38 Complete format and api call(70%) 2023-04-24 23:39:40 +01:00
Ebube 32cfed3394 Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into implement-reset-password-pages 2023-04-24 20:56:13 +01:00
ameye abd5bb07b9 Merge branch 'withdraw_steps' of WrenchBoard/Users-Wrench into master 2023-04-24 16:14:31 +00:00
victorAnumudu 826fff7acf Merge branch 'master' into withdraw_steps 2023-04-24 17:07:58 +01:00
victorAnumudu bd956cb470 added recipient and fee charge api 2023-04-24 17:06:45 +01:00
ameye 80e6f2e3db Merge branch 'session-expiration-handler' of WrenchBoard/Users-Wrench into master 2023-04-24 15:14:56 +00:00
Ebube f42fabbfbb fixed typo 2023-04-24 16:08:19 +01:00
Ebube 0a00e12b58 added session expiration 2023-04-24 15:40:46 +01:00
DESKTOP-GBA0BK8\Admin 1ff90991dd Cards added 2023-04-24 07:50:14 -04:00
DESKTOP-GBA0BK8\Admin cd9e7f4c4d Job Card Format 2023-04-24 07:47:19 -04:00
ameye 1e87e4a206 Merge branch 'wallet_page' of WrenchBoard/Users-Wrench into master 2023-04-24 10:39:02 +00:00
victorAnumudu 725b7f962c api bug 2023-04-24 10:27:11 +01:00
victorAnumudu ff9573ef51 merged from master 2023-04-24 10:10:43 +01:00
victorAnumudu ee4437753d wallet page implentation 2023-04-24 10:06:51 +01:00
ameye 4a08a71e26 Merge branch 'implement-sign-up-page' of WrenchBoard/Users-Wrench into master 2023-04-24 08:33:50 +00:00
Ebube 867ff6c571 little css fix 2023-04-24 09:21:52 +01:00
Ebube 9da97a6d6a Merge branch 'master' of https://gitlab.chiefsoft.net/WrenchBoard/Users-Wrench into implement-sign-up-page 2023-04-24 09:14:19 +01:00
Ebube 24f43acb0e implement sign up page 2023-04-24 09:13:21 +01:00
ameye a00e6b8f95 Merge branch 'send_referral' of WrenchBoard/Users-Wrench into master 2023-04-24 01:59:16 +00:00
victorAnumudu 7e09ebf2fe send referral message implemented 2023-04-23 22:42:12 +01:00
ameye 1fbf3d2f90 Merge branch 'add_recipient' of WrenchBoard/Users-Wrench into master 2023-04-23 12:17:58 +00:00
victorAnumudu 75d173e7d6 Merge branch 'master' into add_recipient 2023-04-23 12:37:19 +01:00
victorAnumudu eaa037dac9 add recipient component added 2023-04-23 12:33:17 +01:00
DESKTOP-GBA0BK8\Admin 489f22d298 Hero adjust 2023-04-23 06:43:11 -04:00
Ebube 425df92dba Reset Page Format 2023-04-22 18:44:49 +01:00
ameye 23a3426970 Merge branch 'edit_profile' of WrenchBoard/Users-Wrench into master 2023-04-22 08:33:18 +00:00
49 changed files with 18056 additions and 13267 deletions
+6 -1
View File
@@ -17,9 +17,14 @@ REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
REACT_APP_SESSION_EXPIRE_MINUTES=5
REACT_APP_SESSION_EXPIRE_MINUTES=300000
REACT_APP_SESSION_EXPIRE_CHECKER=60000
REACT_APP_LOGIN_ERROR_TIMEOUT=7000
REACT_APP_SIGNUP_ERROR_TIMEOUT=7000
# Had to change the error time to 3sec cause it took too long
REACT_APP_RESET_START_ERROR_TIMEOUT=3000
#apigate.lotus.g1.wrenchboard.com:76.209.103.227
#apigate.orion.g1.wrenchboard.com:76.209.103.227
+30
View File
@@ -0,0 +1,30 @@
SKIP_PREFLIGHT_CHECK=true
REACT_APP_FACEBOOK="https://www.facebook.com/profile.php?id=100066498622246"
REACT_APP_TWITTER="https://twitter.com/fluxtra"
REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
#REACT_APP_APPSITE="http://localhost:7012"
# REACT_APP_AUX_ENDPOINT="http://10.20.30.32:9083/svs/user"
# REACT_APP_USERS_ENDPOINT="http://10.20.30.32:9083/svs/user"
REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/svs/user"
#REACT_APP_AUX_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
#REACT_APP_USERS_ENDPOINT="https://apigate.lotus.g1.wrenchboard.com/en/wrench/api/v1"
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
REACT_APP_SESSION_EXPIRE_MINUTES=300000
REACT_APP_SESSION_EXPIRE_CHECKER=60000
REACT_APP_LOGIN_ERROR_TIMEOUT=7000
REACT_APP_SIGNUP_ERROR_TIMEOUT=7000
# Had to change the error time to 3sec cause it took too long
REACT_APP_RESET_START_ERROR_TIMEOUT=3000
#apigate.lotus.g1.wrenchboard.com:76.209.103.227
#apigate.orion.g1.wrenchboard.com:76.209.103.227
+30
View File
@@ -0,0 +1,30 @@
SKIP_PREFLIGHT_CHECK=true
REACT_APP_FACEBOOK="https://www.facebook.com/profile.php?id=100066498622246"
REACT_APP_TWITTER="https://twitter.com/fluxtra"
REACT_APP_APPSITE="https://myfitapp.mermsemr.com"
#REACT_APP_APPSITE="http://localhost:7012"
# REACT_APP_AUX_ENDPOINT="http://10.20.30.32:9083/svs/user"
# REACT_APP_USERS_ENDPOINT="http://10.20.30.32:9083/svs/user"
REACT_APP_AUX_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/svs/user"
REACT_APP_USERS_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/svs/user"
#REACT_APP_AUX_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
#REACT_APP_USERS_ENDPOINT="https://apigate.orion.g1.wrenchboard.com/en/wrench/api/v1"
#"https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
REACT_APP_SESSION_EXPIRE_MINUTES=300000
REACT_APP_SESSION_EXPIRE_CHECKER=60000
REACT_APP_LOGIN_ERROR_TIMEOUT=7000
REACT_APP_SIGNUP_ERROR_TIMEOUT=7000
# Had to change the error time to 3sec cause it took too long
REACT_APP_RESET_START_ERROR_TIMEOUT=3000
#apigate.orion.g1.wrenchboard.com:76.209.103.227
#apigate.orion.g1.wrenchboard.com:76.209.103.227
-59
View File
@@ -1,59 +0,0 @@
{
"extends": [
"airbnb",
"airbnb/hooks",
"eslint:recommended",
"prettier",
"plugin:jsx-a11y/recommended"
],
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 8
},
"env": {
"browser": true,
"node": true,
"es6": true,
"jest": true
},
"rules": {
"no-plusplus": 0,
"import/no-dynamic-require": 0,
"global-require": 0,
"no-nested-ternary": 0,
"react/self-closing-comp": 0,
"react/no-unescaped-entities": 0,
"jsx-a11y/anchor-is-valid": 0,
"react/jsx-props-no-spreading": 0,
"jsx-eslint/eslint-plugin-jsx-a11y": 0,
"jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/label-has-associated-control": 0,
"jsx-a11y/no-noninteractive-element-interactions": 0,
"react/react-in-jsx-scope": 0,
"react-hooks/rules-of-hooks": "error",
"no-console": 0,
"react/state-in-constructor": 0,
"indent": 0,
"linebreak-style": 0,
"react/prop-types": 0,
"jsx-a11y/click-events-have-key-events": 0,
"react/jsx-filename-extension": [
1,
{
"extensions": [".js", ".jsx"]
}
]
// "prettier/prettier": [
// "error",
// {
// "trailingComma": "es5",
// "singleQuote": true,
// "printWidth": 100,
// "tabWidth": 4,
// "semi": true,
// "endOfLine": "auto"
// }
// ]
},
"plugins": ["prettier", "react", "react-hooks"]
}
+36
View File
@@ -0,0 +1,36 @@
# pull the base image
FROM node:alpine
# Build args
ARG NODE_ENV
# set the working direction
#WORKDIR /app
WORKDIR /usr/src/app
# add `/app/node_modules/.bin` to $PATH
# ENV PATH /app/node_modules/.bin:$PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
ENV NODE_ENV=$NODE_ENV
# install nginx
RUN apk update
RUN apk add nginx
# install app dependencies
COPY package.json ./
COPY package-lock.json ./
COPY nginx.conf ./
COPY run.sh ./
RUN npm install --legacy-peer-deps
# add app
COPY . ./
# start app
CMD /bin/sh ./run.sh
+6 -3
View File
@@ -4,7 +4,9 @@ services:
image: registry.chiefsoft.net/wrenchboard-users-wrench:latest
build:
context: .
dockerfile: docker/Dockerfile
dockerfile: Dockerfile
args:
- NODE_ENV=production
restart: unless-stopped
ports:
- 9082:3000
@@ -13,19 +15,20 @@ services:
working_dir: /usr/src/app
volumes:
- ./:/usr/src/app
- /usr/src/app/node_modules
- ./src/:/usr/src/app/src
- ./vendors/:/usr/src/app/vendors
- ./run.sh:/usr/src/app/run.sh
extra_hosts:
- backend.wrenchboard.api.live:10.10.33.15
- backend.wrenchboard.api.test:10.10.33.15
- apigate.lotus.g1.wrenchboard.com:10.10.33.15
- apigate.orion.g1.wrenchboard.com:10.10.33.15
# #- backend.wrenchboard.api.live:172.31.4.27
# #- backend.wrenchboard.api.test:10.20.30.27
- apigateway.wrenchboard.app.dev.fluxtra.net:10.20.30.19
- apigateway.wrenchboard.app.lotus.fluxtra.net:172.31.4.19
environment:
- CHOKIDAR_USEPOLLING=true
- NODE_ENV=${NODE_ENV:-production}
# volumes:
# - ./:/app
# - /app/node_modules
+15 -1
View File
@@ -3,7 +3,15 @@
FROM alpine:3.15
# Build args
ARG NODE_ENV
ENV NODE_VERSION 14.19.0
ENV NODE_ENV=$NODE_ENV
# install nginx
RUN apk update
RUN apk add nginx
RUN addgroup -g 1000 node \
&& adduser -u 1000 -G node -s /bin/sh -D node \
@@ -103,6 +111,10 @@ WORKDIR /usr/src/app
# ENV PATH /app/node_modules/.bin:$PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
COPY nginx.conf ./
COPY run.sh ./
# install app dependencies
COPY package.json ./
RUN npm install
@@ -114,7 +126,9 @@ RUN npm install
COPY . ./
# start app
CMD ["npm","run", "start"]
# CMD ["npm","run", "start"]
# CMD ["yarn", "start"]
# start app
CMD /bin/sh ./run.sh
+29
View File
@@ -0,0 +1,29 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
server {
gzip on;
listen 3000;
server_name localhost;
root /usr/src/app/build;
include /etc/nginx/mime.types;
location /nginx_status {
stub_status on;
access_log off;
}
location / {
try_files $uri $uri/ /index.html;
}
}
}
+10992 -6604
View File
File diff suppressed because it is too large Load Diff
+6 -20
View File
@@ -13,6 +13,7 @@
"chartjs": "^0.3.24",
"cors": "^2.8.5",
"faker": "^6.6.6",
"formik": "^2.2.9",
"react": "^18.0.0",
"react-chartjs-2": "^4.1.0",
"react-countup": "^6.2.0",
@@ -25,14 +26,14 @@
"react-toastify": "^9.0.1",
"redux": "^4.2.0",
"slick-carousel": "^1.8.1",
"web-vitals": "^1.0.1"
"web-vitals": "^1.0.1",
"yup": "^1.1.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "react-scripts start -e .env.development",
"build": "react-scripts build -e .env.production",
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "yarn add -D prettier@2.4.1 && yarn add -D eslint@7.11.0 && yarn add -D babel-eslint@10.1.0 && npx install-peerdeps --dev eslint-config-airbnb@18.2.1 && yarn add -D eslint-config-prettier@8.3.0 eslint-plugin-prettier@4.0.0"
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
@@ -51,20 +52,5 @@
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"autoprefixer": "^10.4.5",
"babel-eslint": "10.1.0",
"eslint": "7.2.0",
"eslint-config-airbnb": "18.2.1",
"eslint-config-prettier": "8.3.0",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-jsx-a11y": "6.4.1",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "1.7.0",
"postcss": "^8.4.12",
"prettier": "2.4.1",
"tailwindcss": "^3.0.24"
}
}
Executable
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env sh
set -e
set -x
export NODE_ENV="${NODE_ENV:-development}"
if [ $NODE_ENV == "development" ]; then
# this runs webpack-dev-server with hot reloading
npm install --legacy-peer-deps
npm start
else
# build the app and serve it via nginx
npm install --legacy-peer-deps
npm run build
nginx -g 'daemon off;' -c /usr/src/app/nginx.conf
nginx -c /usr/src/app/nginx.conf
fi
+3 -1
View File
@@ -30,6 +30,7 @@ import ResourcePage from "./views/ResourcePage";
import MyTaskPage from "./views/MyTaskPage";
import MyJobsPage from "./views/MyJobsPage";
import ReferralPage from "./views/ReferralPage";
import VerifyLinkPages from "./views/VerifyLinkPages";
export default function Routers() {
return (
@@ -48,7 +49,8 @@ export default function Routers() {
path="/update-password"
element={<UpdatePasswordPages />}
/>
<Route exact path="/verify-you" element={<VerifyYouPages />} />
<Route path="/vemail" element={<VerifyLinkPages />} />
<Route exact path="/outmessage" element={<VerifyYouPages />} />
{/* private route */}
<Route element={<AuthRoute />}>
+132 -35
View File
@@ -1,49 +1,146 @@
import React from "react";
import { Link } from 'react-router-dom';
import titleShape from "../../../assets/images/shape/title-shape-two.svg";
import React, { useEffect, useState } from "react";
import { Link, useNavigate } from 'react-router-dom';
import WrenchBoard from "../../../assets/images/wrenchboard.png"
import InputCom from "../../Helpers/Inputs/InputCom";
import AuthLayout from "../AuthLayout";
import usersService from "../../../services/UsersService";
export default function ForgotPassword() {
const [checked, setValue] = useState(false);
const [resetLoading, setResetLoading] = useState(false)
// email
const [email, setMail] = useState("");
const [msgError, setMsgError] = useState('');
const [msgSuccess, setMsgSuccess] = useState(false)
const navigate = useNavigate();
const userApi = new usersService();
const handleEmail = (e) => {
setMail(e?.target.value);
};
const humanChecker = () => {
setValue(!checked)
}
const resetHandler = async () => {
if (email == '') {
setMsgError('An email is required')
} else if (!checked) {
setMsgError('Check if you are human')
}
if (email !== '' && checked) {
const reqData = { email }
setResetLoading(true)
try {
const res = await userApi.StartResetPassword(reqData)
if (res.status === 200) {
setMsgSuccess(true)
setMail("")
setValue(false)
setResetLoading(false)
}
} catch (error) {
setResetLoading(false)
setMail("")
setMsgError('An error occurred')
throw new Error(error)
} finally {
setTimeout(() => {
setMsgError(null)
}, process.env.REACT_APP_RESET_START_ERROR_TIMEOUT)
}
}
setTimeout(() => {
setMsgError(null)
}, process.env.REACT_APP_RESET_START_ERROR_TIMEOUT)
}
return (
<>
<AuthLayout
slogan="Welcome to WrenchBoard"
>
<div className="content-wrapper xl:bg-white dark:bg-dark-white xl:px-[70px] w-full sm:w-auto 2xl:px-[100px] h-[818px] rounded-xl ">
<div className="flex flex-col justify-center w-full h-full px-5">
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
<h1 className="sm:text-5xl text-4xl font-bold sm:leading-[74px] text-dark-gray dark:text-white">
Forget Password
</h1>
<div className="shape sm:w-[377px] w-[270px] -mt-1 ml-0">
<img src={titleShape} alt="shape" />
<div className="w-full">
<div className='mb-12'>
<Link to='#'>
<img src={WrenchBoard} alt="wrenchboard" className="h-10 mx-auto" />
</Link>
</div>
<div className="content-wrapper login shadow-md w-full lg:max-w-[500px] mx-auto flex justify-center items-center xl:bg-white dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5">
<div className="flex flex-col justify-center w-full h-full px-5">
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
<h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
Forget Password
</h1>
<span className="text-gray-400 font-medium text-[16.25px] leading-[24.375px]">Enter your email to reset your password.</span>
</div>
</div>
<div className="input-area">
<div className="input-item mb-5">
<InputCom
placeholder="example@quomodosoft.com"
label="Email Address"
name="email"
type="email"
iconName="message"
/>
</div>
<div className="signin-area mb-3.5">
<a
href="/verify-you"
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
>
Send Code
</a>
<div className="input-area">
<div className="input-item mb-10">
<InputCom
placeholder="Your Username/Email"
label="Email"
name="email"
type="email"
value={email}
inputHandler={handleEmail}
iconName="message"
/>
</div>
{/* hCaptha clone for the time being */}
<div className="mb-10">
<div className="w-[303px] h-[78px] mx-auto overflow-hidden">
<div className="w-[300px] h-[74px] bg-white bottom-[1px] rounded border-gray-100 overflow-hidden cursor-pointer">
{/* Checkbox */}
<div className="h-full relative inline-block">
<div className="relative table top-0 h-full">
<div className="table-cell align-middle">
<div className="relative w-[30px] h-[30px] mx-[15px]">
<input type="checkbox" name="human-checkbox" id="human-checkbox" className="w-[28px] h-[28px] border-[1px] rounded border-gray-400 checked:bg-white" checked={checked} onChange={humanChecker} />
</div>
</div>
</div>
</div>
<div className="h-full relative inline-block w-[170px]">
<label className="relative table top-0 h-full">
<label className="table-cell align-middle">
<label className="text-800 text-sm" htmlFor="human-checkbox">
I am human
</label>
</label>
</label>
</div>
<div className="h-full relative inline-block w-16"></div>
</div>
</div>
</div>
{msgError && <div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]">{msgError}</div>}
{msgSuccess && <div className="relative p-4 text-[#44228c] bg-[#e3d7fb] border-[#d5c4f9] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]">If we find your email, you will receive a link to reset your password. Please use or <Link to='/contact' className="text-[#4687ba] hover:text-[#009ef7]">contact form</Link> if you did not get our message after few minutes.</div>}
<Link to="/"
className=" my-40 font-bold flex justify-center text-red-500 items-center"
>
Back to Home
</Link>
<div className="signin-area mb-3.5">
<div className="flex justify-center items-center gap-2">
<button
type="button"
onClick={resetHandler}
className={`rounded-[0.475rem] mb-6 text-[15px] font-semibold text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center py-[0.8875rem] px-[1.81rem]`}
>
{resetLoading ? (
<div className="signup btn-loader"></div>
) : (
<span>Send Code</span>
)}
</button>
<button
type="button"
onClick={() => navigate("/login")}
className={`rounded-[0.475rem] mb-6 text-[15px] font-semibold text-[#009ef7] hover:text-white flex justify-center bg-[#f1faff] hover:bg-[#009ef7] transition-all duration-300 items-center py-[0.8875rem] px-[1.8125rem] `}
>
Cancel
</button>
</div>
</div>
</div>
</div>
</div>
+9 -17
View File
@@ -4,8 +4,6 @@ import { toast } from "react-toastify";
import googleLogo from "../../../assets/images/google-logo.svg";
import appleLogo from "../../../assets/images/apple-black.svg";
import facebookLogo from "../../../assets/images/facebook-4.svg";
// import titleShape from "../../../assets/images/shape/title-shape.svg";
import titleShape from "../../../assets/images/shape/login_straight_underline.svg";
import WrenchBoard from "../../../assets/images/wrenchboard.png"
import usersService from "../../../services/UsersService";
import InputCom from "../../Helpers/Inputs/InputCom";
@@ -24,8 +22,6 @@ export default function Login() {
setValue(!checked);
};
console.log(process.env.REACT_APP_LOGIN_ERROR_TIMEOUT)
// email
const [email, setMail] = useState("");
const handleEmail = (e) => {
@@ -71,7 +67,6 @@ export default function Login() {
setLoginLoading(true);
// userApi.getUserReminders(); //testing
setTimeout(() => {
toast.success("Login Successfully");
navigate("/", { replace: true });
setLoginLoading(false);
}, 2000);
@@ -81,7 +76,6 @@ export default function Login() {
}
}
} catch (error) {
console.log(error)
setMsgError('An error occurred')
} finally {
setTimeout(() => {
@@ -105,12 +99,10 @@ export default function Login() {
<div className="content-wrapper login shadow-md w-full lg:max-w-[500px] mx-auto flex justify-center items-center xl:bg-white dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5">
<div className="w-full">
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
<h1 className="text-[#181c32] font-semibold dark:text-white mb-3" style={{
fontSize: 'calc(1rem + .6vw)'
}}>
<h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
Sign In to WrenchBoard
</h1>
<span className="text-gray-400 font-medium text-xl">New Here? <Link to='/signup' className='font-semibold text-[#4687ba] hover:text-[#009ef7] transition'>Create an Account</Link></span>
<span className="text-gray-400 font-medium text-[16.25px] leading-[24.375px]">New Here? <Link to='/signup' className='font-semibold text-[#4687ba] hover:text-[#009ef7] transition'>Create an Account</Link></span>
</div>
<div className="input-area">
<div className="input-item mb-5">
@@ -124,6 +116,7 @@ export default function Login() {
iconName="message"
/>
</div>
<div className="input-item mb-5">
<InputCom
value={password}
@@ -169,15 +162,14 @@ export default function Login() {
Forgot Password
</a>
</div> */}
{loginError && <div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px]">Invalid username or password- Please <Link to='/#' className='text-[#009ef7]'>reset your password</Link> or <Link to='/signup' className='text-[#009ef7]'>create a new account</Link></div>}
{msgError && <div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px]">{msgError}</div>}
{loginError && <div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-thin leading-[19.5px] text-[13px]">Invalid username or password- Please <Link to='/#' className='text-[#009ef7]'>reset your password</Link> or <Link to='/signup' className='text-[#009ef7]'>create a new account</Link></div>}
{msgError && <div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]">{msgError}</div>}
<div className="signin-area mb-3.5">
<div className="flex justify-center">
<button
onClick={doLogin}
type="button"
className={`btn-login rounded-[0.475rem] mb-6 text-xl text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center ${loginLoading ? "active" : ""
}`}
className={`btn-login rounded-[0.475rem] mb-6 text-xl text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center text-[15px]`}
>
{loginLoading ? (
<div className="signup btn-loader"></div>
@@ -198,7 +190,7 @@ export default function Login() {
</a>
</p>
</div> */}
<div className="pt-5 text-[#181c32] text-center font-semibold text-base">This site is protected by hCaptcha and the our Privacy Policy and Terms of Service apply.</div>
<div className="pt-5 text-[#181c32] text-center font-semibold text-[13.975px] leading-[20.9625px]">This site is protected by hCaptcha and the our Privacy Policy and Terms of Service apply.</div>
</div>
</div>
</div>
@@ -220,8 +212,8 @@ const BrandBtn = ({
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">
Sign In with {brand}
<span className="text-lg text-thin-light-gray font-normal text-[15px]">
Continue with {brand}
</span>
</a>
</div>
+293 -122
View File
@@ -1,144 +1,277 @@
import React, { useState } from "react";
import loginThumb from "../../../assets/images/auth-thumb.svg";
import googleLogo from "../../../assets/images/google-logo.svg";
import logo from "../../../assets/images/light-logo.png"; //logo-1.svg";
import titleShape from "../../../assets/images/shape/title-shape-two.svg";
import React, { useCallback, useEffect, useState } from "react";
import { useNavigate, Link } from "react-router-dom";
import facebookLogo from "../../../assets/images/facebook-4.svg";
import WrenchBoard from "../../../assets/images/wrenchboard.png";
import usersService from "../../../services/UsersService";
import InputCom from "../../Helpers/Inputs/InputCom";
export default function SignUp() {
const [signUpLoading, setSignUpLoading] = useState(false);
const [checked, setValue] = useState(false);
// for the catch error
const [msgError, setMsgError] = useState("");
const [showPassword, setShowPassword] = useState(false);
const [countries, setCountries] = useState([]);
const [formData, setFormData] = useState({
country: "",
first_name: "",
last_name: "",
email: "",
password: "",
});
const handleInputChange = (event) => {
const { name, value } = event?.target;
setFormData({ ...formData, [name]: value });
};
// To Show and Hide Password
const togglePasswordVisibility = () => {
setShowPassword(!showPassword);
};
const rememberMe = () => {
setValue(!checked);
};
const navigate = useNavigate();
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);
}
}, []);
const handleSignUp = async () => {
let { country, first_name, last_name, email, password } = formData;
if (email === "" && password === "" && first_name === "") {
setMsgError("Please fill in fields");
}
try {
if (
email !== "" &&
password !== "" &&
first_name !== "" &&
last_name !== ""
) {
setSignUpLoading(true);
const reqData = {
country: country,
firstname: first_name,
lastname: last_name,
email: email,
username: email,
password: password,
terms: 1,
news: 1,
};
const res = await userApi.CreateUser(reqData);
if (res.status === 200) {
const { data } = res;
if (data.status === -1 && data.acc === "DULPICATE") {
setMsgError("This account has been already created");
setSignUpLoading(false);
}
if (data && data.status === "1") {
setTimeout(() => {
navigate("/outmessage", { replace: true });
setSignUpLoading(false);
}, 2000);
}
} else {
setSignUpLoading(false);
setMsgError("An error occurred");
}
}
} catch (error) {
throw new Error(error);
} finally {
setTimeout(() => {
setMsgError(null);
}, process.env.REACT_APP_SIGNUP_ERROR_TIMEOUT);
}
};
useEffect(() => {
getCountryList();
});
return (
<>
<div className="layout-wrapper">
<div className="main-wrapper w-full xl:h-screen h-full xl:py-0 py-12">
<div className="flex w-full h-full">
<div className="layout-wrapper login">
<div className="main-wrapper w-full xl:h-screen h-full xl:py-10 py-12 overflow-y-auto">
<div className=" h-full">
<div className="flex-1 flex justify-center items-center">
<div className="content-wrapper xl:bg-white dark:bg-dark-white xl:px-7 px-5 2xl:px-[100px] h-[840px] rounded-xl flex flex-col justify-center">
<div>
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
<h1 className="sm:text-5xl text-4xl font-bold text-dark-gray dark:text-white leading-2">
Create Account
</h1>
<div className="shape sm:w-[377px] w-[280px] mb-[10px] ml-5">
<img src={titleShape} alt="shape" />
<div className="w-full">
<div className="mb-12">
<Link to="#">
<img
src={WrenchBoard}
alt="wrenchboard"
className="h-10 mx-auto"
/>
</Link>
</div>
<div className="content-wrapper login shadow-md w-full lg:max-w-[600px] mx-auto flex justify-center items-center xl:bg-white dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5 mb-7">
<div>
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
<h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
Create Account
</h1>
<span className="text-gray-400 font-medium text-[16.25px] leading-[24.375px]">
Already have an account?{" "}
<Link
to="/login"
className="font-semibold text-[#4687ba] hover:text-[#009ef7] transition"
>
Sign in here
</Link>
</span>
</div>
</div>
<div className="input-area">
<div className="input-fl-name mb-5 sm:flex w-full sm:space-x-6 ">
<div className="input-item sm:w-1/2 w-full mb-5 sm:mb-0">
<button
type="button"
className={`rounded-[0.475rem] w-full mb-6 text-[15px] h-[42px] font-semibold text-[#009ef7] hover:text-white flex justify-center bg-[#f1faff] hover:bg-[#009ef7] transition-all duration-300 items-center py-[0.8875rem] px-[1.8125rem]`}
>
<img
className="mr-3 h-6"
src={facebookLogo}
alt="logo-icon(s)"
/>
Sign in with Facebook
</button>
<div className="w-full flex items-center gap-2">
<div className="border-b border-[#eff2f5] max-w-[50%] w-full"></div>
<span className="text-[#b5b5c3] font-medium text-[0.7rem] w-[2%]">
OR
</span>
<div className="border-b border-[#eff2f5] max-w-[50%] w-full"></div>
</div>
<div className="input-area">
<SelectOption
label="Country"
data={countries}
name="country"
value={formData.country}
inputHandler={handleInputChange}
/>
<div className="input-fl-name mb-5 sm:flex w-full sm:space-x-6 ">
<div className="input-item sm:w-1/2 w-full mb-5 sm:mb-0">
<InputCom
placeholder="Firstname"
label="First Name"
name="first_name"
type="text"
value={formData.first_name}
inputHandler={handleInputChange}
/>
</div>
<div className="input-item flex-1">
<InputCom
placeholder="Lastname"
label="Last Name"
name="last_name"
type="text"
value={formData.last_name}
inputHandler={handleInputChange}
/>
</div>
</div>
<div className="input-item mb-5">
<InputCom
placeholder="Adam"
label="First Name"
name="first_name"
type="text"
iconName="people"
placeholder="support@mermsemr.com"
label="Email"
name="email"
type="email"
value={formData.email}
inputHandler={handleInputChange}
/>
</div>
<div className="input-item flex-1">
<div className="input-item mb-5">
<InputCom
placeholder="Wathon"
label="Last Name"
name="Last_name"
type="text"
iconName="people"
placeholder="● ● ● ● ● ●"
label="Password"
name="password"
type={showPassword ? "text" : "password"}
onClick={togglePasswordVisibility}
passIcon={
showPassword ? "show-password" : "hide-password"
}
value={formData.password}
inputHandler={handleInputChange}
/>
</div>
</div>
<div className="input-item mb-5">
<InputCom
placeholder="example@quomodosoft.com"
label="Email Address"
name="email"
type="email"
iconName="message"
/>
</div>
<div className="input-item mb-5">
<InputCom
placeholder="*********"
label="Password"
name="password"
type="password"
iconName="password"
/>
</div>
<div className="input-item mb-5">
<InputCom
placeholder="*********"
label="Re-enter Password"
name="password"
type="password"
iconName="password"
/>
</div>
<div className="forgot-password-area flex justify-between items-center mb-6">
<div className="remember-checkbox flex items-center space-x-2.5">
<button
onClick={rememberMe}
type="button"
className="w-5 h-5 text-dark-gray dark:text-white flex justify-center items-center border border-light-gray"
>
{checked && (
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fillRule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clipRule="evenodd"
/>
</svg>
)}
</button>
<span
onClick={rememberMe}
className="text-base text-dark-gray dark:text-white"
>
I agree all
<a
href="#"
className="text-base text-purple mx-1 inline-block"
{msgError && (
<div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px]">
{msgError}
</div>
)}
<div className="forgot-password-area flex justify-between items-center mb-6">
<div className="remember-checkbox flex items-center space-x-2.5">
<button
onClick={rememberMe}
type="button"
className="w-6 h-6 bg-[#4687ba] text-white flex justify-center items-center border border-light-gray rounded-[.45em]"
>
terms and condition
</a>
in WrenchBoard.
</span>
{checked && (
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-5 w-5"
viewBox="0 0 20 20"
fill="currentColor"
>
<path
fillRule="evenodd"
d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"
clipRule="evenodd"
/>
</svg>
)}
</button>
<span
onClick={rememberMe}
className="cursor-default text-dark-gray dark:text-white text-[15px]"
>
I agree with all
<Link
href="#"
className="text-base text-[#4687ba] hover:text-[#009ef7] mx-1 inline-block"
>
terms and condition
</Link>
</span>
</div>
</div>
<div className="signin-area mb-1">
<div className="flex justify-center">
<button
type="button"
onClick={handleSignUp}
className={`rounded-[0.475rem] mb-6 text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center h-[42px] py-[0.8875rem] px-[1.81rem] text-[14.95px]`}
>
{signUpLoading ? (
<div className="signup btn-loader"></div>
) : (
<span>Sign Up</span>
)}
</button>
</div>
</div>
</div>
<div className="signin-area mb-1">
<a
href="#"
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
>
Sign Up
</a>
<a
href="#"
className="w-full border border-light-purple dark:border-[#5356fb29] rounded-[50px] h-[58px] flex justify-center bg-[#FAFAFA] dark:bg-[#11131F] items-center"
>
<img
className="mr-3"
src={googleLogo}
alt="google logo"
/>
<span className="text-lg text-thin-light-gray font-normal">
Sign Up with Google
</span>
</a>
</div>
<div className="signup-area flex justify-center">
<p className="text-lg text-thin-light-gray font-normal">
Already have account?
<a href="/login" className="ml-2 text-dark-gray dark:text-white">
Log In
</a>
</p>
</div>
</div>
</div>
@@ -150,3 +283,41 @@ export default function SignUp() {
</>
);
}
const SelectOption = ({
label,
name,
inputHandler,
value,
data, // passing the data from parent
}) => {
return (
<div className="input-com mb-7">
<div className="flex items-center justify-between">
<label
className="input-label text-[#181c32] dark:text-white text-[15px] font-semibold block mb-2.5"
htmlFor={name}
>
{label}
</label>
</div>
<div>
<select
name={name}
id={name}
className="input-wrapper border border-[#f5f8fa]] dark:border-[#5e6278] w-full rounded-[0.475rem] h-[42px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base focus-visible:border-transparent focus-visible:outline-0 focus-visible:ring-transparent "
onChange={inputHandler}
value={value}
>
<option value={""}>Select your Country</option>
{data?.length > 0 &&
data?.map((item, idx) => (
<option value={item[0]} key={idx}>
{item[1]}
</option>
))}
</select>
</div>
</div>
);
};
@@ -0,0 +1,247 @@
import { useState, useLayoutEffect, useCallback } from "react";
import { useLocation, Link, useNavigate } from "react-router-dom";
import AuthLayout from "../AuthLayout";
import InputCom from "../../Helpers/Inputs/InputCom";
import usersService from "../../../services/UsersService";
import WrenchBoard from "../../../assets/images/wrenchboard.png";
import debounce from "../../../hooks/debounce";
export default function VerifyLink() {
const [email, setEmail] = useState("");
const [password, setPassword] = useState("");
const [msgError, setMsgError] = useState("");
const [linkLoader, setLinkLoader] = useState(false);
const [pageLoader, setPageLoader] = useState(true);
const [linkSuccess, setLinkSuccess] = useState(true);
const navigate = useNavigate();
const location = useLocation();
const queryParams = new URLSearchParams(location?.search);
const token = queryParams.get("vlnk");
const userApi = new usersService();
// email
const handleEmail = (e) => {
setEmail(e.target.value);
};
// password
const handlePassword = (e) => {
setPassword(e.target.value);
};
// for verifying the incoming verification link and render the correct component
const verifyEmail = useCallback(async (code) => {
try {
const verifyRes = await userApi.verifyEmail(code);
if (verifyRes.status === 200) {
let { data } = verifyRes;
if (
data &&
data.internal_return >= 0 &&
data.status_text === "Link Verfied"
) {
setPageLoader(false);
} else {
setPageLoader(false);
setLinkSuccess(false);
}
}
} catch (error) {
setPageLoader(false);
setLinkSuccess(false);
throw new Error(error);
}
}, []);
// delay verify requests by 10000ms
const debouncedEmail = debounce(verifyEmail, 1000);
// if verification is okay. set a complete signup form
const completeSignup = async () => {
if (email === "" && password === "") {
setMsgError("Please fill in fields");
}
try {
if (email !== "" && password !== "") {
setLinkLoader(true);
var postData = {
username: email,
password: password,
login_mode: 100,
sessionid: "STARTER-NOTREAL",
verify_link: token,
action: 11012,
};
const res = await userApi.CompleteSignUp(postData);
if (res.status === 200) {
const { data } = res;
if (
data?.status > 0 &&
data?.internal_return == 100 &&
data?.session != ""
) {
localStorage.setItem("email", `${data?.email}`);
localStorage.setItem("member_id", `${data?.member_id}`);
localStorage.setItem("session_token", `${data?.session}`);
localStorage.setItem("added", `${data?.added}`);
localStorage.setItem("city", `${data?.city}`);
localStorage.setItem("country", `${data?.country}`);
localStorage.setItem("firstname", `${data?.firstname}`);
localStorage.setItem("last_login", `${data?.last_login}`);
localStorage.setItem("lastname", `${data?.lastname}`);
localStorage.setItem("state", `${data?.state}`);
localStorage.setItem("zip_code", `${data?.zip_code}`);
localStorage.setItem("session", `${data?.session}`);
navigate("/", { replace: true });
setLinkLoader(false);
} else {
setLinkLoader(false);
setMsgError("Invalid Link or Password Combination");
}
} else {
setLinkLoader(false);
setLinkSuccess(false)
setMsgError("An error occurred");
}
}
} catch (error) {
setLinkLoader(false);
setLinkSuccess(false)
throw new Error(error);
} finally {
setTimeout(() => {
setMsgError(null);
}, process.env.REACT_APP_SIGNUP_ERROR_TIMEOUT);
}
};
useLayoutEffect(() => {
debouncedEmail(token);
});
return (
<>
<AuthLayout slogan="Welcome to WrenchBoard">
{pageLoader ? (
<img src={WrenchBoard} alt="wrenchboard" className="h-10 mx-auto" />
) : (
<div className="w-full">
<div className="mb-12">
<Link to="#">
<img
src={WrenchBoard}
alt="wrenchboard"
className="h-10 mx-auto"
/>
</Link>
</div>
<div className="content-wrapper login shadow-md w-full lg:max-w-[500px] mx-auto flex justify-center items-center dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5">
<div className="w-full">
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
<h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
{linkSuccess
? "Sign In to WrenchBoard"
: "Invalid verification link"}
</h1>
</div>
{/* If the verification was a success */}
{linkSuccess ? (
<SuccessfulComponent
email={email}
password={password}
handleEmail={handleEmail}
handlePassword={handlePassword}
onSubmit={completeSignup}
msgErr={msgError}
loader={linkLoader}
/>
) : (
<ErrorComponent onClick={() => navigate("/login")} />
)}
</div>
</div>
</div>
)}
</AuthLayout>
</>
);
}
const SuccessfulComponent = ({
onSubmit,
password,
handlePassword,
email,
handleEmail,
msgErr,
loader,
}) => (
<div className="input-area">
{/* INPUT */}
<div className="mb-5">
<InputCom
value={email}
inputHandler={handleEmail}
placeholder="support@mermsemr.com"
label="Email"
name="email"
type="email"
iconName="message"
/>
</div>
<div className="mb-5">
<InputCom
value={password}
inputHandler={handlePassword}
placeholder="● ● ● ● ● ●"
label="Password"
name="password"
type="password"
iconName="password"
/>
</div>
{msgErr && (
<div className="relative p-4 text-[#912741] bg-[#fcd9e2] border-[#fbc6d3] mb-4 rounded-[0.475rem] text-md font-light leading-[19.5px] text-[13px]">
{msgErr}
</div>
)}
<div className="signin-area mb-3.5">
<button
onClick={onSubmit}
type="button"
className={`btn-login rounded-[0.475rem] mb-6 text-xl text-white flex justify-center bg-[#4687ba] hover:bg-[#009ef7] transition-all duration-300 items-center text-[15px]`}
>
{loader ? (
<div className="signup btn-loader"></div>
) : (
<span>Continue</span>
)}
</button>
</div>
</div>
);
const ErrorComponent = ({ onClick }) => (
<div className="input-area">
<div className="my-5">
<p className="text-[14px] leading-[19px] text-center text-[#181c32]">
This error occurs because you have already verified this link or the
link has expired. Try login or reset password. If none worked, try to
create the account from the start.
</p>
</div>
<div className="signin-area flex justify-center mb-3.5">
<button
onClick={onClick}
type="button"
className={`rounded-[0.475rem] mb-6 text-[15px] font-semibold text-[#009ef7] hover:text-white flex justify-center bg-[#f1faff] hover:bg-[#009ef7] transition-all duration-300 items-center py-[0.8875rem] px-[1.81rem]`}
>
<span>Return Home</span>
</button>
</div>
</div>
);
+36 -29
View File
@@ -1,42 +1,49 @@
import React from "react";
import titleShape from "../../../assets/images/shape/text-shape-three.svg";
import { useNavigate, Link } from "react-router-dom";
import AuthLayout from "../AuthLayout";
import Otp from "./Otp";
import WrenchBoard from "../../../assets/images/wrenchboard.png"
export default function VerifyYou() {
const navigate = useNavigate()
return (
<>
<AuthLayout
slogan="Welcome to WrenchBoard"
>
<div className="content-wrapper xl:bg-white dark:bg-dark-white w-full sm:w-auto px-5 xl:px-[70px] 2xl:px-[100px] h-[818px] rounded-xl flex flex-col justify-center">
<div>
<div className="title-area flex flex-col justify-center items-center relative text-center mb-8">
<h1 className="sm:text-5xl text-4xl font-bold leading-[74px] text-dark-gray dark:text-white">
Verification Code
</h1>
<div className="shape sm:w-[377px] w-[270px] -mt-5 ml-5">
<img src={titleShape} alt="shape" />
<div className="w-full">
<div className='mb-12'>
<Link to='#'>
<img src={WrenchBoard} alt="wrenchboard" className="h-10 mx-auto" />
</Link>
</div>
<div className="content-wrapper login shadow-md w-full lg:max-w-[500px] mx-auto flex justify-center items-center dark:bg-dark-white 2xl:w-[828px] rounded-[0.475rem] sm:p-7 p-5">
<div className="w-full">
<div className="title-area flex flex-col justify-center items-center relative text-center mb-7">
<h1 className="text-[#181c32] font-semibold dark:text-white mb-3 leading-[27.3px] text-[22.75px]">
Let's verify your email now
</h1>
<span className="text-gray-400 font-medium text-[16.25px] leading-[24.375px]">Check your email.</span>
</div>
<div className="input-area">
<div className="mb-5">
<p className="text-[14px] leading-[19px] text-center text-[#181c32]">
<b>Verify Email.</b> Help us secure your WrenchBoard account by verifying your email registration address. Verification will let you access all of WrenchBoard's features.
</p>
</div>
<div className="mb-5">
<p className="text-[14px] leading-[19px] text-center text-[#181c32]">
If you do not receive the confirmation message within a few minutes of signing up, please check your Junk E-mail folder just in case the confirmation email got delivered there instead of your inbox. If so, select the confirmation message and click Not Junk, which will allow future messages to get through.
</p>
</div>
</div>
<div className="signin-area flex justify-center mb-3.5">
<button
onClick={() => navigate("/")}
type="button"
className={`rounded-[0.475rem] mb-6 text-[15px] font-semibold text-[#009ef7] hover:text-white flex justify-center bg-[#f1faff] hover:bg-[#009ef7] transition-all duration-300 items-center py-[0.8875rem] px-[1.81rem]`}
>
<span>Return Home</span>
</button>
</div>
<div className="input-area">
<Otp />
<div className="signin-area mb-3.5">
<a
href="/update-password"
className="w-full rounded-[50px] h-[58px] mb-6 text-xl text-white font-bold flex justify-center bg-purple items-center"
>
Continue
</a>
</div>
<div className="resend-code flex justify-center">
<p className="text-lg text-thin-light-gray font-normal">
Dontt have an aceount ?
<a href="#" className="ml-2 text-dark-gray dark:text-white font-bold">
Please resend
</a>
</p>
</div>
</div>
</div>
</div>
+19 -18
View File
@@ -77,26 +77,27 @@ export default function ActiveJobsCard({
</div>
<div className="details-area">
<div className="product-two-options flex justify-between mb-5 relative">
<div className="status">
{datas.isActive && (
<span className="text-xs px-3 py-1.5 tracking-wide rounded-full bg-gold text-white">
Active
</span>
)}
</div>
{/* <div className="status">*/}
{/* {datas.isActive && (*/}
{/* <span className="text-xs px-3 py-1.5 tracking-wide rounded-full bg-gold text-white">*/}
{/* Active*/}
{/*</span>*/}
{/* )}*/}
{/* </div>*/}
<div className=" review flex space-x-2">
<button
onClick={favoriteHandler}
type="button"
className={`w-7 h-7 bg-white rounded-full flex justify-center items-center ${
addFavorite ? "text-red-500" : "text-thin-light-gray"
}`}
>
<Icons name="star" />
</button>
</div>
{/*<div className=" review flex space-x-2">*/}
{/* <button*/}
{/* onClick={favoriteHandler}*/}
{/* type="button"*/}
{/* className={`w-7 h-7 bg-white rounded-full flex justify-center items-center ${*/}
{/* addFavorite ? "text-red-500" : "text-thin-light-gray"*/}
{/* }`}*/}
{/* >*/}
{/* <Icons name="star" />*/}
{/* </button>*/}
{/*</div>*/}
</div>
<div className="flex justify-between">
+127
View File
@@ -0,0 +1,127 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import { toast } from "react-toastify";
import localImgLoad from "../../lib/localImgLoad";
import Icons from "../Helpers/Icons";
export default function AvailableJobsCard({
className,
datas,
hidden = false,
}) {
//debugger;
const [addFavorite, setValue] = useState(datas.whishlisted);
const [options, setOption] = useState(false);
const favoriteHandler = () => {
if (!addFavorite) {
setValue(true);
toast.success("Added to Favorite List");
} else {
setValue(false);
toast.warn("Remove to Favorite List");
}
};
return (
<div
className={`card-style-two w-full h-[426px] p-[20px] bg-white dark:bg-dark-white rounded-2xl section-shadow ${
className || ""
}`}
>
<div className="flex flex-col justify-between w-full h-full">
<Link to="/shop-details" className="mb-2.5">
<h1 className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white capitalize">
{datas.title}
</h1>
</Link>
<div className="card-two-info flex justify-between items-center">
<div className="owned-by flex space-x-2 items-center">
<div>
<p className="text-thin-light-gray text-sm leading-3">Added</p>
<p className="text-base text-dark-gray dark:text-white">
{datas.offer_added}
</p>
</div>
</div>
<div className="w-[1px] bg-light-purple dark:bg-dark-light-purple h-7"></div>
<div className="created-by flex space-x-2 items-center flex-row-reverse">
<div>
<p className="text-thin-light-gray text-sm leading-3 text-right">
Expires
</p>
<p className="text-base text-dark-gray dark:text-white text-right">
{datas.expire}
</p>
</div>
</div>
</div>
<div className="thumbnail-area w-full">
<div
className="w-full h-[236px] p-6 rounded-xl overflow-hidden"
style={{
background: `url(${localImgLoad(
`images/${datas.thumbnil}`
)}) 0% 0% / cover no-repeat`,
}}
>
<div className="flex justify-center">
{datas.description}
</div>
</div>
</div>
<div className="details-area">
<div className="product-two-options flex justify-between mb-5 relative">
{/* <div className="status">*/}
{/* {datas.isActive && (*/}
{/* <span className="text-xs px-3 py-1.5 tracking-wide rounded-full bg-gold text-white">*/}
{/* Active*/}
{/*</span>*/}
{/* )}*/}
{/* </div>*/}
{/*<div className=" review flex space-x-2">*/}
{/* <button*/}
{/* onClick={favoriteHandler}*/}
{/* type="button"*/}
{/* className={`w-7 h-7 bg-white rounded-full flex justify-center items-center ${*/}
{/* addFavorite ? "text-red-500" : "text-thin-light-gray"*/}
{/* }`}*/}
{/* >*/}
{/* <Icons name="star" />*/}
{/* </button>*/}
{/*</div>*/}
</div>
<div className="flex justify-between">
<div className="flex items-center space-x-2">
<div>
<p className="font-bold text-xl tracking-wide line-clamp-1 text-dark-gray dark:text-white">
{datas.price*0.01}{datas.currency} | {datas.timeline_days} day(s)
</p>
<p className="text-sm text-lighter-gray">
( {datas.offer_code})
</p>
</div>
</div>
<div>
<button
type="button"
className="px-4 py-2.5 text-white text-sm bg-pink rounded-full tracking-wide"
>
View
</button>
</div>
</div>
</div>
</div>
</div>
);
}
@@ -0,0 +1,26 @@
import React from "react";
import { Link } from "react-router-dom";
import localImgLoad from "../../lib/localImgLoad";
export default function HomeBannerOffersCard(props) {
return (
<Link
to="/my-collection/collection-item"
className="item w-full block group banner-630-340"
>
<div className="flex flex-col justify-between h-full">
<div className="content flex justify-between items-center mb-5">
<div>
<h1 className="text-xl font-bold text-dark-gray dark:text-white tracking-wide">
<>Ab hshsh jsjsj hshdhhdjjd</>
</h1>
</div>
{/*<SelectBox datas={filterDatas} action={dataSetHandler} />*/}
</div>
<div className="h-[233px]">
BEST IMAGE IN THE WORLLD
</div>
</div>
</Link>
);
}
@@ -1,4 +1,4 @@
import React from "react";
import React, { useRef } from "react";
import Icons from "../../Icons";
import { Link } from "react-router-dom";
@@ -8,38 +8,99 @@ export default function InputCom({
name,
placeholder,
iconName,
passIcon,
inputHandler,
value,
forgotPassword
forgotPassword,
onClick,
disable,
blurHandler
}) {
const inputRef = useRef(null)
// Entry Validation
// for Min Length:
const minLengthValidation = () => {
if (inputRef && inputRef?.current && inputRef?.current?.name === 'email') {
return 7
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'first_name') {
return 3
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'last_name') {
return 3
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'address') {
return 5
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'password') {
return 8
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'state') {
return 3
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'province') {
return 3
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'city') {
return 3
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'amount') {
return 1
}
}
// for MaxLength
const maxLengthValidation = () => {
if (inputRef && inputRef?.current && inputRef?.current?.name === 'email') {
return 35
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'first_name') {
return 25
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'last_name') {
return 25
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'address') {
return 49
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'password') {
return 15
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'state') {
return 25
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'province') {
return 25
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'city') {
return 25
} else if (inputRef && inputRef?.current && inputRef?.current?.name === 'amount') {
return 9
}
}
return (
<div className="input-com">
<div className="flex items-center justify-between">
{label && (
<label
className="input-label text-[#181c32] dark:text-white text-base font-semibold block mb-2.5"
className="input-label text-[#181c32] dark:text-white text-[13.975px] leading-[20.9625px] font-semibold block mb-2.5"
htmlFor={name}
>
{label}
</label>
)}
{forgotPassword && <Link href="/forgot-password" className="text-base text-[#4687ba] hover:text-[#009ef7]">Forgot Password?</Link>}
{forgotPassword && <Link to="/forgot-password" className="text-[13.975px] leading-[20.9625px] text-[#019ef7] hover:text-[#009ef7]">Forgot Password?</Link>}
</div>
<div className="input-wrapper border border-[#f5f8fa]] dark:border-[#5e6278] w-full rounded-[0.475rem] h-[58px] overflow-hidden relative font-medium leading-6 bg-clip-padding text-[#5e6278] dark:text-gray-100 bg-[#f5f8fa] dark:bg-[#5e6278] text-base ">
<div className="input-wrapper border border-[#f5f8fa]] dark:border-[#5e6278] w-full rounded-[0.475rem] 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 ">
<input
placeholder={placeholder}
value={value}
onChange={inputHandler}
className="input-field placeholder:text-base text-bese px-6 text-dark-gray dark:text-white w-full h-full bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none"
className="input-field placeholder:text-base px-6 text-dark-gray dark:text-white w-full h-full bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none"
type={type}
id={name}
required
name={name}
minLength={minLengthValidation()}
maxLength={maxLengthValidation()}
ref={inputRef}
readOnly={disable}
onBlur={blurHandler}
/>
{iconName && (
<div className="absolute right-6 bottom-[19px] z-10">
<div className="absolute right-6 bottom-[10px] z-10">
<Icons name={iconName} />
</div>
)}
{passIcon && (
<div className="absolute right-6 bottom-[10px] z-10" onClick={onClick}>
<Icons name={passIcon} />
</div>
)}
</div>
</div>
);
+8 -13
View File
@@ -18,6 +18,7 @@ export default function Hero({ className }) {
infinite: true,
swipe: true,
};
const sildeData =null;
const [addFavorite, setValue] = useState(false);
const favoriteHandler = () => {
if (!addFavorite) {
@@ -43,10 +44,10 @@ export default function Hero({ className }) {
{/* heading */}
<div>
<h1 className="lg:text-2xl text-xl font-medium text-white tracking-wide">
Lock and Lob x Fiesta Spurs
Welcome
</h1>
<span className="text-[18px] font-thin tracking-wide text-white">
ID : 2320382
Last Login : 10-10-2026
</span>
</div>
{/* user */}
@@ -64,9 +65,9 @@ export default function Hero({ className }) {
{/* countdown */}
<div className="w-full h-32 flex justify-evenly items-center sm:p-6 p-1 rounded-2xl border border-white-opacity">
<div className="flex flex-col justify-between">
<p className="text-base text-white tracking-wide">Current Bid</p>
<p className="text-base text-white tracking-wide">Current Task</p>
<p className="lg:text-2xl text-lg font-bold tracking-wide text-white">
75,320 ETH
ABCDEFGH01
</p>
<p className="text-base text-white tracking-wide">773.69 USD</p>
</div>
@@ -74,7 +75,7 @@ export default function Hero({ className }) {
<div className="flex flex-col justify-between">
<p className="text-base text-white tracking-wide">Next due in</p>
<p className="lg:text-2xl text-lg font-bold tracking-wide text-white">
<CountDown lastDate="2023-03-04 4:00:00" />
<CountDown lastDate="2023-04-26 4:00:00" />
</p>
<div className="text-base text-white tracking-wide flex gap-[23px]">
<span>Hrs</span>
@@ -85,24 +86,18 @@ export default function Hero({ className }) {
</div>
{/* action */}
<div className="flex lg:space-x-3 space-x-1 items-center">
<Link
to="/active-bids"
className=" btn-shine w-[116px] h-[46px] text-white rounded-full text-base bg-pink flex justify-center items-center"
>
Place a Bid
</Link>
<Link
to="/market-place"
className="text-white text-base sm:block hidden"
>
<span className=" border-b dark:border-[#5356fb29] border-white">
{" "}
View Art Work
View All Task(s)
</span>
</Link>
</div>
</div>
<HomeSliders settings={settings} />
<HomeSliders settings={settings} sideData={sildeData}/>
</div>
);
}
+4
View File
@@ -2,6 +2,7 @@ import SliderCom from "../Helpers/SliderCom";
import slider1 from "../../assets/images/slider-1.jpg";
import slider2 from "../../assets/images/slider-2.jpg";
import slider3 from "../../assets/images/slider-3.jpg";
import HomeBannerOffersCard from "../Cards/HomeBannerOffersCard";
export default function HomeSliders(props) {
@@ -20,6 +21,9 @@ export default function HomeSliders(props) {
<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">
<img src={slider3} alt="slider" className="w-full h-full" />
</div>
<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">
<HomeBannerOffersCard />
</div>
</SliderCom>
</div>
</div>
+4 -3
View File
@@ -1,8 +1,9 @@
import React, { useEffect, useState } from "react";
//import ProductCardStyleTwo from "../Cards/ProductCardStyleTwo";
import DataIteration from "../Helpers/DataIteration";
import SearchCom from "../Helpers/SearchCom";
import ActiveJobsCard from "../Cards/ActiveJobsCard";
// import SearchCom from "../Helpers/SearchCom";
// import ActiveJobsCard from "../Cards/ActiveJobsCard";
import AvailableJobsCard from "../Cards/AvailableJobsCard";
export default function MainSection({ className, marketPlaceProduct }) {
const [tab, setTab] = useState("explore");
@@ -98,7 +99,7 @@ export default function MainSection({ className, marketPlaceProduct }) {
endLength={products?.length}
>
{({ datas }) => (
<ActiveJobsCard key={datas.id} datas={datas} />
<AvailableJobsCard key={datas.id} datas={datas} />
)}
</DataIteration>
</div>
File diff suppressed because it is too large Load Diff
+3 -2
View File
@@ -4,11 +4,12 @@ import Layout from "../Partials/Layout";
import MyJobTable from "./MyJobTable";
import CommonHead from "../UserHeader/CommonHead";
export default function MyJobs() {
export default function MyJobs(props) {
const [selectTab, setValue] = useState("today");
const filterHandler = (value) => {
setValue(value);
};
console.log("AMEYE LOC1", props.MyJobList);
return (
<Layout>
<CommonHead />
@@ -32,7 +33,7 @@ export default function MyJobs() {
</div>
</div>
</div>
<MyJobTable />
<MyJobTable MyJobList={props.MyJobList} />
</div>
</div>
</Layout>
+9 -20
View File
@@ -1,6 +1,8 @@
import React, {useState} from 'react'
import RecentActivityTable from './WalletComponent/RecentActivityTable'
import LoadingSpinner from '../Spinners/LoadingSpinner'
function AddFund() {
function AddFund({payment}) {
//STATE FOR CONTROLLED INPUTS
let [inputs, setInputs] = useState('0')
@@ -53,27 +55,14 @@ function AddFund() {
</div>
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-[500px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">
<div className="wallet w-full md:p-8 p-4 h-full max-h-[600px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">
<h2 className='text-gray-900 dark:text-white text-xl lg:text-2xl font-medium'>Recent Activity</h2>
<p className='text-base text-gray-600 dark:text-white'>Activity Report</p>
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="py-3">Date</th>
<th className="py-3">Recipient</th>
<th className="py-3">Amount/Fee</th>
<th className="py-3">Conf/Status</th>
</tr>
</thead>
<tbody>
<tr className='text-slate-500'>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
</tr>
</tbody>
</table>
{payment.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
<RecentActivityTable payment={payment}/>
}
</div>
</div>
</div>
+370
View File
@@ -0,0 +1,370 @@
import React, {useEffect, useState} from 'react'
import { Link, useNavigate } from 'react-router-dom'
import Icons from '../Helpers/Icons'
import usersService from '../../services/UsersService'
import InputCom from '../Helpers/Inputs/InputCom'
import LoadingSpinner from '../Spinners/LoadingSpinner'
import {toast} from 'react-toastify'
import {Formik, Form} from 'formik'
import * as Yup from 'yup'
const validationSchema = Yup.object().shape({
firstname: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('Firstname is required'),
lastname: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('Lastname is required'),
country: Yup.string()
.min(1, 'Minimum 1 characters')
.max(25, 'Maximum 25 characters')
.required('Country is required'),
bank: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('Bank name is required'),
accountNumber: Yup.string()
.matches(/\d/, "must be a number")
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('Account Number is required'),
repeatAccountNumber: Yup.string()
.required('Repeat Account Number is required')
.oneOf([Yup.ref('accountNumber'), null], 'Must match Account Number'),
accountType: Yup.string()
.min(1, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('Account Type is required'),
city: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('City is required'),
state: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('State is required'),
})
const initialValues = {
firstname: '',
lastname: '',
country: '',
bank: '',
accountNumber: '',
repeatAccountNumber: '',
accountType: '',
state: '',
city: ''
}
function AddRecipient() {
const apiURL = new usersService()
const navigate = useNavigate()
let [requestStatus, setRequestStatus] = useState({message: '', loading: false, status: false})
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: true,
data: []
})
let [accType, setAccType] = useState({ // STATE TO HOLD LIST ACCOUNT TYPE
loading: true,
data: []
})
//FUNCTION TO HANDLE ADD RECIPIENT SUBMIT
const handleSubmit = (values, helpers) => {
setRequestStatus({message: '', loading: true, status: false})
let reqData = { //REQUEST DATA FOR API CALL
firstname: values.firstname,
lastname: values.lastname,
bank_code: values.bank,
account_no: values.accountNumber,
account_type: values.accountType,
country: values.country,
state: values.state,
city: values.city
}
//CALL TO ADD RECIPIENT API
apiURL.addRecipient(reqData).then((res)=>{
if(res.data.internal_return < 0){
setRequestStatus({message: 'could not add recipient, try again!', loading: false, status: true})
return
}
// setRequestStatus({message: 'Recipient Added Successfully!', loading: false, status: true})
toast.success("Recipient Added Successfully!");
setTimeout(()=>{navigate('../transfer-fund',{replace:true})},1000)
}).catch((error)=>{
setRequestStatus({message: 'Opps! an error occured! Try again later', loading: false, status: false})
})
}
// FUNCTION TO GET COUNTRIES
const getCountry = ()=> {
apiURL.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: []}))
})
}
// END OF FUNCTION TO GET COUNTRIES
// FUNCTION TO GET COUNTRY BANK
const getCountryBank = ()=> {
apiURL.getCountryBank().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: []}))
})
}
// END OF FUNCTION TO GET COUNTRY BANK
// FUNCTION TO GET ACCOUNT TYPES
const getAccountTypes = ()=> {
apiURL.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: []}))
})
}
// END OF FUNCTION TO GET ACCOUNT TYPES
useEffect(()=>{
getCountry() // TO LOAD LIST COUNTRY
getCountryBank() // TO LOAD LIST COUNTRY BANK
getAccountTypes() // TO LOAD LIST ACCOUNT TYPES
},[])
return (
<div className="content-wrapper w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin">
<div className="w-full mb-10 lg:mb-0">
<div className="w-full md:p-8 p-4 bg-white dark:bg-dark-white rounded-2xl shadow">
<h2 className='my-4 text-slate-900 dark:text-white text-xl lg:text-2xl font-semibold'>ADD BANK ACCOUNT</h2>
<Formik initialValues={initialValues} validationSchema={validationSchema} onSubmit={handleSubmit}>
{(props)=>(
<Form className='add-recipient-info px-1 md:px-[50px] lg:px-[100px]'>
{/* inputs starts here */}
{/* firstname */}
<div className="xl:flex xl:space-x-7 mb-6">
<div className="field w-full mb-6 xl:mb-0">
<InputCom
label="Firstname"
type="text"
name="firstname"
placeholder="Account Firstname"
value={props.values.firstname}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{(props.errors.firstname && props.touched.firstname) && <p className="text-sm text-red-500">{props.errors.firstname}</p>}
</div>
{/* lastname */}
<div className="field w-full">
<InputCom
label="Lastname"
type="text"
name="lastname"
placeholder="Account Lastname"
value={props.values.lastname}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{(props.errors.lastname && props.touched.lastname) && <p className="text-sm text-red-500">{props.errors.lastname}</p>}
</div>
</div>
<div className="xl:flex xl:space-x-7 mb-6">
{/* country */}
<div className='add-recipient w-full mb-6 xl:mb-0'>
<label className='input-label text-[#181c32] dark:text-white text-base font-semibold block mb-2.5'>Country <span className='text-red-500'>*</span></label>
<select className='w-full text-base p-2 text-dark-gray dark:text-white rounded-md border border-slate-300 outline-0' name='country'
value={props.values.country}
onChange={props.handleChange}
onBlur={props.handleBlur}
>
{allCountries.loading ?
<option className='text-slate-500 text-lg' value="">Loading...</option>
:
allCountries.data.length ?
<>
<option className='text-slate-500 text-lg' value="">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! Try Again</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'>
<label className='input-label text-[#181c32] dark:text-white text-base font-semibold block mb-2.5'>Bank Name <span className='text-red-500'>*</span></label>
<select className='w-full text-base p-2 text-dark-gray dark:text-white rounded-md border border-slate-300 outline-0' name='bank'
value={props.values.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! Try Again</option>
}
</select>
{(props.errors.bank && props.touched.bank) && <p className="text-sm text-red-500">{props.errors.bank}</p>}
</div>
</div>
{/* ACCOUNT NUMBER */}
<div className="xl:flex xl:space-x-7 mb-6">
<div className="field w-full mb-6 xl:mb-0">
<InputCom
label="Account Number"
type="text"
name="accountNumber"
placeholder="Account No"
value={props.values.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>
{/* REPEAT ACCT. NUMBER */}
<div className="field w-full">
<InputCom
label="Repeat Account Number"
type="text"
name="repeatAccountNumber"
placeholder="Repeat Account Number"
value={props.values.repeatAccountNumber}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{(props.errors.repeatAccountNumber && props.touched.repeatAccountNumber) && <p className="text-sm text-red-500">{props.errors.repeatAccountNumber}</p>}
</div>
</div>
<div className="xl:flex xl:space-x-7 mb-6">
{/* Account Type */}
<div className='add-recipient w-full'>
<label className='input-label text-[#181c32] dark:text-white text-base font-semibold block mb-2.5'>Account Type <span className='text-red-500'>*</span></label>
<select className='w-full text-base p-2 text-dark-gray dark:text-white rounded-md border border-slate-300 outline-0' name='accountType'
value={props.values.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! Try Again</option>
}
</select>
{(props.errors.accountType && props.touched.accountType) && <p className="text-sm text-red-500">{props.errors.accountType}</p>}
</div>
</div>
{/* state */}
<div className="xl:flex xl:space-x-7 mb-6">
<div className="field w-full mb-6 xl:mb-0">
<InputCom
label="State"
type="text"
name="state"
placeholder="State/Province"
value={props.values.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">
<InputCom
label="City"
type="text"
name="city"
placeholder="City"
value={props.values.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 starts here */}
{/* REQUEST ERROR DISPLAY */}
{requestStatus.message && <p className='text-sm text-red-500'>{requestStatus.message}</p>}
<div className='add-recipient-btn flex justify-end items-center py-4'>
{requestStatus.loading ?
<LoadingSpinner size={6} color='sky-blue' />
:
<button type='submit' className='text-lg text-white bg-sky-blue px-4 py-2 hover:opacity-90 rounded-md flex items-center space-x-1'>
<span className='pr-2'>ADD RECIPIENT</span>
<Icons name="arrows" />
</button>
}
</div>
</Form>
)}
</Formik>
</div>
</div>
</div>
)
}
export default AddRecipient
+67 -71
View File
@@ -1,10 +1,15 @@
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'
function Balance() {
function Balance({wallet, payment, coupon, purchase}) {
return (
<div className="content-wrapper">
<div className='w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin'>
{/* WALLET SECTION */}
<div className="lg:w-1/2 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">
<div className='flex items-baseline justify-between'>
@@ -12,20 +17,25 @@ function Balance() {
<p className='text-base text-slate-500 dark:text-white'>Add New Wallet</p>
</div>
{/* wallet balance */}
<div className="md:flex items-center flex-wrap mt-3">
{wallet.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
wallet.data.length ?
wallet.data.map((item, index)=> (
<div key={index} className="md:flex items-center flex-wrap my-3 border-t-2 border-slate-400">
<div className='text-slate-900 w-full md:w-1/2 flex space-x-3 items-start justify-start'>
<div className='balance-info'>
<p className='py-2'>Currency</p>
<span className='text-base'>Naira</span>
<p className='text-base text-slate-500'>Naira</p>
<span className='text-base'>{item.description}</span>
<p className='text-base text-slate-500'>{item.symbol}</p>
</div>
<div className='balance-info'>
<p className='py-2'>balance</p>
<span className='text-sm py-1 px-2 bg-green-100 text-green-500 rounded-lg'>&#8358;0.00</span>
<span className='text-sm py-1 px-2 bg-green-100 text-green-500 rounded-lg'>{item.symbol}{(item.amount*1).toFixed(2)}</span>
</div>
<div className='balance-info'>
<p className='py-2'>Escrow</p>
<span className='text-sm py-1 px-2 bg-red-100 text-red-500 rounded-lg'>&#8358;0.00</span>
<span className='text-sm py-1 px-2 bg-red-100 text-red-500 rounded-lg'>{item.symbol}{(item.escrow*1).toFixed(2)}</span>
</div>
</div>
@@ -34,85 +44,71 @@ function Balance() {
<Link to='add-fund' className='text-base text-white px-3 py-1 bg-[orange] rounded-md hover:opacity-80'>Top Up</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 */}
{/* RECENT ACTIVITY SECTION */}
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-[200px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">
<div className="wallet w-full md:p-8 p-4 h-full max-h-[300px] 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'>Recent Activity</h2>
<p className='text-base text-slate-500 dark:text-white'>Activity Report</p>
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="py-3">Date</th>
<th className="py-3">Recipient</th>
<th className="py-3">Amount/Fee</th>
<th className="py-3">Conf/Status</th>
</tr>
</thead>
<tbody>
<tr className='text-slate-500'>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
</tr>
</tbody>
</table>
{payment.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
<RecentActivityTable payment={payment} />
}
</div>
</div>
{/* END OF RECENT ACTIVITY SECTION */}
</div>
<div className='w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin'>
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-[200px] 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'>Purchases</h2>
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="py-3">Date</th>
<th className="py-3">Description</th>
<th className="py-3">Amount</th>
<th className="py-3">Fee</th>
</tr>
</thead>
<tbody>
<tr className='text-slate-500'>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
</tr>
</tbody>
</table>
</div>
</div>
{/* PURCHASE SECTION */}
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-[200px] 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>
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="py-3">Date</th>
<th className="py-3">Description</th>
<th className="py-3">Amount</th>
<th className="py-3">Active</th>
</tr>
</thead>
<tbody>
<tr className='text-slate-500'>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
</tr>
</tbody>
</table>
<div className="wallet w-full md:p-8 p-4 h-full max-h-[200px] 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'>Purchases</h2>
{purchase.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
<PurchasesTable purchase={purchase} />
}
</div>
</div>
{/* END OF PURCHASE SECTION */}
{/* COUPON SECTION */}
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-full max-h-[200px] 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>
)
}
+134
View File
@@ -0,0 +1,134 @@
import React, {useState} from 'react'
import {useLocation, useNavigate} from 'react-router-dom'
import RecentActivityTable from './WalletComponent/RecentActivityTable'
import LoadingSpinner from '../Spinners/LoadingSpinner'
import InputCom from '../Helpers/Inputs/InputCom'
function ConfirmTransfer({payment, wallet}) {
const navigate = useNavigate()
let {state} = useLocation()
// what happens if not state redirect user
if(!state){
navigate('../transfer-fund',{replace: true})
}
let [requestStatus, setRequestStatus] = useState({message: '', loading: false, status: false})
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = () => {
// let [requestStatus, setRequestStatus] = useState({message: '', loading: true, status: false})
//valid inputs before submitting. Just for texting remove later
}
return (
<div className="content-wrapper w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin">
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="add-fund w-full bg-white dark:bg-dark-white rounded-2xl shadow">
<div className='px-4 md:px-8 py-4'>
{wallet.loading ?
<LoadingSpinner size='8' color='sky-blue' />
:
wallet.data.length ?
<h2 className='my-4 text-slate-500 dark:text-white text-sm xl:text-xl font-medium'>
{wallet.data.map(item => {
if(item.description == 'Naira'){
return `Withdraw from Naira Wallet : ${item.symbol}${(item.amount*1).toFixed(2)}`
}
})}
</h2>
:
wallet.error ?
<h2 className='my-4 text-slate-500 dark:text-white text-sm xl:text-xl font-medium'>Opps! An Error Occured</h2>
:
<h2 className='my-4 text-slate-500 dark:text-white text-sm xl:text-xl font-medium'>No Wallet Information Found!</h2>
}
</div>
<hr />
<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
label="Amount:"
type="text"
name="amount"
value={state?.amount || ''}
disable={true}
/>
</div>
{/* RECIPIENT ACC: */}
<div className="field w-full mb-3">
<InputCom
label="Recipient Acc:"
type="text"
name="recipient"
value={state?.details.recipient || ''}
disable={true}
/>
</div>
{/* PROCESSING FEE: */}
<div className="field w-full mb-3">
<InputCom
label="Processing Fee:"
type="text"
name="processingFee"
value={state?.fee || ''}
disable={true}
/>
</div>
{/* TOTAL */}
<div className="field w-full mb-3">
<InputCom
label="Total"
type="text"
name="total"
value={state?.total || ''}
disable={true}
/>
</div>
{/* COMMENT/NOTE */}
<div className="field w-full mb-3">
<InputCom
label="Comment/Note:"
type="text"
name="comment"
value={state?.comment || ''}
disable={true}
/>
</div>
</div>
<hr />
<div className='px-4 md:px-8 py-4 add-fund-btn flex justify-end items-center'>
{requestStatus.loading ?
<LoadingSpinner size='8' color='sky-blue' />
:
<button onClick={handleSubmit} className='text-lg text-white bg-sky-blue px-4 py-2 hover:opacity-90 rounded-md'>Transfer</button>
}
</div>
</div>
</div>
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full px-4 md:px-8 py-4 h-full max-h-[800px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">
<h2 className='text-gray-900 dark:text-white text-xl lg:text-2xl font-medium'>Recent Activity</h2>
<p className='text-base text-gray-600 dark:text-white'>Activity Report</p>
{payment.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
<RecentActivityTable payment={payment}/>
}
</div>
</div>
</div>
)
}
export default ConfirmTransfer
+212 -113
View File
@@ -1,137 +1,236 @@
import React, {useState} from 'react'
import { Link } from 'react-router-dom'
import React, {useEffect, useState} from 'react'
import { Link, useNavigate } from 'react-router-dom'
import RecentActivityTable from './WalletComponent/RecentActivityTable'
import LoadingSpinner from '../Spinners/LoadingSpinner'
import InputCom from '../Helpers/Inputs/InputCom'
function TransferFund() {
//STATE FOR CONTROLLED INPUTS
let [inputs, setInputs] = useState({
amount: '0',
fee: '0',
recipient: '',
total: '0',
comment: ''
import usersService from '../../services/UsersService'
import {toast} from 'react-toastify'
import {Formik, Form} from 'formik'
import * as Yup from 'yup'
const validationSchema = Yup.object().shape({
amount: Yup.number()
.typeError("you must specify a number")
.min(1, 'Amount must be greater than 0')
.required('Amount is required'),
recipientID: Yup.string()
.min(1, 'Minimum 1 characters')
.max(50, 'Maximum 50 characters')
.required('Recipient is required'),
})
const initialValues = {
amount: '',
recipientID: '',
comment: '',
}
function TransferFund({payment, wallet}) {
const apiCall = new usersService() // API CLASS CALL
const navigate = useNavigate()
let [requestStatus, setRequestStatus] = useState(false)
let [recipients, setRecipients] = useState({ // FOR COUPON HISTORY
loading: true,
data: [],
error: false
})
// FUNCTION TO HANDLE INPUT CHANGE
const handleChange = ({target:{name, value}}) => {
setInputs(prev => ({...prev, [name]:value}))
}
let [sendMoneyFee, setSendMoneyFee] = useState({loading: false, fee: 0, total: 0}) // HOLD THE VALUE FOR SEND MONEY FEE
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = (e) => {
e.preventDefault();
//valid inputs before submitting. Just for texting remove later
setInputs({
amount: '0',
fee: '0',
recipient: '',
total: '0',
comment: ''
//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 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)).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 = (values, helpers) => {
setRequestStatus(true)
let recipientDetails = recipients.data?.filter(item => item.recipient_id == values.recipientID)
let stateData = {...values, ...sendMoneyFee, details:{...recipientDetails[0]}}
setTimeout(()=>{
setRequestStatus(false)
navigate('confirm-transfer', {state: stateData})
}, 1000)
}
useEffect(()=>{
getRecipients()
},[])
return (
<div className="content-wrapper w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin">
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="add-fund w-full md:p-8 p-4 bg-white dark:bg-dark-white rounded-2xl shadow">
<form className='transfer-fund-info'>
<h2 className='my-4 text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Withdraw from Naira Wallet : &#8358;0.00</h2>
<div className='my-3 md:flex items-center justify-between space-x-2'>
<div className='transfer-input w-full md:w-1/2'>
<label className='w-full text-slate-600 text-lg'>Amount <span className='text-red-500'>*</span></label>
<input className='w-full p-3 text-lg text-right bg-slate-100 rounded-md outline-0 placeholder:text-slate-500 placeholder:text-lg'
value={inputs.amount}
name='amount'
type="text"
placeholder='Amount'
required
onChange={handleChange}
/>
</div>
<div className='transfer-input w-full md:w-1/2'>
<label className='w-full text-slate-600 text-lg'>Fee <span className='text-red-500'>*</span></label>
<input className='w-full p-3 text-lg text-right bg-slate-100 rounded-md outline-0 placeholder:text-slate-500 placeholder:text-lg'
value={inputs.fee}
name='fee'
type="text"
placeholder='Fee'
required
onChange={handleChange}
/>
</div>
</div>
<Formik initialValues={initialValues} validationSchema={validationSchema} onSubmit={handleSubmit}>
{(props)=>{
return (
<Form className='transfer-fund-info'>
{wallet.loading ?
<LoadingSpinner size='8' color='sky-blue' />
:
wallet.data.length ?
<h2 className='my-4 py-2 text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>
{wallet.data.map(item => {
if(item.description == 'Naira'){
return `Withdraw from Naira Wallet : ${item.symbol}${(item.amount*1).toFixed(2)}`
}
})}
</h2>
:
wallet.error ?
<h2 className='my-4 py-2 text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Opps! An Error Occured</h2>
:
<h2 className='my-4 py-2 text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>No Wallet Information Found!</h2>
}
<div className="xl:flex xl:space-x-7 mb-6">
<div className='my-3 md:flex items-center justify-end space-x-2'>
<div className='transfer-input w-full md:w-1/2'>
<label className='w-full text-slate-600 text-lg'>Amount <span className='text-red-500'>*</span></label>
<input className='w-full p-3 text-lg text-right bg-slate-100 rounded-md outline-0 placeholder:text-slate-500 placeholder:text-lg'
value={inputs.total}
name='total'
type="text"
placeholder='Total'
required
onChange={handleChange}
/>
</div>
</div>
<div className="field w-full mb-6 xl:mb-0">
<InputCom
label="Amount"
type="text"
name="amount"
placeholder='0'
value={props.values.amount}
inputHandler={props.handleChange}
blurHandler={(e)=>{
getSendMoneyFee(e)
props.handleBlur
}}
// onMouseLeave={(e)=>{getSendMoneyFee(e)}}
/>
{(props.errors.amount && props.touched.amount) && <p className="text-sm text-red-500">{props.errors.amount}</p>}
</div>
<div className="field w-full">
<InputCom
label="Fee"
type="text"
name="fee"
value={sendMoneyFee.loading ? 'loading' : sendMoneyFee.fee}
disable={true}
/>
</div>
</div>
<div className='relative my-3 md:flex items-center'>
<div className='transfer-input w-full'>
<div className='flex items-center justify-start'>
<label className='text-slate-600 text-lg'>Recipient
<span className='text-red-500 mx-2'>*</span>
<span title='Transfer Recipient' className={`text-white text-sm bg-slate-500 w-1 h-1 rounded-full px-3 py-1 cursor-pointer`}>!</span>
</label>
<Link to='#' className='mx-1 text-base text-white p-3 bg-[orange] rounded-md hover:opacity-80'>Add New</Link>
</div>
<select className='mt-2 w-full p-3 text-lg bg-white rounded-md border border-slate-300 outline-0' name='recipient' onChange={handleChange}>
<option className='text-slate-500 text-lg' value="">Select...</option>
</select>
</div>
</div>
<div className='md:flex items-center justify-end'>
<div className="field w-full lg:w-1/2 mb-6">
<InputCom
label="Total"
type="text"
name="total"
value={sendMoneyFee.loading ? 'loading' : sendMoneyFee.total}
disable={true}
/>
</div>
</div>
<div className='w-full'>
<div className='relative my-3 md:flex items-center'>
<div className='transfer-input w-full'>
<div className='flex items-center justify-start py-2'>
<label className='text-[#181c32] dark:text-white text-base font-semibold block mb-2.5'>Recipient
<span className='text-red-500 mx-2'>*</span>
<span title='Transfer Recipient' className={`text-white text-sm bg-slate-500 w-1 h-1 rounded-full px-3 py-1 cursor-pointer`}>!</span>
</label>
<Link to='add-recipient' className='mx-1 text-base text-white p-2 bg-[orange] rounded-md hover:opacity-80'>Add New</Link>
</div>
<select className='w-full text-base p-2 text-dark-gray dark:text-white rounded-md border border-slate-300 outline-0' value={props.values.recipientID} name='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="">Select...</option>
{recipients.data.map((item, index)=>(
<option key={index} value={item.recipient_id} className='text-slate-500 text-lg'>{item.recipient}</option>
))}
</>
:
recipients.error ?
<option className='text-slate-500 text-lg' value="">Could'nt Load, try again!</option>
:
<option className='text-slate-500 text-lg' value="">No Recipient Found! Click Add to Add</option>
}
</select>
</div>
</div>
{(props.errors.recipientID && props.touched.recipientID) && <p className="text-sm text-red-500">{props.errors.recipientID}</p>}
</div>
<div className='my-3 md:flex items-center'>
<div className='transfer-input w-full'>
<label className='w-full text-slate-600 text-lg'>Comment <span className='text-red-500'>*</span></label>
<input className='w-full p-3 text-lg bg-slate-100 rounded-md outline-0 placeholder:text-slate-500 placeholder:text-lg'
value={inputs.comment}
name='comment'
type="text"
placeholder='Comment'
required
onChange={handleChange}
/>
</div>
</div>
<div className="field w-full mb-6">
{/* <InputCom
label="Comment"
type="text"
name="comment"
value={inputs.comment}
inputHandler={handleChange}
/> */}
<label className='text-[#181c32] dark:text-white text-base font-semibold block mb-2.5'>Comment</label>
<textarea style={{resize: 'none'}}
className='text-base px-6 text-dark-gray dark:text-white w-full bg-slate-100 dark:bg-[#11131F] focus:ring-0 focus:outline-none'
name="comment"
value={props.values.comment}
onChange={props.handleChange}
onBlur={props.handleBlur}
cols="30"
rows="2"
/>
</div>
<div className='transfer-fund-btn flex justify-end items-center py-4'>
<button onClick={handleSubmit} className='text-lg text-white bg-sky-blue px-4 py-2 hover:opacity-90 rounded-md'>Continue</button>
</div>
</form>
<div className='transfer-fund-btn flex justify-end items-center py-4'>
{requestStatus ?
<LoadingSpinner size='8' color='sky-blue' />
:
<button type='submit' className='text-lg text-white bg-sky-blue px-4 py-2 hover:opacity-90 rounded-md'>Continue</button>
}
</div>
</Form>
)
}}
</Formik>
</div>
</div>
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="wallet w-full md:p-8 p-4 h-[500px] bg-white dark:bg-dark-white overflow-y-auto rounded-2xl shadow">
<div className="wallet w-full md:p-8 p-4 h-full max-h-[800px] 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'>Recent Activity</h2>
<p className='text-base text-slate-500 dark:text-white'>Activity Report</p>
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="py-3">Date</th>
<th className="py-3">Recipient</th>
<th className="py-3">Amount/FeeConf/Status</th>
</tr>
</thead>
<tbody>
<tr className='text-slate-500'>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
<td className="py-3">Item</td>
</tr>
</tbody>
</table>
{payment.loading ?
<LoadingSpinner size='16' color='sky-blue' />
:
<RecentActivityTable payment={payment}/>
}
</div>
</div>
</div>
+94 -4
View File
@@ -1,11 +1,14 @@
import React from 'react'
import React, { useEffect, useState } from 'react'
import {Routes, Route, Outlet, Navigate} from 'react-router-dom'
import usersService from '../../services/UsersService'
import Layout from '../Partials/Layout'
import Balance from './Balance'
import TransferFund from './TransferFund'
import AddFund from './AddFund'
import AddRecipient from './AddRecipient'
import ConfirmTransfer from './ConfirmTransfer'
function Wallet() {
return (
@@ -20,12 +23,99 @@ function Wallet() {
const WalletRoutes = () => {
const apiCall = new usersService()
let [walletList, setWalletList] = useState({ // FOR WALLET LIST
loading: true,
data: [],
error: false
})
let [paymentHistory, setPaymentHistory] = useState({ // FOR PAYMENT HISTORY
loading: true,
data: [],
error: false
})
let [purchaseHistory, setPurchaseHistory] = useState({ // FOR PURCHASE HISTORY
loading: true,
data: [],
error: false
})
let [couponHistory, setCouponHistory] = useState({ // FOR COUPON HISTORY
loading: true,
data: [],
error: false
})
//FUNCTION TO GET WALLET LIST
const getWalletList = ()=>{
apiCall.getUserWallets(null).then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setWalletList(prev => ({...prev, loading: false}))
return
}
setWalletList(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setWalletList(prev => ({...prev, loading: false, error: true}))
})
}
//FUNCTION TO GET PAYMENT HISTORY
const getPaymentHistory = ()=>{
apiCall.getPaymentHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setPaymentHistory(prev => ({...prev, loading: false}))
return
}
setPaymentHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setPaymentHistory(prev => ({...prev, loading: false, error: true}))
})
}
//FUNCTION TO GET PURCHASE HISTORY
const getPurchaseHistory = ()=>{
apiCall.getPurchaseHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setPurchaseHistory(prev => ({...prev, loading: false}))
return
}
// console.log('purchase',res.data)
setPurchaseHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setPurchaseHistory(prev => ({...prev, loading: false, error: true}))
})
}
//FUNCTION TO GET COUPON HISTORY
const getCouponHistory = ()=>{
apiCall.getCouponHx().then((res)=>{
if(res.data.internal_return < 0){ // success but no data
setCouponHistory(prev => ({...prev, loading: false}))
return
}
setCouponHistory(prev => ({...prev, loading: false, data: res.data.result_list}))
}).catch((error)=>{
setCouponHistory(prev => ({...prev, loading: false, error: true}))
})
}
useEffect(()=>{
getWalletList()
getPaymentHistory()
getPurchaseHistory()
getCouponHistory()
}, [])
return (
<Routes>
<Route element={<Wallet />}>
<Route path='add-fund' element={<AddFund />} />
<Route path='transfer-fund' element={<TransferFund />} />
<Route index element={<Balance />} />
<Route path='add-fund' element={<AddFund payment={paymentHistory} />} />
<Route path='transfer-fund' element={<TransferFund payment={paymentHistory} wallet={walletList} />} />
<Route index element={<Balance payment={paymentHistory} purchase={purchaseHistory} coupon={couponHistory} wallet={walletList} />} />
<Route path='transfer-fund/add-recipient' element={<AddRecipient />} />
<Route path='transfer-fund/confirm-transfer' element={<ConfirmTransfer payment={paymentHistory} wallet={walletList} />} />
<Route path='*' element={<Navigate to='/' />} />
</Route>
</Routes>
@@ -0,0 +1,47 @@
import React from 'react'
function CouponTable({coupon}) {
return (
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="p-2">Date</th>
<th className="p-2">Description</th>
<th className="p-2">Amount</th>
<th className="p-2">Active</th>
</tr>
</thead>
{coupon.data.length ?
(
<tbody>
{coupon.data.map((item, index) => (
<tr key={index} className='text-slate-500'>
<td className="p-2">{item.added}</td>
<td className="p-2">{item.code}</td>
<td className="p-2">{item.amount}</td>
<td className="p-2">{item.status}</td>
</tr>
))}
</tbody>
)
:
coupon.error ?
(
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>Opps! an error occurred. Please try again!</td>
</tr>
</tbody>
)
:
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>No Purchase History Found!</td>
</tr>
</tbody>
}
</table>
)
}
export default CouponTable
@@ -0,0 +1,47 @@
import React from 'react'
function PurchasesTable({purchase}) {
return (
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="p-2">Date</th>
<th className="p-2">Description</th>
<th className="p-2">Amount</th>
<th className="p-2">Fee</th>
</tr>
</thead>
{purchase.data.length ?
(
<tbody>
{purchase.data.map((item, index) => (
<tr key={index} className='text-slate-500'>
<td className="p-2">{item.added_date}</td>
<td className="p-2">{item.confirmation}</td>
<td className="p-2">{item.amount}</td>
<td className="p-2">{item.fee}</td>
</tr>
))}
</tbody>
)
:
purchase.error ?
(
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>Opps! an error occurred. Please try again!</td>
</tr>
</tbody>
)
:
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>No Purchase History Found!</td>
</tr>
</tbody>
}
</table>
)
}
export default PurchasesTable
@@ -0,0 +1,47 @@
import React from 'react'
function RecentActivityTable({payment}) {
return (
<table className="wallet-activity w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="p-2">Date</th>
<th className="p-2">Recipient</th>
<th className="p-2">Amount/Fee</th>
<th className="p-2">Conf/Status</th>
</tr>
</thead>
{payment.data.length ?
(
<tbody>
{payment.data.map((item, index) => (
<tr key={index} className='text-slate-500'>
<td className="p-2">{item.trx_date}</td>
<td className="p-2" dangerouslySetInnerHTML={{__html:item.recipient}}></td>
<td className="p-2">{item.amount}/{item.fee}</td>
<td className="p-2">{item.status}</td>
</tr>
))}
</tbody>
)
:
payment.error ?
(
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>Opps! an error occurred. Please try again!</td>
</tr>
</tbody>
)
:
<tbody>
<tr className='text-slate-500'>
<td className="p-2" colSpan={4}>No Payment History Found!</td>
</tr>
</tbody>
}
</table>
)
}
export default RecentActivityTable
+25 -26
View File
@@ -1,3 +1,4 @@
import {Link} from 'react-router-dom'
import Icons from "../Helpers/Icons";
import bank1 from "../../assets/images/bank-1.png";
import bank2 from "../../assets/images/bank-2.png";
@@ -41,33 +42,30 @@ export default function WalletHeader(props) {
{props.myWalletList &&
props.myWalletList?.result_list?.length > 0 &&
props.myWalletList.result_list.map((value) => (
<>
<li className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple">
<div className="sm:flex justify-between items-center">
<div className="account-name flex space-x-4 items-center mb-2 sm:mb-0">
<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-base text-dark-gray dark:text-white font-medium">
{value.description}
</p>
</div>
props.myWalletList.result_list.map((value, index) => (
<li key={index} className="content-item py-4 border-b dark:border-[#5356fb29] border-light-purple hover:border-purple dark:hover:border-purple">
<div className="sm:flex justify-between items-center">
<div className="account-name flex space-x-4 items-center mb-2 sm:mb-0">
<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>
<p className="eth text-xl font-bold text-purple">
{value.amount*0.01} {value.code}
</p>
<p className="usd text-base text-thin-light-gray text-right">
{/*(773.69 USD)*/}
<div className="name">
<p className="text-base text-dark-gray dark:text-white font-medium">
{value.description}
</p>
</div>
</div>
</li>
</>
<div>
<p className="eth text-xl font-bold text-purple">
{(value.amount*1).toFixed(2)} {value.code}
</p>
<p className="usd text-base text-thin-light-gray text-right">
{/*(773.69 USD)*/}
</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">*/}
@@ -163,14 +161,15 @@ export default function WalletHeader(props) {
{/* </div>*/}
{/*</li>*/}
</ul>
<div className="add-money-btn flex justify-center items-center">
<button
<div className="add-money-btn flex justify-center items-center mt-3">
{/* <button
onClick={() => props.addMoneyHandler()}
type="button"
className="w-[122px] h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
Manage
</button>
</button> */}
<Link to='/my-wallet' className="w-[122px] h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white">Manage</Link>
</div>
</div>
</div>
+1 -1
View File
@@ -122,7 +122,7 @@ export default function MobileSidebar({ sidebar, action, logoutModalHandler }) {
className="nav-item flex items-center justify-start space-x-3.5"
>
<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">
<Icons name="wallet-two" />
<Icons name="notification" />
</span>
<span className="item-content group-hover:text-purple text-[18px] transition-all duration-300 ease-in-out text-lighter-gray relative font-medium active flex-1">
Messages
+3 -3
View File
@@ -122,7 +122,7 @@ export default function Sidebar({ sidebar, action, logoutModalHandler }) {
}`}
>
<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="active-bids" />
<Icons name="market" />
</span>
<span
className={`item-content relative group-hover:text-purple text-[18px] transition-all duration-300 ease-in-out text-lighter-gray font-medium ${
@@ -165,7 +165,7 @@ export default function Sidebar({ sidebar, action, logoutModalHandler }) {
}`}
>
<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="active-bids" />
<Icons name="notification-setting" />
</span>
<span
className={`item-content relative group-hover:text-purple text-[18px] transition-all duration-300 ease-in-out text-lighter-gray font-medium ${
@@ -185,7 +185,7 @@ export default function Sidebar({ sidebar, action, logoutModalHandler }) {
}`}
>
<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="active-bids" />
<Icons name="wallet-two" />
</span>
<span
className={`item-content relative group-hover:text-purple text-[18px] transition-all duration-300 ease-in-out text-lighter-gray font-medium ${
+119 -27
View File
@@ -1,14 +1,61 @@
import React, { useState } from 'react'
import React, { useEffect, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { toast } from "react-toastify";
import usersService from '../../services/UsersService';
function ReferralDisplay() {
let [referralList, setReferralList] = useState([]) // dummy remove later and call from API
const apiCall = new usersService() // GET API CALL
const navigate = useNavigate()
let [refHistoryReload, setRefHistoryReload] = useState(false) // Determines when referral history reloads
// STATE TO HOLD REFERRAL HISTORY
let [referralList, setReferralList] = useState({
loading: true,
error: false,
data: []
})
let [error, setError] = useState({message: '', loading: false}) // for displaying error message on the page
//function to call referral history API
const allReferrals = () => {
setReferralList({
loading: true,
error: false,
data: []
})
apiCall.getReferralHx().then((res)=>{
setReferralList((prev)=>{
return {...prev, loading: false, data:[...res.data.result_list]}
})
}).catch((error)=>{
setReferralList(prev => ({...prev, loading: false, error: true}))
})
}
//FUNCTION TO SEND REFERRAL MESSAGE
const sendReferralMsg = (postData) => {
apiCall.sendReferralMsg(postData).then((res)=>{
if(res.data.internal_return < 0){
setError({message:'Email already referred', loading: false})
return
}else{
setInputs({ firstname: '', lastname: '', email: '',})
toast.success("Message Sent");
setError({message:'', loading: false})
setRefHistoryReload(prev => !prev)
}
}).catch((error)=>{
setError({message:'Opps! an error occured, try again later', loading: false})
})
}
//STATE FOR CONTROLLED INPUTS
let [inputs, setInputs] = useState({
firstname: '',
lastname: '',
email: '',
status: 'pending'
email: ''
})
// FUNCTION TO HANDLE INPUT CHANGE
@@ -19,17 +66,30 @@ function ReferralDisplay() {
//FUNCTION TO HANDLE SUBMIT
const handleSubmit = (e) => {
e.preventDefault();
setError({message: '', loading: true})
let {firstname, lastname, email} = inputs
if(!firstname || !lastname || !email){
setError({message: 'Please fill all fields', loading: false})
return
}
//valid inputs before submitting. Just for texting remove later
setReferralList(prev => [...prev, inputs])
setInputs({
firstname: '',
lastname: '',
email: '',
status: 'pending'
})
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: 11032,
ref_firstname: firstname,
ref_lastname: lastname,
ref_email: email
};
sendReferralMsg(postData) // FUNCTION TO SEND REFERRAL MESSAGE
}
useEffect(()=>{
allReferrals()
}, [refHistoryReload])
return (
<div className="content-wrapper w-full lg:flex xl:space-x-8 lg:space-x-4 bottomMargin">
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
@@ -43,7 +103,6 @@ function ReferralDisplay() {
name='firstname'
type="text"
placeholder='Firstname'
required
onChange={handleChange}
/>
</div>
@@ -55,7 +114,6 @@ function ReferralDisplay() {
name='lastname'
type="text"
placeholder='Lastname'
required
onChange={handleChange}
/>
</div>
@@ -67,46 +125,80 @@ function ReferralDisplay() {
name='email'
type="email"
placeholder='Email'
required
onChange={handleChange}
/>
</div>
<hr />
{error.message != '' && <p className='text-base text-red-500 py-2'>{error.message}</p>}
<div className='referral-btn flex justify-end items-center py-4 border-b-4'>
{error.loading ?
<div className='flex items-center justify-center'>
<div role="status">
<svg aria-hidden="true" class="w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-sky-blue" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
</div>
</div>
:
<button type='submit' className='text-lg text-white bg-sky-blue p-2 hover:opacity-90 rounded-md'>Send Message</button>
}
</div>
</form>
</div>
</div>
<div className="lg:w-1/2 w-full mb-10 lg:mb-0">
<div className="referral w-full md:p-8 p-4 h-[400px] 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'>Referral List</h2>
<div className="referral 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='mb-2 text-slate-900 dark:text-white text-xl lg:text-2xl font-medium'>Referral List</h2>
{referralList.loading ?
(
<div className='flex items-center justify-center'>
<div role="status">
<svg aria-hidden="true" class="w-32 h-32 text-gray-200 animate-spin dark:text-gray-600 fill-sky-blue" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
</div>
</div>
)
:
(
<table className="referral-list w-full table-auto border-collapse text-left">
<thead className='border-b-2'>
<tr className='text-slate-600'>
<th className="py-3">Added/Name</th>
<th className="py-3">Email</th>
<th className="py-3">Status</th>
<th className="p-3">Added/Name</th>
<th className="p-3">Email</th>
<th className="p-3">Status</th>
</tr>
</thead>
<tbody>
{referralList.length ?
referralList.map(item => (
<tr className='text-slate-500'>
<td className="py-3">{item.firstname} {item.lastname}</td>
<td className="py-3">{item.email}</td>
<td className="py-3">{item.status}</td>
{referralList.data.length ?
referralList.data.map((item, index) => (
<tr key={index} className='text-slate-500'>
<td className="p-3">{item.added_date} / {item.firstname} {item.lastname}</td>
<td className="p-3">{item.email}</td>
<td className="p-3">{item.status}</td>
</tr>
))
:
(<tr className='text-slate-500'>
(
referralList.error ?
<tr className='text-slate-500'>
<td colSpan={3}>Opps! couldn't get referral history. Try reloading the page</td>
</tr>
:
(
<tr className='text-slate-500'>
<td colSpan={3}>No Item Found on referral List</td>
</tr>
)
)
}
</tbody>
</table>
)
}
</div>
</div>
</div>
+346 -276
View File
@@ -1,6 +1,46 @@
import React from "react";
import React, { useEffect, useState } from "react";
import Icons from "../../Helpers/Icons";
import InputCom from "../../Helpers/Inputs/InputCom";
import {Link, useNavigate} from 'react-router-dom'
import usersService from "../../../services/UsersService";
import LoadingSpinner from "../../Spinners/LoadingSpinner";
import {toast} from 'react-toastify'
import {Formik, Form} from 'formik'
import * as Yup from 'yup'
const validationSchema = Yup.object().shape({
email: Yup.string()
.email('Wrong email format')
.min(3, 'Minimum 3 characters')
.max(50, 'Maximum 50 characters')
.required('Email is required'),
firstname: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('Firstname is required'),
lastname: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('Lastname is required'),
city: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('City is required'),
state: Yup.string()
.min(3, 'Minimum 3 characters')
.max(25, 'Maximum 25 characters')
.required('State is required'),
})
const initialValues = {
firstname: '',
lastname: '',
state: '',
city: '',
email: ''
}
export default function PersonalInfoTab({
datas,
@@ -16,283 +56,313 @@ export default function PersonalInfoTab({
browseCoverImg,
coverImgChangHandler,
}) {
return (
<div className="personal-info-tab w-full flex flex-col justify-between">
<div className="flex flex-col-reverse sm:flex-row">
<div className="flex-1 sm:mr-10">
<div className="fields w-full">
{/* first name and last name */}
<div className="xl:flex xl:space-x-7 mb-6">
<div className="field w-full mb-6 xl:mb-0">
<InputCom
label="First Name"
type="text"
name="firstName"
placeholder="First Name Here"
value={datas}
inputHandler={frstNmeHndlr}
/>
</div>
<div className="field w-full">
<InputCom
label="Last Name"
type="text"
name="lastName"
placeholder="Last Name Here"
value={datas}
inputHandler={lstNmeHndlr}
/>
</div>
</div>
{/* User Name */}
<div className="field w-full mb-6">
<InputCom
label="User Name"
type="text"
name="userName"
placeholder="@example"
value={datas}
inputHandler={lstNmeHndlr}
/>
</div>
{/* External Links */}
<div className="field w-full mb-6">
<InputCom
label="External Links"
type="text"
name="link"
placeholder="https:yoursite.lo/imte/item_name123"
value={datas}
inputHandler={lstNmeHndlr}
/>
</div>
{/* bio */}
<div className="field w-full mb-6">
<h1 className="field-title">Bio </h1>
<div className="input-field mt-2">
<div className="input-wrapper w-full ">
<textarea
value={datas}
onChange={(e) => dscrphn(e)}
placeholder="provide a detailed description of your item."
rows="7"
className="w-full h-full px-7 py-4 border border-light-purple dark:border-[#5356fb29] rounded-[20px] text-dark-gray dark:text-white bg-[#FAFAFA] dark:bg-[#11131F] focus:ring-0 focus:outline-none"
/>
</div>
</div>
</div>
{/* email */}
<div className="field w-full mb-6">
<InputCom
label="Email"
type="email"
name="email"
placeholder="https:yoursite.lo/imte/item_name123"
value={datas}
inputHandler={lstNmeHndlr}
/>
<p className="text-thin-light-gray text-sm tracking-wide mt-3">
Your email for marketplace notifications
</p>
</div>
</div>
{/* border line */}
<div className="w-full h-[1px] bg-[#E3E4FE] dark:bg-[#a7a9b533] mb-6"></div>
<div className="social-connetion w-full">
<div className="mb-6">
{/* headings */}
<div className="mb-4">
<h1 className="text-xl text-dark-gray dark:text-white tracking-wide font-bold mb-1.5">
Social Connections
</h1>
<p className="text-sm tracking-wide text-thin-light-gray">
Help collectors verify your account by connecting Twitter
</p>
</div>
<div className="flex justify-between items-center ">
<div className="flex space-x-2.5 items-center">
<div className="w-[44px] h-[44px] rounded-full bg-[#E0F2FD] flex justify-center items-center">
<span>
<svg
width="23"
height="19"
viewBox="0 0 23 19"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 17.0066C2.46188 17.0803 4.69827 16.4768 6.78777 14.9218C4.65896 14.6476 3.19321 13.6316 2.38327 11.5697C3.08253 11.5697 3.68869 11.5697 4.29588 11.5697C2.09881 10.6971 0.869935 9.1764 0.703396 6.7914C1.37576 6.9763 1.99951 7.14666 2.62222 7.31805C0.666157 5.02758 0.227569 2.9085 1.41507 0.9307C4.01246 3.90364 7.22015 5.64253 11.155 5.89391C11.155 5.44101 11.1405 5.04628 11.1571 4.65259C11.2409 2.67998 12.208 1.25376 13.9686 0.46118C15.6847 -0.31166 17.3821 -0.119489 18.8665 1.08548C19.3403 1.47086 19.7509 1.5311 20.2702 1.3192C20.9519 1.04081 21.6367 0.77177 22.3866 0.471567C22.0546 1.52383 21.3605 2.23746 20.6519 3.0103C21.3998 2.80774 22.1476 2.60622 22.8955 2.40367C22.9307 2.43483 22.9659 2.46599 23.001 2.49715C22.4218 3.10587 21.8818 3.76029 21.2498 4.30564C20.8691 4.63389 20.7191 4.95798 20.7067 5.44101C20.6074 9.13796 19.3444 12.3727 16.7698 15.0361C14.2769 17.6143 11.2109 18.8836 7.62874 18.9917C4.97239 19.0716 2.5105 18.4775 0.217225 17.1458C0.141714 17.1032 0.071374 17.0533 0 17.0066Z"
fill="#33AAF2"
/>
</svg>
</span>
</div>
<p className="text-18 dark:text-white tracking-wide">
Twitter
</p>
</div>
<div>
<p className="text-18 tracking-wide text-[#33AAF2] border-b dark:border-[#5356fb29] border-[#33AAF2]">
Cannect
</p>
</div>
</div>
</div>
<div className="mb-10">
{/* headings */}
<div className="sm:flex justify-between items-center mb-4">
<div className="mr-16 mb-5 sm:mb-0">
<h1 className="text-xl text-dark-gray dark:text-white tracking-wide font-bold mb-1.5">
Verification
</h1>
<p className="text-sm tracking-wide text-thin-light-gray leading-7">
Proceed with verification process to get more visibility and
gain trust on NFTMAX Marketplace.
</p>
</div>
<div>
<a
href="#"
className="w-[136px] h-[46px] flex justify-center items-center text-18 tracking-wide rounded-full text-white bg-light-green hover:bg-green-600 transition duration-300 ease-in-out"
>
Get Verified
</a>
</div>
</div>
</div>
</div>
</div>
<div className="w-[232px] mb-10">
<div className="update-profile w-full mb-9">
<h1 className="text-xl tracking-wide font-bold text-dark-gray dark:text-white flex items-center mb-2">
Update Profile
<span className="ml-1">
<Icons name="block-question" />
</span>
</h1>
<p className="text-base text-thin-light-gray mb-5">
Profile of at least Size
<span className="ml-1 text-dark-gray dark:text-white">
300x300
</span>
. Gifs work too.
<span className="ml-1 text-dark-gray dark:text-white">
Max 5mb
</span>
.
</p>
<div className="flex justify-center">
<div className="w-full relative">
<img
src={profileImg}
alt=""
className="sm:w-[198px] sm:h-[198px] w-[120px] h-[120px] rounded-full overflow-hidden object-cover"
/>
<input
ref={profileImgInput}
onChange={(e) => profileImgChangHandler(e)}
type="file"
className="hidden"
/>
<div
onClick={browseProfileImg}
className="w-[32px] h-[32px] absolute bottom-7 sm:right-10 right-[105px] hover:bg-pink bg-dark-gray rounded-full cursor-pointer"
>
<svg
width="32"
height="32"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16.5147 11.5C17.7284 12.7137 18.9234 13.9087 20.1296 15.115C19.9798 15.2611 19.8187 15.4109 19.6651 15.5683C17.4699 17.7635 15.271 19.9587 13.0758 22.1539C12.9334 22.2962 12.7948 22.4386 12.6524 22.5735C12.6187 22.6034 12.5663 22.6296 12.5213 22.6296C11.3788 22.6334 10.2362 22.6297 9.09365 22.6334C9.01498 22.6334 9 22.6034 9 22.536C9 21.4009 9 20.2621 9.00375 19.1271C9.00375 19.0746 9.02997 19.0109 9.06368 18.9772C10.4123 17.6249 11.7609 16.2763 13.1095 14.9277C14.2295 13.8076 15.3459 12.6913 16.466 11.5712C16.4884 11.5487 16.4997 11.5187 16.5147 11.5Z"
fill="white"
/>
<path
d="M20.9499 14.2904C19.7436 13.0842 18.5449 11.8854 17.3499 10.6904C17.5634 10.4694 17.7844 10.2446 18.0054 10.0199C18.2639 9.76139 18.5261 9.50291 18.7884 9.24443C19.118 8.91852 19.5713 8.91852 19.8972 9.24443C20.7251 10.0611 21.5492 10.8815 22.3771 11.6981C22.6993 12.0165 22.7105 12.4698 22.3996 12.792C21.9238 13.2865 21.4443 13.7772 20.9686 14.2717C20.9648 14.2792 20.9536 14.2867 20.9499 14.2904Z"
fill="white"
/>
</svg>
</div>
</div>
</div>
</div>
<div className="update-profile w-full">
<h1 className="text-xl tracking-wide font-bold text-dark-gray dark:text-white flex items-center mb-2">
Update Cover
<span className="ml-1">
<Icons name="block-question" />
</span>
</h1>
<p className="text-base text-thin-light-gray mb-5">
Cover of at least Size
<span className="ml-1 text-dark-gray dark:text-white">
1170x920
</span>
.
</p>
<div className="flex justify-center">
<div className="w-full relative">
<img
src={coverImg}
alt=""
className="w-full h-[120px] rounded-lg overflow-hidden object-cover"
/>
<input
ref={coverImgInput}
onChange={(e) => coverImgChangHandler(e)}
type="file"
className="hidden"
/>
<div
onClick={browseCoverImg}
className="w-[32px] h-[32px] absolute -bottom-4 right-4 bg-dark-gray hover:bg-pink rounded-full cursor-pointer"
>
<svg
width="32"
height="32"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16.5147 11.5C17.7284 12.7137 18.9234 13.9087 20.1296 15.115C19.9798 15.2611 19.8187 15.4109 19.6651 15.5683C17.4699 17.7635 15.271 19.9587 13.0758 22.1539C12.9334 22.2962 12.7948 22.4386 12.6524 22.5735C12.6187 22.6034 12.5663 22.6296 12.5213 22.6296C11.3788 22.6334 10.2362 22.6297 9.09365 22.6334C9.01498 22.6334 9 22.6034 9 22.536C9 21.4009 9 20.2621 9.00375 19.1271C9.00375 19.0746 9.02997 19.0109 9.06368 18.9772C10.4123 17.6249 11.7609 16.2763 13.1095 14.9277C14.2295 13.8076 15.3459 12.6913 16.466 11.5712C16.4884 11.5487 16.4997 11.5187 16.5147 11.5Z"
fill="white"
/>
<path
d="M20.9499 14.2904C19.7436 13.0842 18.5449 11.8854 17.3499 10.6904C17.5634 10.4694 17.7844 10.2446 18.0054 10.0199C18.2639 9.76139 18.5261 9.50291 18.7884 9.24443C19.118 8.91852 19.5713 8.91852 19.8972 9.24443C20.7251 10.0611 21.5492 10.8815 22.3771 11.6981C22.6993 12.0165 22.7105 12.4698 22.3996 12.792C21.9238 13.2865 21.4443 13.7772 20.9686 14.2717C20.9648 14.2792 20.9536 14.2867 20.9499 14.2904Z"
fill="white"
/>
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
<div className="content-footer w-full">
<div className="w-full h-[120px] border-t border-light-purple dark:border-[#5356fb29] flex justify-end items-center">
<div className="flex space-x-4 mr-9">
<button
type="button"
className="text-18 text-light-red tracking-wide "
>
<span className="border-b dark:border-[#5356fb29] border-light-red">
{" "}
Cancel
</span>
</button>
<button
type="button"
className="w-[152px] h-[46px] flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
Upadate Profile
</button>
</div>
const apiCall = new usersService()
let navigate = useNavigate()
let [togglePromotion, setTogglePromotion] = useState(false)
let [profile, setProfile] = useState({ // state for requesting from load profile API
data: [],
loading: true,
status: false
})
let [requestStatus, setRequestState] = useState({ // state for requesting from update api
message: '',
loading: false,
status: false
})
let [inputs, setInputs] = useState({ // State for input fields
firstname: '',
lastname: '',
state: '',
city: '',
email: ''
})
// const handleChange = ({target:{name, value}}) => {
// setInputs(prev => ({...prev, [name]:value}))
// }
const handleUpdateUser = (values, helpers)=> {
setRequestState({message: '', loading: true, status: false})
apiCall.updateProfile(values).then((res)=>{
if(res.data.internal_return < 0){
setRequestState({message: 'Profile Was unable to update', loading: false, status: false})
return
}
// setRequestState({message: 'Profile update successfully', loading: false, status: true})
toast.success("Update Successful");
setTimeout(()=>{navigate('/',{replace:true})},1000)
}).catch(error => {
setRequestState({message: 'Opps! an error occurred. Try Agian', loading: false, status: false})
})
}
const loadProfile = ()=>{ // function to load user profile
apiCall.loadProfile().then((res)=>{
if(res.data.internal_return < 0){
setProfile(prev => ({...prev, loading: false, status: true}))
return
}
setProfile(prev => ({...prev, data: [res.data], loading: false, status: true}))
setInputs({
firstname: res.data.firstname,
lastname: res.data.lastname,
state: res.data.state,
city: res.data.city,
email: res.data.email
})
}).catch(error =>{
setProfile(prev => ({...prev, loading: false, status: false}))
})
}
useEffect(()=>{
loadProfile() // loads user profile unto the page
},[])
return (
profile.loading ?
<div className="personal-info-tab w-full flex flex-col justify-between">
<div className="p-3">
<LoadingSpinner size='32' color='sky-blue' />
</div>
</div>
</div>
:
<div className="personal-info-tab w-full flex flex-col justify-between">
<Formik initialValues={inputs} validationSchema={validationSchema} onSubmit={handleUpdateUser}>
{(props => {
return (
<Form>
{
profile.data.length ?
profile.data.map((item, index) => (
<div key={index} className="flex flex-col-reverse sm:flex-row">
<div className="flex-1 sm:mr-10">
<div className="fields w-full">
{/* inputs starts here */}
{/* username */}
<div className="field w-full mb-6">
<InputCom
label="User Name"
type="text"
name="username"
placeholder=""
value={item.username}
disable={true}
/>
</div>
{/* Email */}
<div className="field w-full mb-6">
<InputCom
label="Email"
type="text"
name="email"
placeholder="Email"
value={props.values.email}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{(props.errors.email && props.touched.email) && <p className="text-sm text-red-500">{props.errors.email}</p>}
</div>
{/* first name and last name */}
<div className="xl:flex xl:space-x-7 mb-6">
<div className="field w-full mb-6 xl:mb-0">
<InputCom
label="First Name"
type="text"
name="firstname"
placeholder="First Name"
value={props.values.firstname}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{(props.errors.firstname && props.touched.firstname) && <p className="text-sm text-red-500">{props.errors.firstname}</p>}
</div>
<div className="field w-full">
<InputCom
label="Last Name"
type="text"
name="lastname"
placeholder="Last Name"
value={props.values.lastname}
inputHandler={props.handleChange}
blurHandler={props.handleBlur}
/>
{(props.errors.lastname && props.touched.lastname) && <p className="text-sm text-red-500">{props.errors.lastname}</p>}
</div>
</div>
{/* Country */}
<div className="field w-full mb-6">
<InputCom
label="Country"
type="text"
name="country"
value={item.country}
disable={true}
/>
</div>
{/* State/Province */}
<div className="field w-full mb-6">
<InputCom
label="State/Province"
type="text"
name="state"
placeholder="State"
value={props.values.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 mb-6">
<InputCom
label="City"
type="text"
name="city"
placeholder="City"
value={props.values.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>
{/* Preferred Communication*/}
<div className='field w-full mb-6 md:flex items-center space-x-4'>
<label className='input-label text-[#181c32] dark:text-white text-base font-semibold'>Pref. Communication</label>
<div className="check-box">
<div className="flex items-center justify-start">
<div className="check-input flex items-center mr-1">
<input className="w-4 h-4 cursor-pointer" type="checkbox" name="prefcomm1" id="" />
<span className="mx-2 text-base text-dark-gray dark:text-white">Email</span>
</div>
<div className="check-input flex items-center">
<input className="w-4 h-4 cursor-pointer" type="checkbox" name="prefcomm2" id="" />
<span className="mx-2 text-base text-dark-gray dark:text-white">Phone</span>
</div>
</div>
</div>
</div>
{/* Allow Promotions */}
<div className='field w-full mb-6 flex items-center space-x-4'>
<label className='input-label text-[#181c32] dark:text-white text-base font-semibold'>Allow Promotions</label>
<div className="cursor-pointer flex items-center" onClick={()=>setTogglePromotion(prev => !prev)}>
<div className={`h-6 w-8 mr-1 p-1 ${togglePromotion ? '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>
</div>
</div>
{/* inputs ends here */}
</div>
</div>
<div className="w-[232px] mb-10">
<div className="update-profile w-full mb-9">
<h1 className="text-xl tracking-wide font-bold text-dark-gray dark:text-white flex items-center mb-2">
Update Profile
<span className="ml-1">
<Icons name="block-question" />
</span>
</h1>
<p className="text-base text-thin-light-gray mb-5">
Profile of at least Size
<span className="ml-1 text-dark-gray dark:text-white">
300x300
</span>
. Gifs work too.
<span className="ml-1 text-dark-gray dark:text-white">
Max 5mb
</span>
.
</p>
<div className="flex justify-center">
<div className="w-full relative">
<img
src={profileImg}
alt=""
className="sm:w-[198px] sm:h-[198px] w-[120px] h-[120px] rounded-full overflow-hidden object-cover"
/>
<input
ref={profileImgInput}
onChange={(e) => profileImgChangHandler(e)}
type="file"
className="hidden"
/>
<div
onClick={browseProfileImg}
className="w-[32px] h-[32px] absolute bottom-7 sm:right-10 right-[105px] hover:bg-pink bg-dark-gray rounded-full cursor-pointer"
>
<svg
width="32"
height="32"
viewBox="0 0 32 32"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M16.5147 11.5C17.7284 12.7137 18.9234 13.9087 20.1296 15.115C19.9798 15.2611 19.8187 15.4109 19.6651 15.5683C17.4699 17.7635 15.271 19.9587 13.0758 22.1539C12.9334 22.2962 12.7948 22.4386 12.6524 22.5735C12.6187 22.6034 12.5663 22.6296 12.5213 22.6296C11.3788 22.6334 10.2362 22.6297 9.09365 22.6334C9.01498 22.6334 9 22.6034 9 22.536C9 21.4009 9 20.2621 9.00375 19.1271C9.00375 19.0746 9.02997 19.0109 9.06368 18.9772C10.4123 17.6249 11.7609 16.2763 13.1095 14.9277C14.2295 13.8076 15.3459 12.6913 16.466 11.5712C16.4884 11.5487 16.4997 11.5187 16.5147 11.5Z"
fill="white"
/>
<path
d="M20.9499 14.2904C19.7436 13.0842 18.5449 11.8854 17.3499 10.6904C17.5634 10.4694 17.7844 10.2446 18.0054 10.0199C18.2639 9.76139 18.5261 9.50291 18.7884 9.24443C19.118 8.91852 19.5713 8.91852 19.8972 9.24443C20.7251 10.0611 21.5492 10.8815 22.3771 11.6981C22.6993 12.0165 22.7105 12.4698 22.3996 12.792C21.9238 13.2865 21.4443 13.7772 20.9686 14.2717C20.9648 14.2792 20.9536 14.2867 20.9499 14.2904Z"
fill="white"
/>
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
))
:
profile.status ?
<div className="py-3 text-slate-500">No User Information Found!</div>
:
<div className="py-3 text-slate-500">Opps! something went wrong. Try Again Later!</div>
}
<div className="content-footer w-full">
{requestStatus.message != '' && <p className={`text-center text-base ${requestStatus.status ? 'text-green-800' : 'text-red-600'}`}>{requestStatus.message}</p>}
<div className="w-full h-[120px] border-t border-light-purple dark:border-[#5356fb29] flex justify-end items-center">
<div className="flex items-center space-x-4 mr-9">
<Link
to='/'
className="text-18 text-light-red tracking-wide "
>
<span className="border-b dark:border-[#5356fb29] border-light-red">
{" "}
Cancel
</span>
</Link>
{requestStatus.loading ?
<LoadingSpinner size='8' color='sky-blue' />
:
<button
type="submit"
className="w-[152px] h-[46px] flex justify-center items-center btn-gradient text-base rounded-full text-white"
>
Update Profile
</button>
}
</div>
</div>
</div>
</Form>
)
})}
</Formik>
</div>
);
}
@@ -0,0 +1,16 @@
import React from 'react'
function LoadingSpinner({size, color}) {
return (
<div className='flex items-center justify-center'>
<div role="status">
<svg aria-hidden="true" className={`w-${size} h-${size} text-gray-200 animate-spin dark:text-gray-600 fill-${color}`} viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
</svg>
</div>
</div>
)
}
export default LoadingSpinner
+21
View File
@@ -0,0 +1,21 @@
/**
Returns a debounced version of a given function, which means that it delays the execution of the function until a certain amount of time has passed without the function being called again. This can be useful for performance optimization, especially when dealing with expensive or resource-intensive functions that are called frequently.
@param {Function} func - The function to debounce.
@param {number} delay - The number of milliseconds to wait before executing the debounced function.
@returns {Function} - The debounced version of the original function.
*/
export default function debounce(func, delay) {
let timeoutId;
return function (...args) {
const context = this;
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
func.apply(context, args);
}, delay);
};
}
+20
View File
@@ -10,6 +10,12 @@
src: url("./assets/fonts/Product Sans Bold.ttf");
}
.banner-630-340{
width: 630px;
height: 340px;
background-color: aliceblue;
}
/* Bold italic Weight */
@font-face {
font-family: "Product Sans";
@@ -712,4 +718,18 @@ TODO: Responsive ===========================
.content-wrapper.login{
--bg-color: 255,255,255;
background: linear-gradient(90deg, rgba(236,237,240,1) 0%, rgba(255,255,255,1) 50%, rgba(236,237,240,1) 100%);
}
.content-wrapper select {
/* for Firefox */
-moz-appearance: none;
/* for Chrome */
-webkit-appearance: none;
appearance: none;
padding-inline: 1rem;
}
/* For IE10 */
.content-wrapper select::-ms-expand {
display: none;
}
+48 -1
View File
@@ -1,7 +1,54 @@
import { Navigate, Outlet } from "react-router-dom";
import { useEffect, useState } from "react";
import { Navigate, Outlet, useLocation, useNavigate } from "react-router-dom";
const AuthRoute = ({ redirectPath = "/login", children }) => {
const [lastActivityTime, setLastActivityTime] = useState(Date.now());
const isLogin = localStorage.getItem("email");
const navigate = useNavigate();
const { pathname } = useLocation();
//Removing Data stored at localStorage after session expires
const expireSession = () => {
localStorage.removeItem("email");
localStorage.removeItem('session_token');
localStorage.removeItem('firstname');
localStorage.removeItem('member_id');
localStorage.removeItem('lastname');
localStorage.removeItem('state');
localStorage.removeItem('last_login');
localStorage.removeItem('uid');
localStorage.removeItem('session');
localStorage.removeItem('city');
localStorage.removeItem('country');
localStorage.removeItem('loglevel');
localStorage.removeItem('zip_code');
localStorage.removeItem('added');
navigate("/login", { replace: true }); // redirects user to login page after session expires
};
const checkInactivity = setInterval(() => {
if (Date.now() - lastActivityTime > process.env.REACT_APP_SESSION_EXPIRE_MINUTES) {
expireSession()
}
}, process.env.REACT_APP_SESSION_EXPIRE_CHECKER) // Checks for inactivity every minute
// Reset last activity time on user input
const resetTime = () => {
setLastActivityTime(Date.now());
}
window.addEventListener('mousemove', resetTime)
window.addEventListener('keydown', resetTime)
useEffect(() => {
// cleaning up listeners
return () => {
clearInterval(checkInactivity)
window.removeEventListener('mousemove', resetTime)
window.removeEventListener('keydown', resetTime)
}
}, [pathname, lastActivityTime])
if (!isLogin) {
return <Navigate to={redirectPath} replace />;
}
+173 -13
View File
@@ -6,6 +6,16 @@ class usersService {
console.log("WRB Service Entry");
}
CreateUser(reqData){
localStorage.setItem("session_token", ``);
return this.postAuxEnd("/createuser", reqData);
}
CompleteSignUp(reqData){
localStorage.setItem("session_token", ``);
return this.postAuxEnd("/completesignuplink", reqData);
}
getHomeDate(){
var postData = {
uuid: localStorage.getItem("uuid"),
@@ -48,11 +58,6 @@ class usersService {
return this.postAuxEnd("/apigate", null);
}
CreateUser(){
// localStorage.setItem("session_token", ``);
return this.postAuxEnd("/createuser", null);
}
getLoadProfile(){
var postData = {
uuid: localStorage.getItem("uid"),
@@ -96,7 +101,7 @@ class usersService {
return this.postAuxEnd("/getjobsdata", postData);
}
getMyJobList(){
getHeroJBanners(){
var postData = {
uuid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
@@ -104,7 +109,19 @@ class usersService {
page:0,
limit :100
};
return this.postAuxEnd("/myjobs", postData);
return this.postAuxEnd("/homebanners", postData);
}
getMyJobList(){
var postData = {
uuid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
page:0,
offset:0,
limit :100
};
return this.postAuxEnd("/jobmanagerlist", postData);
}
getGetPendingJobs(){
@@ -140,17 +157,124 @@ class usersService {
return this.postAuxEnd("/couponpending", postData);
}
getCouponHx(){
var postData = {
uuid: localStorage.getItem("uid"),
// API FUNCTION TO GET COUPON HISTORY
getRecipient(){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
page:1,
limit :20,
action: 11175
};
return this.postAuxEnd("/recipients", postData);
}
//END POINT CALL FOR UPDATE PROFILE
addRecipient(data){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
page:0,
limit :100
};
...data
};
return this.postAuxEnd("/addrecipient", postData);
}
// API FUNCTION TO GET SEND MONEY FEE
getSendMoneyFee(amount){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
amount,
action: 33025
};
return this.postAuxEnd("/sendmoneyfee", postData);
}
// API FUNCTION TO GET COUPON HISTORY
getCouponHx(){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
page:1,
limit :20,
action: 85025
};
return this.postAuxEnd("/couponhx", postData);
}
getPurchaseHx(){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
page:1,
limit :20,
action: 15049
};
return this.postAuxEnd("/purchasehx", postData);
}
// API FUNCTION TO GET PAYMENT HISTORY
getPaymentHx(){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
page:1,
limit :20,
action: 15046
};
return this.postAuxEnd("/paymenthx", postData);
}
//END POINT CALL FOR REFERRAL HISTORY
getReferralHx(){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
offset: 1,
limit :100,
action: 11064
};
return this.postAuxEnd("/refferhx", postData);
}
//END POINT CALL FOR UPDATE PROFILE
updateProfile(post){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: 5031,
...post
};
return this.postAuxEnd("/updateprofile", postData);
}
//END POINT CALL FOR GETTING USER PROFILE
loadProfile(post){
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
};
return this.postAuxEnd("/loadprofile", postData);
}
//END POINT CALL FOR SENDING REFERRAL MESSAGE
sendReferralMsg(postData){
return this.postAuxEnd("/sendreferral", postData);
}
StartResetPassword(reqData){
return this.postAuxEnd("/startresetpasword", reqData)
}
getCouponRedeem(){
var postData = {
uuid: localStorage.getItem("uid"),
@@ -162,6 +286,42 @@ class usersService {
return this.postAuxEnd("/couponredeem", postData);
}
// Country Data {GET}
getSignupCountryData() {
return this.postAuxEnd("/signupcountry", null);
}
// END POINT TO GET BANK NAME
getCountryBank() {
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: 11183,
country: 'NG'
};
return this.postAuxEnd("/countrybanks", postData);
}
// END POINT TO GET ACCOUNT TYPE
getAccountTypes() {
var postData = {
uid: localStorage.getItem("uid"),
member_id: localStorage.getItem("member_id"),
sessionid: localStorage.getItem("session_token"),
action: 11177
};
return this.postAuxEnd("/accounttypes", postData);
}
verifyEmail(code) {
const reqData = {
verify_link: code,
action: 11015
}
return this.postAuxEnd("/verifysignuplink", reqData);
}
/*
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username)
- 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)
+18 -2
View File
@@ -1,7 +1,23 @@
import React from "react";
import React, {useState, useEffect} from 'react'
import Home from "../components/Home";
import usersService from "../services/UsersService";
export default function HomePages() {
const [marketActiveJobList, setMarketActiveJobList] = useState([]);
const api = new usersService();
const getMarketActiveJobList = async () => {
try {
const res = await api.getHeroJBanners();
setMarketActiveJobList(res.data);
} catch (error) {
console.log("Error getting mode");
}
};
useEffect(() => {
getMarketActiveJobList();
}, []);
return (
<>
<Home />
+2 -2
View File
@@ -24,10 +24,10 @@ export default function MyJobsPage() {
getMyJobList();
}, []);
debugger;
// debugger;
return (
<>
<MyJobs />
<MyJobs MyJobList={MyJobList} />
</>
);
}
+5
View File
@@ -0,0 +1,5 @@
import VerifyLink from "../components/AuthPages/VerifyLink";
export default function VerifyLinkPages() {
return <VerifyLink />;
}
+4042 -4758
View File
File diff suppressed because it is too large Load Diff