From e4569ca81f3b695a1767a156a86aa5ac4797030b Mon Sep 17 00:00:00 2001 From: Ebube Date: Mon, 12 Jun 2023 10:40:04 +0100 Subject: [PATCH 1/3] . --- .env.production | 7 +- src/components/Cards/HomeBannerOffersCard.jsx | 79 +++++++++++-------- src/components/Home/FullAccountDash.jsx | 60 +++++++------- src/components/Home/Hero.jsx | 73 ++++++++--------- src/components/Home/HomeSliders.jsx | 51 +++++------- src/components/Home/index.jsx | 79 ++++++++++--------- src/lib/localImgLoad.js | 11 ++- 7 files changed, 181 insertions(+), 179 deletions(-) diff --git a/.env.production b/.env.production index d30af61..d772c9f 100644 --- a/.env.production +++ b/.env.production @@ -9,8 +9,8 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com" # 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.lotus.g1.wrenchboard.com/svs/user" +REACT_APP_USERS_ENDPOINT="https://apigate.lotus.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" @@ -43,5 +43,4 @@ REACT_APP_GOOGLE_REDIRECT_URL=https://users.wrenchboard.com/login/auth/ DISABLE_ESLINT_PLUGIN=true REACT_APP_MAX_FILE_SIZE=1000000 -REACT_APP_TOTAL_NUM_FILE=4 - +REACT_APP_TOTAL_NUM_FILE=4 \ No newline at end of file diff --git a/src/components/Cards/HomeBannerOffersCard.jsx b/src/components/Cards/HomeBannerOffersCard.jsx index 02e58ef..bdcc248 100644 --- a/src/components/Cards/HomeBannerOffersCard.jsx +++ b/src/components/Cards/HomeBannerOffersCard.jsx @@ -1,42 +1,53 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import { Link } from "react-router-dom"; import localImgLoad from "../../lib/localImgLoad"; +import bannerImage from "../../assets/images/banner-coupons.jpg"; export default function HomeBannerOffersCard(props) { - console.log("HomeBannerOffersCard-> ##->",props) - const link_result = "/" + props.itemData.link_path; - var imgUrl = props.itemData.banner; // ? this.state.nextImgSrc : this.state.song.imgSrc; - console.log("IMAGE FOR BANNER->",imgUrl); - var divStyle = { - backgroundImage: 'url(' + imgUrl + ')' - } - var linkDivStyle = "item w-full block group banner-630-340 " + divStyle; + const [imageUrl, setImageUrl] = useState(""); + console.log("HomeBannerOffersCard-> ##->", props); + const link_result = "/" + props.itemData.link_path; + var imgUrl = props.itemData.banner; // ? this.state.nextImgSrc : this.state.song.imgSrc; + console.log("IMAGE FOR BANNER->", imgUrl); + useEffect(() => { + let { banner, banner_location } = props?.itemData; + if (banner_location === "LOCAL") { + const imagePath = require(`../../assets/images/${banner}`); // Replace with your directory path for local images + console.log("This is local"); + setImageUrl(imagePath); + } else if (banner_location === "URL") setImageUrl(banner); + else return null; + }, []); - return ( - -
-
-
-

- <>{props.itemData.title} -

