From 99d9a468f622571b44c49acd07b810c6426e6770 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 25 Sep 2024 20:40:37 +0100 Subject: [PATCH] clean up on unused APIs --- .../Dashboards/AccountDashboard.jsx | 4 +- src/components/Home/FullAccountDash.jsx | 19 ++-- src/components/Home/index.jsx | 36 ++++---- src/components/jobPopout/OfferJobPopout.jsx | 86 +++++++++++-------- src/middleware/AuthRoute.jsx | 42 ++++----- 5 files changed, 101 insertions(+), 86 deletions(-) diff --git a/src/components/Dashboards/AccountDashboard.jsx b/src/components/Dashboards/AccountDashboard.jsx index 5562580..1c8fca9 100644 --- a/src/components/Dashboards/AccountDashboard.jsx +++ b/src/components/Dashboards/AccountDashboard.jsx @@ -179,11 +179,11 @@ const NewOfferCard = ({ datas, hidden = false, price, setOfferPopout, image }) = diff --git a/src/components/Home/FullAccountDash.jsx b/src/components/Home/FullAccountDash.jsx index 70eca7d..63f7e0a 100644 --- a/src/components/Home/FullAccountDash.jsx +++ b/src/components/Home/FullAccountDash.jsx @@ -61,15 +61,14 @@ export default function FullAccountDash(props) { )} - { - // props?.dashTypes !== "undefined" && - // props.offersList?.data?.result_list?.length ? ( - // - // ) - // : + {/* {props?.dashTypes !== "undefined" && + props.offersList?.data?.result_list?.length ? ( + + ) + : props.MyActiveJobList?.data?.length ? ( <>
@@ -83,7 +82,7 @@ export default function FullAccountDash(props) { imageServer={props.offersList?.data?.session_image_server} /> - ) : null} + ) : null} */}
); diff --git a/src/components/Home/index.jsx b/src/components/Home/index.jsx index f42b1e4..6da0d81 100644 --- a/src/components/Home/index.jsx +++ b/src/components/Home/index.jsx @@ -14,19 +14,19 @@ export default function Home(props) { const { userDetails } = useSelector((state) => state?.userDetails); - const [MyActiveJobList, setMyActiveJobList] = useState({loading:true, data:[]}); // STATE TO HOLD ACTIVE/CURRENT TASKS + // const [MyActiveJobList, setMyActiveJobList] = useState({loading:true, data:[]}); // STATE TO HOLD ACTIVE/CURRENT TASKS - const getMyActiveJobList = async () => { // FUNCTION TO POPULATE ACTIVE/CURRENT TASK LIST - try { - const res = await userApi.getMyActiveTaskList(); - setMyActiveJobList({loading:false, data:res?.data?.result_list}); - // setMyActiveJobList(res?.data?.result_list); - } catch (error) { - setMyActiveJobList({loading:false, data:[]}); - // setMyActiveJobList([]); - console.log("Error getting tasks"); - } - }; + // const getMyActiveJobList = async () => { // FUNCTION TO POPULATE ACTIVE/CURRENT TASK LIST + // try { + // const res = await userApi.getMyActiveTaskList(); + // setMyActiveJobList({loading:false, data:res?.data?.result_list}); + // // setMyActiveJobList(res?.data?.result_list); + // } catch (error) { + // setMyActiveJobList({loading:false, data:[]}); + // // setMyActiveJobList([]); + // console.log("Error getting tasks"); + // } + // }; // FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME // const getHomeDate = () => { @@ -53,11 +53,11 @@ export default function Home(props) { // } // }; - useEffect(() => { - if(userDetails?.account_type == 'FULL'){ - getMyActiveJobList(); - } - }, []); + // useEffect(() => { + // if(userDetails?.account_type == 'FULL'){ + // getMyActiveJobList(); + // } + // }, []); return ( @@ -78,7 +78,7 @@ export default function Home(props) { bannerList={props.bannerList} dashTypes={props.dashTypes} // offersList={MyOffersList} - MyActiveJobList={MyActiveJobList} + // MyActiveJobList={MyActiveJobList} offersList={props.offersList} imageServer={props.imageServer} /> diff --git a/src/components/jobPopout/OfferJobPopout.jsx b/src/components/jobPopout/OfferJobPopout.jsx index d881ff4..5943d42 100644 --- a/src/components/jobPopout/OfferJobPopout.jsx +++ b/src/components/jobPopout/OfferJobPopout.jsx @@ -8,6 +8,7 @@ import LoadingSpinner from "../Spinners/LoadingSpinner"; import { tableReload } from "../../store/TableReloads"; import { useDispatch } from "react-redux"; +import { PriceFormatter } from "../Helpers/PriceFormatter"; function OfferJobPopout({ details, onClose, situation }) { const apiUrl = new usersService(); @@ -21,6 +22,12 @@ function OfferJobPopout({ details, onClose, situation }) { trigger: "", }); + let thePrice = PriceFormatter( + details?.price * 0.01, + details?.currency_code, + details?.currency + ); + //FUNCTION TO HANDLE AN OFFER const handleOffer = ({ target: { name } }) => { const reqData = { @@ -135,54 +142,60 @@ function OfferJobPopout({ details, onClose, situation }) {
-

- {details.title} -

{/* INPUT SECTION */} -
- +
+
+ +
+ +
+ +
+
+
+ +
+ +
+ +
+
+ +

+ {details.title} +

+
-
- -
+
- -
- -
- -
- -
- + +

{details.job_description || details.job_detail}

{/* ACTION SECTION */}
-
+
+

I understand the task

{requestStatus.loading && requestStatus.trigger == "offer" ? ( ) : ( @@ -190,9 +203,9 @@ function OfferJobPopout({ details, onClose, situation }) { name="accept" onClick={handleOffer} disabled={requestStatus.loading} - className="px-2 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white" + className="px-2 h-28 flex justify-center items-center btn-gradient text-2xl rounded-xl text-white" > - Accept Offer + Start Now )}
@@ -205,9 +218,10 @@ function OfferJobPopout({ details, onClose, situation }) { name="reject" onClick={handleOffer} disabled={requestStatus.loading} - className="px-2 h-11 flex justify-center items-center btn-gradient text-base rounded-full text-white" + className="group relative px-2 h-11 flex justify-center items-center text-base text-black dark:text-white" > Reject Offer +
)}
diff --git a/src/middleware/AuthRoute.jsx b/src/middleware/AuthRoute.jsx index 86b409d..241535c 100644 --- a/src/middleware/AuthRoute.jsx +++ b/src/middleware/AuthRoute.jsx @@ -111,8 +111,8 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { } }, []); - useEffect(() => { - const getNotifications = () => { + useEffect(() => { // FUNCTION TO GET NOTIFICATIONS LIST + const notifications = () => { // function to load user notification dispatch(updateNotifications({ loading: true })); apiCall @@ -168,7 +168,9 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { dispatch(updateNotifications({ loading: false, data: null })); }); }; - getNotifications(); + // delay verify requests by 10000ms + const delay15secs = setTimeout(notifications, 15000) + return ()=> clearTimeout(delay15secs) }, []); useEffect(() => { @@ -248,23 +250,23 @@ const AuthRoute = ({ redirectPath = "/login", children }) => { }, [isLogin.status]); //FUNCTION TO GET COMMON HEAD DATA - useEffect(() => { - if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY - return - } - apiCall - .getRecentActivitiedData() - .then((res) => { - // debugger; - if (res?.data?.internal_return < 0) { - return; - } - dispatch(recentActivitiesData(res.data)); - }) - .catch((error) => { - console.log("ERROR ", error); - }); - }, [isLogin.status]); + // useEffect(() => { + // if((!loggedIn && !isLogin.status) || account_type == 'FAMILY'){ // DO NOT CALL THIS, IF USER ACCOUNT TYPE IS FAMILY + // return + // } + // apiCall + // .getRecentActivitiedData() + // .then((res) => { + // // debugger; + // if (res?.data?.internal_return < 0) { + // return; + // } + // dispatch(recentActivitiesData(res.data)); + // }) + // .catch((error) => { + // console.log("ERROR ", error); + // }); + // }, [isLogin.status]); //FUNCTION TO GET FAMILY BANNERS -- 2.34.1