From aa48529dcafdded22b503cc5108ee46ce608ddd9 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Fri, 23 Feb 2024 16:15:46 +0100 Subject: [PATCH 1/3] configured family new dashboard to show only on dev --- .env | 5 ++++- .env.development | 5 ++++- .env.production | 3 +++ src/components/Home/FamilyDash.jsx | 32 +++++++++++++++++------------- 4 files changed, 29 insertions(+), 16 deletions(-) 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..63e291b 100644 --- a/src/components/Home/FamilyDash.jsx +++ b/src/components/Home/FamilyDash.jsx @@ -13,19 +13,9 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) {
{/* */} -
- {[1,2,3,4,5].map((item, index) => ( - -
- -
- - ))} -
- -
-

Resources

-
+ {process.env.REACT_APP_SHOW_NEW_FAMILY_DASH && + <> +
{[1,2,3,4,5].map((item, index) => (
@@ -34,7 +24,21 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) { ))}
-
+ +
+

Resources

+
+ {[1,2,3,4,5].map((item, index) => ( + +
+ +
+ + ))} +
+
+ + } {familyOffers?.result_list && familyOffers?.result_list.length > 0 && ( Date: Fri, 23 Feb 2024 16:27:17 +0100 Subject: [PATCH 2/3] configured family new dashboard to show only on dev --- src/components/Home/FamilyDash.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/Home/FamilyDash.jsx b/src/components/Home/FamilyDash.jsx index 63e291b..be727a3 100644 --- a/src/components/Home/FamilyDash.jsx +++ b/src/components/Home/FamilyDash.jsx @@ -13,11 +13,11 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) {
{/* */} - {process.env.REACT_APP_SHOW_NEW_FAMILY_DASH && + {process.env.REACT_APP_SHOW_NEW_FAMILY_DASH == '1' && <>
{[1,2,3,4,5].map((item, index) => ( - +
@@ -29,7 +29,7 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) {

Resources

{[1,2,3,4,5].map((item, index) => ( - +
From 9029953432a5a7d894333a9765c17b5b654cee27 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Fri, 23 Feb 2024 17:29:18 +0100 Subject: [PATCH 3/3] added familybanners API --- src/components/Home/FamilyDash.jsx | 49 ++++++++++++++++++++++++------ src/lib/apiConst.js | 1 + src/services/UsersService.js | 13 ++++++++ 3 files changed, 53 insertions(+), 10 deletions(-) diff --git a/src/components/Home/FamilyDash.jsx b/src/components/Home/FamilyDash.jsx index be727a3..dde6128 100644 --- a/src/components/Home/FamilyDash.jsx +++ b/src/components/Home/FamilyDash.jsx @@ -1,13 +1,36 @@ -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 (
@@ -15,15 +38,21 @@ export default function FamilyDash({ familyOffers, MyActiveJobList }) { {process.env.REACT_APP_SHOW_NEW_FAMILY_DASH == '1' && <> -
- {[1,2,3,4,5].map((item, index) => ( - -
- -
- - ))} -
+ {!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

diff --git a/src/lib/apiConst.js b/src/lib/apiConst.js index dade843..58f3375 100644 --- a/src/lib/apiConst.js +++ b/src/lib/apiConst.js @@ -132,6 +132,7 @@ export const apiConst = { WRENCHBOARD_ACCOUNT_HOMEBANNERS: 11200, WRENCHBOARD_ACCOUNT_PLAYGROUND: 11201, + WRENCHBOARD_ACCOUNT_FAMILY_BANNERS: 22005, WRENCHBOARD_ACCOUNT_RECENTS: 11202, WRENCHBOARD_ACCOUNT_NOTIFICATIONS: 11205, diff --git a/src/services/UsersService.js b/src/services/UsersService.js index bbc858c..1ed6f1c 100644 --- a/src/services/UsersService.js +++ b/src/services/UsersService.js @@ -1249,6 +1249,19 @@ class usersService { }; return this.postAuxEnd("/familyrelinvite", postData); } + + // API FUNCTION TO FAMILY BANNERS + getFamilyBannersList() { + var postData = { + uid: localStorage.getItem("uid"), + member_id: localStorage.getItem("member_id"), + sessionid: localStorage.getItem("session_token"), + action: apiConst.WRENCHBOARD_ACCOUNT_FAMILY_BANNERS, + limit: 20, + offset: 1 + }; + return this.postAuxEnd("/familybanners", postData); + } /* - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(username) - 20:27:30.118 FLOG_MAX [757411]: REQ_STRING(password)