import React, { useCallback, useEffect, useMemo, useState } from "react"; import { Link, useNavigate, } from "react-router-dom"; import { toast } from "react-toastify"; import localImgLoad from "../../lib/localImgLoad"; import Icons from "../Helpers/Icons"; import MarketPopUp from "../MarketPlace/PopUp/MarketPopUp"; import usersService from "../../services/UsersService"; export default function AvailableJobsCard({ className, datas, hidden = false, }) { //debugger; const [addFavorite, setValue] = useState(datas.whishlisted); const [marketPopUp, setMarketPopUp] = useState({ show: false, data: {} }); const [manageInt, setManageInt] = useState(null) const navigate = useNavigate(); const apiCall = useMemo(() => new usersService(), []); const favoriteHandler = () => { if (!addFavorite) { setValue(true); toast.success("Added to Favorite List"); } else { setValue(false); toast.warn("Remove to Favorite List"); } }; const marketInterestData = useCallback(async() => { let { offer_code } = datas; let reqData = { offer_code }; try { const manageInt = await apiCall.MarketInterest(reqData); const manageIntRes = await manageInt?.data; setManageInt(manageIntRes) } catch (error) { throw new Error(error) } }, []) useEffect(() => { if (!datas) { navigate("/market", { replace: true }); } marketInterestData() }, [marketInterestData, datas]) return ( <>

{datas.title}

Added

{datas.offer_added}

Expires

{datas.expire}

{datas.description}
{/*
*/} {/* {datas.isActive && (*/} {/* */} {/* Active*/} {/**/} {/* )}*/} {/*
*/} {/*
*/} {/* */} {/* */} {/* */} {/*
*/}

{datas.price * 0.01} {datas.currency} | {datas.timeline_days} day(s)

( {datas.offer_code})

{marketPopUp.show && ( { setMarketPopUp({ show: false, data: {} }); }} situation={marketPopUp.show} marketInt={manageInt} /> )} ); }