diff --git a/src/components/Cards/FamilyMarketCard.jsx b/src/components/Cards/FamilyMarketCard.jsx index bb76019..fd9ee3c 100644 --- a/src/components/Cards/FamilyMarketCard.jsx +++ b/src/components/Cards/FamilyMarketCard.jsx @@ -1,72 +1,75 @@ import React, { useState } from "react"; import { Link } from "react-router-dom"; import { toast } from "react-toastify"; -import localImgLoad from "../../lib/localImgLoad"; +import getTimeAgo from "../../lib/getTimeAgo"; import Icons from "../Helpers/Icons"; +import SuggestTask from "../FamilyPopup/SuggestTask"; -export default function FamilyMarketCard({ - className, - datas, - hidden = false, -}) { +export default function FamilyMarketCard({ className, datas, hidden = false }) { // debugger; - const [addFavorite, setValue] = useState(datas.whishlisted); - const [options, setOption] = useState(false); - const favoriteHandler = () => { - if (!addFavorite) { - setValue(true); - toast.success("Added to Favorite List"); - } else { - setValue(false); - toast.warn("Remove to Favorite List"); - } + const [popUp, setPopUp] = useState(false); + + const popUpHandler = () => { + setPopUp((prev) => !prev); }; + // Image + let selectedImage = + datas?.image || require("../../assets/images/banner-job-due.jpg"); + return ( -
-
-
-
-
-
- {datas?.isActive && ( - + <> +
+
+
+
+
+
+ {/* Active - - )} + */} +
+ {hidden &&
}
- {hidden &&
}
-
-
- {/* title */} - -

- {datas.post_title} -

- -
-
-
- +
+ {/* title */} + +
+
+

+ {getTimeAgo(datas?.added)} +

+
+
+ +
-
+ {popUp && ( + + )} + ); } diff --git a/src/components/FamilyAcc/FamilyMarket.jsx b/src/components/FamilyAcc/FamilyMarket.jsx index 39a067c..84bdce3 100644 --- a/src/components/FamilyAcc/FamilyMarket.jsx +++ b/src/components/FamilyAcc/FamilyMarket.jsx @@ -8,17 +8,41 @@ import SearchCom from "../Helpers/SearchCom"; import collections from "../../data/collectionplan_data.json"; import FamilyMarketCard from "../Cards/FamilyMarketCard"; import { Link } from "react-router-dom"; +import usersService from "../../services/UsersService"; +import SuggestTask from "../FamilyPopup/SuggestTask"; export default function FamilyMarket() { const [selectTab, setValue] = useState("today"); const [popUp, setPopUp] = useState(false); - const apiCall = useMemo(() => new SiteService(), []); + const [MyFamilySampleTasks, setMyFamilySampleTasks] = useState({ + loading: true, + status: false, + data: [], + }); - // This is to make sure it's called once and used everywhere - let memberId = localStorage.getItem("member_id"); - let uid = localStorage.getItem("uid"); - let sessionId = localStorage.getItem("session_token"); + const apiCall = useMemo(() => new usersService(), []); + + const getMyFamilySampleTasks = useCallback(async () => { + setMyFamilySampleTasks({ loading: true, status: false, data: [] }); + try { + const res = await apiCall.getFamilySampleTasks(); + setMyFamilySampleTasks({ + loading: false, + status: true, + data: res.data.result_list, + }); + } catch (error) { + setMyFamilySampleTasks({ loading: false, status: false, data: [] }); + console.log("Error getting tasks"); + } + }, [apiCall, setMyFamilySampleTasks]); + + useEffect(() => { + getMyFamilySampleTasks(); + }, [getMyFamilySampleTasks]); + + console.log("My family stuff>> ", MyFamilySampleTasks); const popUpHandler = () => { setPopUp((prev) => !prev); @@ -56,24 +80,23 @@ export default function FamilyMarket() {
{/* filter-search */}
- +
{/* filer-dropdown */}
- Any Other Task - +
{({ datas }) => ( @@ -83,11 +106,7 @@ export default function FamilyMarket() {
- {popUp && ( - - {/* */} - - )} + {popUp && } ); } diff --git a/src/components/FamilyPopup/SuggestTask.jsx b/src/components/FamilyPopup/SuggestTask.jsx new file mode 100644 index 0000000..4353f80 --- /dev/null +++ b/src/components/FamilyPopup/SuggestTask.jsx @@ -0,0 +1,77 @@ +import React from "react"; +import ModalCom from "../Helpers/ModalCom"; + +const SuggestTask = ({ details, onClose, situation }) => { + return ( + +
+
+

+ Suggest to Parent +

+ +
+
+
+ + {/* ACTION SECTION */} +
+
+
+
+ + + {/* {requestStatus.loading ? ( + + ) : ( */} + + {/* )} */} +
+
+
+
+ ); +}; + +export default SuggestTask; diff --git a/src/components/MyPendingJobs/ParentWaiting.jsx b/src/components/MyPendingJobs/ParentWaiting.jsx index 0363535..1655e7e 100644 --- a/src/components/MyPendingJobs/ParentWaiting.jsx +++ b/src/components/MyPendingJobs/ParentWaiting.jsx @@ -2,8 +2,6 @@ import React, { useState } from "react"; import { Link } from "react-router-dom"; import { toast } from "react-toastify"; import activeAidsBanner from "../../assets/images/kids-waiting.jpg"; -import HeroUser from "../../assets/images/hero-user.png"; -import CountDown from "../Helpers/CountDown"; import ParentWaitingTable from "./ParentWaitingTable"; export default function ParentWaiting({ className }) { @@ -20,7 +18,7 @@ export default function ParentWaiting({ className }) { return ( <>
-
+

Waiting for Parent to Get Started...

diff --git a/src/components/Partials/Sidebar.jsx b/src/components/Partials/Sidebar.jsx index 662ca6d..9abe05a 100644 --- a/src/components/Partials/Sidebar.jsx +++ b/src/components/Partials/Sidebar.jsx @@ -124,15 +124,7 @@ export default function Sidebar({ iconName="market" /> )} - {userDetails && userDetails?.account_type == "FAMILY" && ( - - )} +