Compare commits

...

15 Commits

10 changed files with 173 additions and 225 deletions
-1
View File
@@ -44,4 +44,3 @@ DISABLE_ESLINT_PLUGIN=true
REACT_APP_MAX_FILE_SIZE=1000000 REACT_APP_MAX_FILE_SIZE=1000000
REACT_APP_TOTAL_NUM_FILE=4 REACT_APP_TOTAL_NUM_FILE=4
+16 -10
View File
@@ -1,22 +1,29 @@
import React from "react"; import React, { useEffect, useState } from "react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import localImgLoad from "../../lib/localImgLoad"; import localImgLoad from "../../lib/localImgLoad";
import bannerImage from "../../assets/images/banner-coupons.jpg";
export default function HomeBannerOffersCard(props) { export default function HomeBannerOffersCard(props) {
console.log("HomeBannerOffersCard-> ##->",props) const [imageUrl, setImageUrl] = useState("");
const link_result = "/" + props.itemData.link_path; 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;
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 ( return (
<Link <Link
to={link_result} to={link_result}
className={linkDivStyle} className="item w-full block group banner-630-340 bg-cover bg-center"
style={{
backgroundImage: `url('${imageUrl}')`,
}}
> >
<div className="flex flex-col justify-between h-full"> <div className="flex flex-col justify-between h-full">
<div className="content flex justify-between items-center mb-5"> <div className="content flex justify-between items-center mb-5">
@@ -35,7 +42,6 @@ export default function HomeBannerOffersCard(props) {
[ {props.itemData.button_text} ] [ {props.itemData.button_text} ]
</div> </div>
</div> </div>
</div> </div>
</Link> </Link>
); );
+7 -7
View File
@@ -10,7 +10,6 @@ import { useSelector } from "react-redux";
import HomeActivities from "./HomeActivities"; import HomeActivities from "./HomeActivities";
export default function FullAccountDash(props) { export default function FullAccountDash(props) {
console.log("PROPS IN HOME->", props); console.log("PROPS IN HOME->", props);
const trending = datas.datas; const trending = datas.datas;
@@ -18,12 +17,13 @@ export default function FullAccountDash(props) {
const userApi = new usersService(); const userApi = new usersService();
const {userDetails} = useSelector((state) => state?.userDetails) const { userDetails } = useSelector((state) => state?.userDetails);
return ( return (
<div> <div>
<div className="home-page-wrapper"> <div className="home-page-wrapper">
<Hero className="mb-10" <Hero
className="mb-10"
data={userDetails} data={userDetails}
bannerList={props.bannerList} bannerList={props.bannerList}
nextDueTask={props.nextDueTask} nextDueTask={props.nextDueTask}
@@ -53,10 +53,10 @@ export default function FullAccountDash(props) {
// className="mb-10" // className="mb-10"
// bannerList={props.bannerList} // bannerList={props.bannerList}
// /> // />
{/* <SellHistoryMarketVisitorAnalytic className="mb-10"/> {
/* <SellHistoryMarketVisitorAnalytic className="mb-10"/>
<TopSellerTopBuyerSliderSection className="mb-10" /> <TopSellerTopBuyerSliderSection className="mb-10" />
<UpdateTable className="mb-10"/>*/} <UpdateTable className="mb-10"/>*/
}
// </div> // </div>
// </Layout> // </Layout>
+11 -14
View File
@@ -22,7 +22,7 @@ export default function Hero({ className, bannerList, nextDueTask }) {
const sildeData = null; const sildeData = null;
const [addFavorite, setValue] = useState(false); const [addFavorite, setValue] = useState(false);
const {userDetails} = useSelector((state) => state?.userDetails) const { userDetails } = useSelector((state) => state?.userDetails);
const favoriteHandler = () => { const favoriteHandler = () => {
if (!addFavorite) { if (!addFavorite) {
setValue(true); setValue(true);
@@ -33,9 +33,9 @@ export default function Hero({ className, bannerList, nextDueTask }) {
} }
}; };
let loginDate = userDetails?.last_login.split(' ')[0] let loginDate = userDetails?.last_login.split(" ")[0];
let {firstname, lastname, email, profile_pic} = userDetails let { firstname, lastname, email, profile_pic } = userDetails;
let userEmail = email.split('@')[0] let userEmail = email.split("@")[0];
return ( return (
<div <div
@@ -61,7 +61,7 @@ export default function Hero({ className, bannerList, nextDueTask }) {
{/* user */} {/* user */}
<div className="flex items-center space-x-3"> <div className="flex items-center space-x-3">
<div className="w-14 h-14 flex justify-center items-center rounded-full overflow-hidden"> <div className="w-14 h-14 flex justify-center items-center rounded-full overflow-hidden">
<img src={profile_pic != '' ? profile_pic : heroUser} alt="" /> <img src={profile_pic != "" ? profile_pic : heroUser} alt="" />
</div> </div>
<div> <div>
<p className="text-xl tracking-wide font-bold antise text-white"> <p className="text-xl tracking-wide font-bold antise text-white">
@@ -71,15 +71,16 @@ export default function Hero({ className, bannerList, nextDueTask }) {
</div> </div>
</div> </div>
{/* countdown */} {/* countdown */}
{ nextDueTask?.next_due && Object.keys(nextDueTask.next_due)?.length && {nextDueTask?.next_due && Object.keys(nextDueTask.next_due)?.length && (
(
<div className="w-full h-32 flex justify-evenly items-center sm:p-6 p-1 rounded-2xl border border-white-opacity"> <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"> <div className="flex flex-col justify-between">
<p className="text-base text-white tracking-wide">Current Task</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"> <p className="lg:text-2xl text-lg font-bold tracking-wide text-white">
{nextDueTask.next_due.item_code} {nextDueTask.next_due.item_code}
</p> </p>
<p className="text-base text-white tracking-wide">{nextDueTask.next_due.price} Naira</p> <p className="text-base text-white tracking-wide">
{nextDueTask.next_due.price} Naira
</p>
</div> </div>
<div className="w-[1px] h-full bg-white-opacity"></div> <div className="w-[1px] h-full bg-white-opacity"></div>
<div className="flex flex-col justify-between"> <div className="flex flex-col justify-between">
@@ -95,14 +96,10 @@ export default function Hero({ className, bannerList, nextDueTask }) {
</div> </div>
</div> </div>
</div> </div>
) )}
}
{/* action */} {/* action */}
<div className="flex lg:space-x-3 space-x-1 items-center"> <div className="flex lg:space-x-3 space-x-1 items-center">
<Link <Link to="/mytask" className="text-white text-base sm:block hidden">
to="/mytask"
className="text-white text-base sm:block hidden"
>
<span className=" border-b dark:border-[#5356fb29] border-white"> <span className=" border-b dark:border-[#5356fb29] border-white">
{" "} {" "}
View All Task(s) View All Task(s)
+7 -18
View File
@@ -1,10 +1,6 @@
import SliderCom from "../Helpers/SliderCom"; 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"; import HomeBannerOffersCard from "../Cards/HomeBannerOffersCard";
export default function HomeSliders(props) { export default function HomeSliders(props) {
console.log("BANNER LIST IN HomeSliders->", props.bannerList); console.log("BANNER LIST IN HomeSliders->", props.bannerList);
// debugger; // debugger;
@@ -13,20 +9,13 @@ export default function HomeSliders(props) {
<div className="hero-slider relative 2xl:w-[600px] xl:w-[500px] lg:w-[420px] w-full mb-2 lg:mb-0 "> <div className="hero-slider relative 2xl:w-[600px] xl:w-[500px] lg:w-[420px] w-full mb-2 lg:mb-0 ">
<div className="w-full"> <div className="w-full">
<SliderCom settings={props.settings}> <SliderCom settings={props.settings}>
{/*<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">*/} {props.bannerList?.length &&
{/* <img src={slider1} alt="slider" className="w-full h-full" />*/} props.bannerList.map((item, index) => (
{/*</div>*/} <div
<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden"> key={index}
<img src={slider2} alt="slider" className="w-full h-full" /> className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden"
</div> >
{/*<div className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">*/} <HomeBannerOffersCard itemData={item} />
{/* <img src={slider3} alt="slider" className="w-full h-full" />*/}
{/*</div>*/}
{props.bannerList?.length && props.bannerList.map((item, index) => (
<div key={index} className="item w-full h-full bg-white dark:bg-dark-white rounded-2xl overflow-hidden">
<HomeBannerOffersCard
itemData={item}
/>
</div> </div>
))} ))}
</SliderCom> </SliderCom>
+22 -19
View File
@@ -6,34 +6,35 @@ import { useSelector } from "react-redux";
import FamilyDash from "./FamilyDash"; import FamilyDash from "./FamilyDash";
import FullAccountDash from "./FullAccountDash"; import FullAccountDash from "./FullAccountDash";
export default function Home(props) { 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 // FUNCTION TO GET DASH DATA TO DETERMINE CURRENT TASK DUE TIME
const getHomeDate = () => { const getHomeDate = () => {
userApi.getHomeDate().then(res => { userApi
.getHomeDate()
.then((res) => {
if (res.status != 200 || res.internal_return < 0) { if (res.status != 200 || res.internal_return < 0) {
return return;
} }
setNextDueTask(res.data) setNextDueTask(res.data);
}).catch(error => {
console.log(error)
}) })
} .catch((error) => {
console.log(error);
});
};
useEffect(() => { useEffect(() => {
getHomeDate() getHomeDate();
},[]) }, []);
return ( return (
<Layout> <Layout>
@@ -42,8 +43,10 @@ export default function Home(props) {
<FamilyDash commonHeadData={props.bannerList} /> <FamilyDash commonHeadData={props.bannerList} />
)} )}
{userDetails && userDetails?.account_type == "FULL" && ( {userDetails && userDetails?.account_type == "FULL" && (
<FullAccountDash nextDueTask={nextDueTask} bannerList={props.bannerList} /> <FullAccountDash
nextDueTask={nextDueTask}
bannerList={props.bannerList}
/>
)} )}
</div> </div>
</Layout> </Layout>
@@ -60,10 +63,10 @@ export default function Home(props) {
// className="mb-10" // className="mb-10"
// bannerList={props.bannerList} // bannerList={props.bannerList}
// /> // />
{/* <SellHistoryMarketVisitorAnalytic className="mb-10"/> {
/* <SellHistoryMarketVisitorAnalytic className="mb-10"/>
<TopSellerTopBuyerSliderSection className="mb-10" /> <TopSellerTopBuyerSliderSection className="mb-10" />
<UpdateTable className="mb-10"/>*/} <UpdateTable className="mb-10"/>*/
}
// </div> // </div>
// </Layout> // </Layout>
@@ -245,7 +245,7 @@ const MarketPopUp = ({ details, onClose, situation, marketInt }) => {
<div className=""> <div className="">
<p className="flex items-center tracking-wide"> <p className="flex items-center tracking-wide">
Interest: <b className="ml-1">{marketInt?.public_view}</b> Interest: <b className="ml-1">{details.interest_count}</b>
</p> </p>
<hr /> <hr />
<p className="my-1">Expire: {expireIntDate}</p> <p className="my-1">Expire: {expireIntDate}</p>
+1 -45
View File
@@ -20,9 +20,6 @@ function Wallet() {
} }
const WalletRoutes = () => { const WalletRoutes = () => {
const apiCall = new usersService() const apiCall = new usersService()
@@ -38,18 +35,6 @@ const WalletRoutes = () => {
error: false 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 //FUNCTION TO GET WALLET LIST
const getWalletList = ()=>{ const getWalletList = ()=>{
apiCall.getUserWallets(null).then((res)=>{ apiCall.getUserWallets(null).then((res)=>{
@@ -76,38 +61,9 @@ const WalletRoutes = () => {
}) })
} }
//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(()=>{ useEffect(()=>{
getWalletList() getWalletList()
getPaymentHistory() getPaymentHistory()
getPurchaseHistory()
getCouponHistory()
}, []) }, [])
return ( return (
<Routes> <Routes>
@@ -115,7 +71,7 @@ const WalletRoutes = () => {
<Route path='add-fund' element={<AddFund payment={paymentHistory} />} /> <Route path='add-fund' element={<AddFund payment={paymentHistory} />} />
<Route path='add-fund/confirm-add-fund' element={<ConfirmAddFund payment={paymentHistory} />} /> <Route path='add-fund/confirm-add-fund' element={<ConfirmAddFund payment={paymentHistory} />} />
<Route path='transfer-fund' element={<TransferFund payment={paymentHistory} wallet={walletList} />} /> <Route path='transfer-fund' element={<TransferFund payment={paymentHistory} wallet={walletList} />} />
<Route index element={<Balance coupon={couponHistory} wallet={walletList} />} /> <Route index element={<Balance wallet={walletList} />} />
<Route path='transfer-fund/add-recipient' element={<AddRecipient />} /> <Route path='transfer-fund/add-recipient' element={<AddRecipient />} />
<Route path='transfer-fund/confirm-transfer' element={<ConfirmTransfer payment={paymentHistory} wallet={walletList} />} /> <Route path='transfer-fund/confirm-transfer' element={<ConfirmTransfer payment={paymentHistory} wallet={walletList} />} />
<Route path='*' element={<Navigate to='/' />} /> <Route path='*' element={<Navigate to='/' />} />
@@ -102,7 +102,7 @@ export default function RecomendedSliders({ className,bannerData }) {
{bannerData.map((item, index) => ( {bannerData.map((item, index) => (
<Link key={index} to={`/${item.link_path}`}> <Link key={index} to={`/${item.link_path}`}>
<div className="item"> <div className="item">
<div className={`commonHeaderSliderItem ${item.short_style}`}> <div className={`commonHeaderSliderItem flex flex-col justify-between items-center ${item.short_style}`}>
{/* title */} {/* title */}
<div className="flex justify-center"> <div className="flex justify-center">
<p className="text-base font-bold text-dark-gray dark:text-white"> <p className="text-base font-bold text-dark-gray dark:text-white">
+2 -4
View File
@@ -1,4 +1,2 @@
export default function localImgLoad(location) { const localImgLoad = (location) => require(`../assets/${location}`);
const img = require(`../assets/${location}`); export default localImgLoad
return img;
}