-
- {/**/} -
-
-
- {props.itemData.description} -
-
- [ {props.itemData.button_text} ] -
-
+ var linkDivStyle = `item w-full block group banner-630-340`; -
- - ); + return ( + +
+
+
+

+ <>{props.itemData.title} +

+
+ {/**/} +
+
+
+ {props.itemData.description} +
+
+ [ {props.itemData.button_text} ] +
+
+
+ + ); } diff --git a/src/components/Home/FullAccountDash.jsx b/src/components/Home/FullAccountDash.jsx index 5e44e3c..feff276 100644 --- a/src/components/Home/FullAccountDash.jsx +++ b/src/components/Home/FullAccountDash.jsx @@ -10,37 +10,37 @@ import { useSelector } from "react-redux"; import HomeActivities from "./HomeActivities"; export default function FullAccountDash(props) { + console.log("PROPS IN HOME->", props); - console.log("PROPS IN HOME->",props); + const trending = datas.datas; + const jobData = datas.datas; // api calls or cache - const trending = datas.datas; - const jobData = datas.datas; // api calls or cache - - const userApi = new usersService(); + const userApi = new usersService(); - const {userDetails} = useSelector((state) => state?.userDetails) + const { userDetails } = useSelector((state) => state?.userDetails); - return ( -
-
- - - {/**/} - {/**/} - {/**/} + return ( +
+
+ + + {/**/} + {/**/} + {/**/} - {/**/} -
-
- ); + {/**/} +
+
+ ); } // /* // @@ -53,10 +53,10 @@ export default function FullAccountDash(props) { // className="mb-10" // bannerList={props.bannerList} // /> -{/* +{ + /* - */} + */ +} // // - - diff --git a/src/components/Home/Hero.jsx b/src/components/Home/Hero.jsx index 9df9dfa..6e8e0f7 100644 --- a/src/components/Home/Hero.jsx +++ b/src/components/Home/Hero.jsx @@ -19,10 +19,10 @@ export default function Hero({ className, bannerList, nextDueTask }) { infinite: true, swipe: true, }; - const sildeData =null; + const sildeData = null; const [addFavorite, setValue] = useState(false); - const {userDetails} = useSelector((state) => state?.userDetails) + const { userDetails } = useSelector((state) => state?.userDetails); const favoriteHandler = () => { if (!addFavorite) { setValue(true); @@ -33,9 +33,9 @@ export default function Hero({ className, bannerList, nextDueTask }) { } }; - let loginDate = userDetails?.last_login.split(' ')[0] - let {firstname, lastname, email, profile_pic} = userDetails - let userEmail = email.split('@')[0] + let loginDate = userDetails?.last_login.split(" ")[0]; + let { firstname, lastname, email, profile_pic } = userDetails; + let userEmail = email.split("@")[0]; return (
- Last Login : {loginDate} + Last Login : {loginDate}
{/* user */}
- +

