diff --git a/.env b/.env index cc38e78..58ed8da 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ SKIP_PREFLIGHT_CHECK=true +REACT_APP_NODE_ENV="development" REACT_APP_FACEBOOK="https://www.facebook.com/profile.php?id=100066498622246" REACT_APP_TWITTER="https://twitter.com/fluxtra" diff --git a/.env.development b/.env.development index 96c14b6..1ac7d2f 100644 --- a/.env.development +++ b/.env.development @@ -1,4 +1,5 @@ SKIP_PREFLIGHT_CHECK=true +REACT_APP_NODE_ENV="development" REACT_APP_FACEBOOK="https://www.facebook.com/profile.php?id=100066498622246" REACT_APP_TWITTER="https://twitter.com/fluxtra" diff --git a/.env.production b/.env.production index 85c6cee..1cf48dc 100644 --- a/.env.production +++ b/.env.production @@ -1,4 +1,5 @@ SKIP_PREFLIGHT_CHECK=true +REACT_APP_NODE_ENV="production" REACT_APP_FACEBOOK="https://www.facebook.com/profile.php?id=100066498622246" REACT_APP_TWITTER="https://twitter.com/fluxtra" diff --git a/package.json b/package.json index 132096d..7be2005 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "0.2.0", "private": true, "dependencies": { + "@fvilers/disable-react-devtools": "^1.3.0", "@react-oauth/google": "^0.11.0", "@reduxjs/toolkit": "^1.8.2", "@tailwindcss/line-clamp": "^0.3.1", diff --git a/src/App.jsx b/src/App.jsx index c4a2ad2..2c6e9c3 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -4,6 +4,11 @@ import Toaster from "./components/Helpers/Toaster"; import Default from "./components/Partials/Default"; import SocketIOContextProvider from "./components/Contexts/SocketIOContext"; +import { disableReactDevTools } from '@fvilers/disable-react-devtools'; + +if (process.env.REACT_APP_NODE_ENV === 'production') { + disableReactDevTools(); +} function App() { const { pathname } = useLocation(); return ( diff --git a/src/components/AuthPages/Login/LoginLanding.jsx b/src/components/AuthPages/Login/LoginLanding.jsx index 27dbc82..e6be93d 100644 --- a/src/components/AuthPages/Login/LoginLanding.jsx +++ b/src/components/AuthPages/Login/LoginLanding.jsx @@ -16,11 +16,12 @@ import IOSDownload from '../../../assets/images/download/apple.jpg' export default function LoginLanding() { + const dispatch = useDispatch(); + const location = useLocation(); + const queryParams = new URLSearchParams(location?.search); // const sessionExpired = queryParams.get("sessionExpired"); - const dispatch = useDispatch(); - const { state } = useLocation(); const navigate = useNavigate(); const userApi = new usersService(); diff --git a/src/components/AuthPages/Login/index.jsx b/src/components/AuthPages/Login/index.jsx index acc3f40..46d2471 100644 --- a/src/components/AuthPages/Login/index.jsx +++ b/src/components/AuthPages/Login/index.jsx @@ -17,12 +17,13 @@ import { updateUserDetails } from "../../../store/UserDetails"; import ReCAPTCHA from "react-google-recaptcha"; export default function Login() { + const dispatch = useDispatch(); + const location = useLocation(); + // eslint-disable-next-line no-restricted-globals const queryParams = new URLSearchParams(location?.search); // const sessionExpired = queryParams.get("sessionExpired"); - const dispatch = useDispatch(); - const { state } = useLocation(); const [sessionExpired, setSessionExpired] = useState(queryParams.get("sessionExpired")) @@ -220,7 +221,7 @@ export default function Login() { let loginValue = readCookie("loginType"); setLoginType(loginValue); - if (state?.error) { + if (location?.state?.error) { //check if the login path has an error state indicating any social handle login with error setMsgError("Unexpected Error, Please try again soon."); setTimeout(() => { diff --git a/src/components/AuthPages/Login/index2.jsx b/src/components/AuthPages/Login/index2.jsx index d3a7937..4fce279 100644 --- a/src/components/AuthPages/Login/index2.jsx +++ b/src/components/AuthPages/Login/index2.jsx @@ -20,12 +20,13 @@ import GoogleDownload from '../../../assets/images/download/andriod.jpg' import IOSDownload from '../../../assets/images/download/apple.jpg' export default function Login() { + const dispatch = useDispatch(); + const location = useLocation(); + // eslint-disable-next-line no-restricted-globals const queryParams = new URLSearchParams(location?.search); // const sessionExpired = queryParams.get("sessionExpired"); - const dispatch = useDispatch(); - const { state } = useLocation(); const [sessionExpired, setSessionExpired] = useState( queryParams.get("sessionExpired") @@ -200,8 +201,8 @@ export default function Login() { // }, []); useEffect(()=>{ - if(state && state.loginType){ - setLoginType(state.loginType) + if(location?.state && location?.state.loginType){ + setLoginType(location?.state.loginType) }else{ navigate('/login', {replace: true}) } diff --git a/src/components/AuthPages/SignUp/index.jsx b/src/components/AuthPages/SignUp/index.jsx index 9440752..d725cd5 100644 --- a/src/components/AuthPages/SignUp/index.jsx +++ b/src/components/AuthPages/SignUp/index.jsx @@ -6,12 +6,13 @@ import InputCom from "../../Helpers/Inputs/InputCom"; import AuthLayout from "../AuthLayout"; export default function SignUp() { + const location = useLocation() + // eslint-disable-next-line no-restricted-globals const queryParams = new URLSearchParams(location?.search); const country = queryParams.get("cnt")?.toUpperCase(); - const {pathname} = useLocation() - const currentPath = country ? `${pathname}?cnt=${country.toLowerCase()}`:pathname // Determines the new pathname is country query params exist + const currentPath = country ? `${location?.pathname}?cnt=${country.toLowerCase()}`:location?.pathname // Determines the new pathname is country query params exist const [signUpLoading, setSignUpLoading] = useState(false); const [checked, setValue] = useState(false); diff --git a/src/components/AuthPages/SignUp/index2.jsx b/src/components/AuthPages/SignUp/index2.jsx index 67717d9..0c408b2 100644 --- a/src/components/AuthPages/SignUp/index2.jsx +++ b/src/components/AuthPages/SignUp/index2.jsx @@ -9,14 +9,15 @@ import GoogleDownload from '../../../assets/images/download/andriod.jpg' import IOSDownload from '../../../assets/images/download/apple.jpg' export default function SignUp() { + const location = useLocation(); + // eslint-disable-next-line no-restricted-globals const queryParams = new URLSearchParams(location?.search); const country = queryParams.get("cnt")?.toUpperCase(); - const { pathname } = useLocation(); const currentPath = country - ? `${pathname}?cnt=${country.toLowerCase()}` - : pathname; // Determines the new pathname is country query params exist + ? `${location?.pathname}?cnt=${country.toLowerCase()}` + : location?.pathname; // Determines the new pathname is country query params exist const [signUpLoading, setSignUpLoading] = useState(false); const [checked, setValue] = useState(false); diff --git a/src/components/Blogs/index.jsx b/src/components/Blogs/index.jsx index 43acff3..05833e2 100644 --- a/src/components/Blogs/index.jsx +++ b/src/components/Blogs/index.jsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from "react"; import { useSelector } from "react-redux"; -import { useNavigate } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import usersService from "../../services/UsersService"; import CustomBreadcrumb from "../Breadcrumb/CustomBreadcrumb"; import Layout from "../Partials/Layout"; @@ -9,6 +9,8 @@ import CommonHead from "../UserHeader/CommonHead"; export default function BlogItem(props) { + const location = useLocation() + const { userDetails: { account_type }, } = useSelector((state) => state?.userDetails); // CHECKS IF USER Details account type diff --git a/src/components/FamilyAcc/FamilySettings/Tabs/RelativePopout.jsx b/src/components/FamilyAcc/FamilySettings/Tabs/RelativePopout.jsx index de17b6a..bf9ff84 100644 --- a/src/components/FamilyAcc/FamilySettings/Tabs/RelativePopout.jsx +++ b/src/components/FamilyAcc/FamilySettings/Tabs/RelativePopout.jsx @@ -105,7 +105,7 @@ const RelativePopout = ({ const isChecked = relativeSettings?.data?.filter(value => value?.family_uid == item?.family_uid) const image = localStorage.getItem("session_token") ? `${familyList?.imageServer}${localStorage.getItem("session_token")}/family/${item?.family_uid}` : ""; return ( -
+
{relativeEditKids.loading && relativeEditKids.family_uid == item.family_uid? @@ -122,7 +122,7 @@ const RelativePopout = ({
{`Avatar`} diff --git a/src/components/FamilyAcc/FamilyTableNew.jsx b/src/components/FamilyAcc/FamilyTableNew.jsx index 465ed50..390219a 100644 --- a/src/components/FamilyAcc/FamilyTableNew.jsx +++ b/src/components/FamilyAcc/FamilyTableNew.jsx @@ -18,7 +18,7 @@ export default function FamilyTableNew() { const { jobListTable, pendingListTable, parentFamilyTaskList } = useSelector((state) => state.tableReload); // TABLE RELOAD TRIGGERS - let { pathname } = useLocation(); + let location = useLocation(); const queryParams = new URLSearchParams(location?.search); const preSelectedTab = queryParams.get("tab"); diff --git a/src/components/FamilyAcc/Tabs/wallet/Wallet.jsx b/src/components/FamilyAcc/Tabs/wallet/Wallet.jsx index 298c1f7..f5be133 100644 --- a/src/components/FamilyAcc/Tabs/wallet/Wallet.jsx +++ b/src/components/FamilyAcc/Tabs/wallet/Wallet.jsx @@ -91,7 +91,7 @@ function Wallet({wallet, familyData, setFamilyWalletReload}) { action == 'ADD_VIRTUAL_CARD' ? openVirtualPopUp({wallet}) : - null + ()=>{} }} className={`w-[150px] h-[48px] rounded-full text-base text-white bg-[#4687ba] hover:bg-[#009ef7]`} > diff --git a/src/components/MyActiveJobs/ActiveJobsMedia.jsx b/src/components/MyActiveJobs/ActiveJobsMedia.jsx index a4b8196..b4f3c12 100644 --- a/src/components/MyActiveJobs/ActiveJobsMedia.jsx +++ b/src/components/MyActiveJobs/ActiveJobsMedia.jsx @@ -10,13 +10,14 @@ import ActiveJobMessageMedia from "./ActiveJobMessageMedia"; import IndexJobActions from "./JobActions/IndexJobActions"; import MediaLayout from "../Partials/MediaLayout"; -const VideoElement = lazy(() => import("../VideoCom/VideoElement")); - import usersService from "../../services/UsersService"; import { PriceFormatter } from "../Helpers/PriceFormatter"; import { SocketValues } from "../Contexts/SocketIOContext"; import TabButton from "../customTabs/TabButton"; +const VideoElement = lazy(() => import("../VideoCom/VideoElement")); + + function ActiveJobsMedia(props) { let {sendMessage, joinRoom} = SocketValues() // destructures 'SEND MESSAGE' and 'JOIN ROOM' FUNCTIONS FROM SOCKET diff --git a/src/components/MyWallet/WalletAction.jsx b/src/components/MyWallet/WalletAction.jsx index ede6a9e..5001c3c 100644 --- a/src/components/MyWallet/WalletAction.jsx +++ b/src/components/MyWallet/WalletAction.jsx @@ -52,7 +52,7 @@ function WalletAction({ walletItem, payment, openPopUp }) { : action == 'ADD_VIRTUAL_CARD' ? openVirtualPopUp({walletItem}) : - null + ()=>{} }} className={`${ walletItem?.code != "NAIRA" && "" diff --git a/src/components/OffersInterest/ManageInterestOffer.jsx b/src/components/OffersInterest/ManageInterestOffer.jsx index 1c29206..c385d43 100644 --- a/src/components/OffersInterest/ManageInterestOffer.jsx +++ b/src/components/OffersInterest/ManageInterestOffer.jsx @@ -399,7 +399,8 @@ export default function ManageInterestOffer(props) {

Wallet:

- { walletDetails?.loading ? 'loading...' : PriceFormatter(walletBal[0]?.amount * 0.01,props?.offerDetails?.currency_code,props?.offerDetails?.currency)} + {/* { walletDetails?.loading ? 'loading...' : PriceFormatter(walletBal[0]?.amount * 0.01,props?.offerDetails?.currency_code,props?.offerDetails?.currency)} */} + { walletBal.length > 0 ? PriceFormatter(walletBal[0]?.amount * 0.01,props?.offerDetails?.currency_code,props?.offerDetails?.currency) : 'loading...'}

Reward:

diff --git a/src/components/Partials/Default.jsx b/src/components/Partials/Default.jsx index b7730c1..bfd5223 100644 --- a/src/components/Partials/Default.jsx +++ b/src/components/Partials/Default.jsx @@ -1,8 +1,11 @@ import React, { useEffect, useState } from "react"; +import {useLocation} from 'react-router-dom' import DarkModeContext from "../Contexts/DarkModeContext"; import axios from 'axios' function Default({ children }) { + const location = useLocation() + // dark mode setup const [theme, setTheme] = useState(null); diff --git a/src/components/familyResources/FamGames.jsx b/src/components/familyResources/FamGames.jsx index 50e6209..3c78c1a 100644 --- a/src/components/familyResources/FamGames.jsx +++ b/src/components/familyResources/FamGames.jsx @@ -11,7 +11,7 @@ import { useReactToPrint } from 'react-to-print' const Iframe = lazy(() => import("../Iframe/Iframe")); -export default function FamGames() { +export default function FamGames(props) { const ApiCall = new usersService(); const navigate = useNavigate(); @@ -40,7 +40,7 @@ export default function FamGames() { // FUNCTION TO HANDLE POPOUT const popUpHandler = () => { - setPopUp((prev) => !prev); + // setPopUp((prev) => !prev); }; // FUNCTION TO HANDLE MESSAGE CHANGE @@ -136,7 +136,7 @@ export default function FamGames() { message: "Message Sent Successfully", }); // function to trigger socket to emit 'send_message' - sendMessage(messageToSend, `${props.details.contract}-${props.details.contract_uid}`) + // sendMessage(messageToSend, `${props.details.contract}-${props.details.contract_uid}`) props.reloadActiveJobList((prev) => !prev); // MAKES ACTIVE JOB MESSAGE LIST TO RELOAD setMessageToSend(""); // SENDS MESSAGE TO SEND BACK TO EMPTY STRINGS @@ -176,12 +176,12 @@ export default function FamGames() { const fileToBase64 = async () => { // Converts file data to base64 string - try { - const base64String = await convertFileToBase64(filesToSend[i]); - return base64String; - } catch (error) { - return false; - } + // try { + // const base64String = await convertFileToBase64(filesToSend[i]); + // return base64String; + // } catch (error) { + // return false; + // } }; // if(await !fileToBase64()){ diff --git a/src/components/infiniteScroll/InfiniteScroll.jsx b/src/components/infiniteScroll/InfiniteScroll.jsx index 60a7749..dacfead 100644 --- a/src/components/infiniteScroll/InfiniteScroll.jsx +++ b/src/components/infiniteScroll/InfiniteScroll.jsx @@ -2,7 +2,7 @@ import React, { useEffect, useState } from 'react' import LoadingSpinner from '../Spinners/LoadingSpinner' export default function InfiniteScroll({ - allData=data, + allData=[], addItemBy=12, intialItemsToShow=39, children diff --git a/src/views/MyTaskPage.jsx b/src/views/MyTaskPage.jsx index 29dbfdb..dba30ce 100644 --- a/src/views/MyTaskPage.jsx +++ b/src/views/MyTaskPage.jsx @@ -1,5 +1,6 @@ import React, { useState, useEffect } from "react"; import MyTasks from "../components/MyTasks"; +import {useLocation} from 'react-router-dom' // import UsersService from "../services/UsersService"; import usersService from "../services/UsersService"; @@ -7,6 +8,8 @@ import { useSelector } from "react-redux"; import RecentlyPastDue from "../components/MyTasks/RecentlyPastDue"; export default function MyTaskPage() { + const location = useLocation() + const api = new usersService(); const queryParams = new URLSearchParams(location?.search); const tab = queryParams.get("tab")?.toLowerCase();