diff --git a/.env b/.env index f354dbc..27d706e 100644 --- a/.env +++ b/.env @@ -102,4 +102,7 @@ REACT_APP_NEW_LOGIN_LAYOUT=1 #APP DOWNLOAD LINKS REACT_APP_ANDROID_APP='https://play.google.com/store/apps/details?id=com.wrenchboard.users' -REACT_APP_APPLE_APP='https://itunes.apple.com/us/app/wrenchboard/id1435718367?ls=1&mt=8' \ No newline at end of file +REACT_APP_APPLE_APP='https://itunes.apple.com/us/app/wrenchboard/id1435718367?ls=1&mt=8' + +# Displays the new family dashboard with boxes +REACT_APP_SHOW_NEW_FAMILY_DASH=1 \ No newline at end of file diff --git a/.env.development b/.env.development index 8612111..158c2c7 100644 --- a/.env.development +++ b/.env.development @@ -70,4 +70,7 @@ REACT_APP_NEW_LOGIN_LAYOUT=1 #APP DOWNLOAD LINKS REACT_APP_ANDROID_APP='https://play.google.com/store/apps/details?id=com.wrenchboard.users' -REACT_APP_APPLE_APP='https://itunes.apple.com/us/app/wrenchboard/id1435718367?ls=1&mt=8' \ No newline at end of file +REACT_APP_APPLE_APP='https://itunes.apple.com/us/app/wrenchboard/id1435718367?ls=1&mt=8' + +# Displays the new family dashboard with boxes +REACT_APP_SHOW_NEW_FAMILY_DASH=1 \ No newline at end of file diff --git a/.env.production b/.env.production index d600cad..4268f04 100644 --- a/.env.production +++ b/.env.production @@ -77,3 +77,6 @@ REACT_APP_NEW_LOGIN_LAYOUT=1 #APP DOWNLOAD LINKS REACT_APP_ANDROID_APP='https://play.google.com/store/apps/details?id=com.wrenchboard.users' REACT_APP_APPLE_APP='https://itunes.apple.com/us/app/wrenchboard/id1435718367?ls=1&mt=8' + +# Displays the new family dashboard with boxes +REACT_APP_SHOW_NEW_FAMILY_DASH=0 diff --git a/src/components/Home/FamilyDash.jsx b/src/components/Home/FamilyDash.jsx index 40fbc3d..dde6128 100644 --- a/src/components/Home/FamilyDash.jsx +++ b/src/components/Home/FamilyDash.jsx @@ -1,40 +1,73 @@ -import React from "react"; +import React, { useEffect, useState } from "react"; import ParentWaiting from "../MyOffers/ParentWaiting"; import MyOffersFamilyTable from "../MyTasks/MyOffersFamilyTable"; import FamilyActiveLSlde from "./FamilyActiveLSlde"; import { Link } from "react-router-dom"; +import usersService from "../../services/UsersService"; export default function FamilyDash({ familyOffers, MyActiveJobList }) { // console.log("PROPS IN FAMILY DASH->", familyOffers?.result_list); + + const userApi = new usersService(); const trending = MyActiveJobList; + + let [familyBannersList, setFamilyBannersList] = useState({loading:false, result:{}}) + + const getFamilyBanners = async () => { // FUNCTION TO GET FAMILY BANNERS + setFamilyBannersList({loading:true, result:[]}); + try { + const res = await userApi.getFamilyBannersList(); + setFamilyBannersList({loading:false, result:res.data}); + // console.log('TEST RESPONSE', res) + } catch (error) { + setFamilyBannersList({loading:false, result:[]}); + console.log("Error getting tasks"); + } + }; + + + useEffect(()=>{ + getFamilyBanners() + },[]) + return (
{/* */} -
- {[1,2,3,4,5].map((item, index) => ( - -
+ {process.env.REACT_APP_SHOW_NEW_FAMILY_DASH == '1' && + <> + {!familyBannersList.loading && familyBannersList?.result?.data && Object.keys(familyBannersList?.result?.data).length > 0 && + // Loop for Family Banners +
+ {Object.keys(familyBannersList?.result?.data).map((item, index) => { + let content = familyBannersList?.result?.data[item] + return ( + +
+ {content.banner.text} for {item} content +
+ + ) + })} +
+ } + +
+

Resources

+
+ {[1,2,3,4,5].map((item, index) => ( + +
-
- - ))} -
- -
-

Resources

-
- {[1,2,3,4,5].map((item, index) => ( - -
- -
- - ))} +
+ + ))} +
-
+ + } {familyOffers?.result_list && familyOffers?.result_list.length > 0 && (