import React, { Suspense, lazy, useState } from "react"; import { Link } from "react-router-dom"; import VideoElement from '../../components/VideoCom/VideoElement' import OfferJobPopout from '../../components/jobPopout/OfferJobPopout' import { PriceFormatter } from "../Helpers/PriceFormatter"; import CountDown from '../Helpers/CountDown' const AccountDashboard = ({ className, bannerList, offersList, imageServer }) => { let [offerPopout, setOfferPopout] = useState({ show: false, data: {} }); // STATE TO HOLD THE VALUE OF THE ALERT DETAILS AND DETERMINE WHEN TO SHOW let offersListLength = offersList?.length > 2 ? 2 : offersList?.length // getting the upper three banners for the home layout const getUpperBanner = bannerList?.filter((value, idx) => idx <= 2 - offersListLength); const getLowerBanner = bannerList?.filter((value, idx) => !getUpperBanner?.map(item => item?.title)?.includes(value.title)); let getImage = ({ banner_location, banner }) => { if (banner_location == "LOCAL") { return require(`../../assets/images/${banner}`); } else { return banner; } }; return ( <>
{/* for normal banner section */}
{/* OFFER LIST DISPLAY */} <> {(offersList && offersList?.length > 0) && offersList.map((item, index) => { let thePrice = PriceFormatter( item?.price * 0.01, item?.currency_code, item?.currency ); let image = `${imageServer}${localStorage.getItem("session_token")}/job/${item.job_uid}` if(index < offersListLength){ return (
) } })} {getUpperBanner?.map((props, idx) => { let image = getImage(props); let { short_title, short_description, short_button_text, link_path, card_type, blog_id } = props; return (
); })}
{/* for flat banner section */}
{/* OFFER LIST DISPLAY */} {getLowerBanner?.map((props, idx) => { let image = getImage(props); let { short_title, short_description, short_button_text, link_path, card_type, blog_id } = props; return (
); })}
{/* Offer Job Popout */} {offerPopout.show && ( { setOfferPopout({ show: false, data: {} }); }} situation={offerPopout.show} /> )} {/* End of Offer Job Popout */} ); }; export default AccountDashboard; const TopBanner = ({ image, title = "", desc = "", btn, link_path, key }) => { return (
banner-img
{title} {desc}
{btn}
); }; const NewOfferCard = ({ datas, hidden = false, price, setOfferPopout, image }) => { return (
{/* thumbnail image/video */} {datas.job_type == "MEDIA" ? Loading...

}>
:
{/* */}
{hidden &&
}
}

{datas?.title}

Expires

); }; const NewOfferCardFlat = ({ datas, hidden = false, price, setOfferPopout, image }) => { return (

{datas?.title}

{datas.job_type == "MEDIA" ? Loading...

}>
:
{hidden &&
}
}

Expires

); }; const LowerBanner = ({ image, title = "", desc = "", btn, link_path, card_type, blog_id, key }) => { const newLinkPath = card_type == 'BLOG' ? `${link_path}?blog_id=${blog_id}` : link_path return (
{title}

{desc}

banner-img
{btn}
); }; const BannerSection = ({ banners, variant }) => { const getImage = ({ banner_location, banner }) => { return banner_location === "LOCAL" ? require(`../../assets/images/${banner}`) : banner; }; return ( <> {banners?.map((props, idx) => { const { short_title, short_description, short_button_text, link_path } = props; const image = getImage(props); return (
banner-img
{short_title} {short_description}
{short_button_text}
); })} ); };