@@ -71,38 +71,35 @@ export default function Hero({ className, bannerList, nextDueTask }) {

{/* countdown */} - { nextDueTask?.next_due && Object.keys(nextDueTask.next_due)?.length && - ( -
-
-

Current Task

-

- {nextDueTask.next_due.item_code} -

-

{nextDueTask.next_due.price} Naira

-
-
-
-

Next due in

-

- {/* */} - -

-
- Hrs - Min - Sec -
+ {nextDueTask?.next_due && Object.keys(nextDueTask.next_due)?.length && ( +
+
+

Current Task

+

+ {nextDueTask.next_due.item_code} +

+

+ {nextDueTask.next_due.price} Naira +

+
+
+
+

Next due in

+

+ {/* */} + +

+
+ Hrs + Min + Sec
- ) - } +
+ )} {/* action */}
- + {" "} View All Task(s) @@ -111,9 +108,9 @@ export default function Hero({ className, bannerList, nextDueTask }) {
); diff --git a/src/components/Home/HomeSliders.jsx b/src/components/Home/HomeSliders.jsx index ee31333..318703a 100644 --- a/src/components/Home/HomeSliders.jsx +++ b/src/components/Home/HomeSliders.jsx @@ -1,37 +1,26 @@ 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) { - console.log("BANNER LIST IN HomeSliders->",props.bannerList); - // debugger; - return ( - <> -
-
- - {/*
*/} - {/* slider*/} - {/*
*/} -
- slider -
- {/*
*/} - {/* slider*/} - {/*
*/} - {props.bannerList?.length && props.bannerList.map((item, index) => ( -
- -
- ))} -
+ console.log("BANNER LIST IN HomeSliders->", props.bannerList); + // debugger; + return ( + <> +
+
+ + {props.bannerList?.length && + props.bannerList.map((item, index) => ( +
+
-
- - ); + ))} + +
+
+ + ); } diff --git a/src/components/Home/index.jsx b/src/components/Home/index.jsx index 49ad10b..f3e148d 100644 --- a/src/components/Home/index.jsx +++ b/src/components/Home/index.jsx @@ -6,48 +6,51 @@ import { useSelector } from "react-redux"; import FamilyDash from "./FamilyDash"; import FullAccountDash from "./FullAccountDash"; - export default function Home(props) { + console.log("PROPS IN HOME->", props); - console.log("PROPS IN HOME->",props); + let [nextDueTask, setNextDueTask] = useState({}); - let [nextDueTask, setNextDueTask] = useState({}) + const userApi = new usersService(); - const userApi = new usersService(); + const { userDetails } = useSelector((state) => state?.userDetails); - const {userDetails} = useSelector((state) => state?.userDetails) + const { commonHeadBanner } = useSelector((state) => state.commonHeadBanner); - const {commonHeadBanner} = useSelector(state => state.commonHeadBanner) + // FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME + const getHomeDate = () => { + userApi + .getHomeDate() + .then((res) => { + if (res.status != 200 || res.internal_return < 0) { + return; + } + setNextDueTask(res.data); + }) + .catch((error) => { + console.log(error); + }); + }; - // FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME - const getHomeDate = () => { - userApi.getHomeDate().then(res => { - if(res.status != 200 || res.internal_return < 0){ - return - } - setNextDueTask(res.data) - }).catch(error => { - console.log(error) - }) - } + useEffect(() => { + getHomeDate(); + }, []); - useEffect(()=>{ - getHomeDate() - },[]) - - return ( - -
- {userDetails && userDetails?.account_type == "FAMILY" && ( - - )} - {userDetails && userDetails?.account_type == "FULL" && ( - - - )} -
-
- ); + return ( + +
+ {userDetails && userDetails?.account_type == "FAMILY" && ( + + )} + {userDetails && userDetails?.account_type == "FULL" && ( + + )} +
+
+ ); } // /* // @@ -60,10 +63,10 @@ export default function Home(props) { // className="mb-10" // bannerList={props.bannerList} // /> -{/* +{ + /* - */} + */ +} //
// - - diff --git a/src/lib/localImgLoad.js b/src/lib/localImgLoad.js index e0aa6af..beac126 100644 --- a/src/lib/localImgLoad.js +++ b/src/lib/localImgLoad.js @@ -1,4 +1,7 @@ -export default function localImgLoad(location) { - const img = require(`../assets/${location}`); - return img; -} +// export default function localImgLoad(location) { +// const img = require(`../assets/${location}`); +// return img; +// } + +// const localImgLoad = (location) => require(`../assets/${location}`); +// export default localImgLoad \ No newline at end of file From 4204b94231daa96c1c157b511d4f207dcb9a82d9 Mon Sep 17 00:00:00 2001 From: Ebube Date: Mon, 12 Jun 2023 10:55:20 +0100 Subject: [PATCH 2/3] corrected bg size and position --- src/components/Cards/HomeBannerOffersCard.jsx | 4 +--- src/components/Home/HomeSliders.jsx | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/Cards/HomeBannerOffersCard.jsx b/src/components/Cards/HomeBannerOffersCard.jsx index bdcc248..f5fd0ed 100644 --- a/src/components/Cards/HomeBannerOffersCard.jsx +++ b/src/components/Cards/HomeBannerOffersCard.jsx @@ -20,12 +20,10 @@ export default function HomeBannerOffersCard(props) { else return null; }, []); - var linkDivStyle = `item w-full block group banner-630-340`; - return ( (
From 8749bf9f554df7d2e3fa534eef311e43af8f48ac Mon Sep 17 00:00:00 2001 From: Ebube Date: Mon, 12 Jun 2023 11:41:25 +0100 Subject: [PATCH 3/3] . --- .env.production | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.env.production b/.env.production index d772c9f..88d656b 100644 --- a/.env.production +++ b/.env.production @@ -9,8 +9,8 @@ REACT_APP_APPSITE="https://myfitapp.mermsemr.com" # 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.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"