From 7eecd34a5e28c9d1619ab6f30f9b78fe7a2f1e19 Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Thu, 26 Sep 2024 18:41:30 +0100 Subject: [PATCH] initial commit --- src/components/FamilyAcc/FamilyTableNew.jsx | 17 ++++++++++++++--- src/components/jobPopout/OfferJobPopout.jsx | 21 ++++++++++++++++----- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/components/FamilyAcc/FamilyTableNew.jsx b/src/components/FamilyAcc/FamilyTableNew.jsx index 4ced8c7..562957a 100644 --- a/src/components/FamilyAcc/FamilyTableNew.jsx +++ b/src/components/FamilyAcc/FamilyTableNew.jsx @@ -20,6 +20,9 @@ export default function FamilyTableNew() { let { pathname } = useLocation(); + const queryParams = new URLSearchParams(location?.search); + const preSelectedTab = queryParams.get("tab"); + // Initial state for family details const initialDetailState = { loading: false, @@ -55,9 +58,9 @@ export default function FamilyTableNew() { // Array of tab names const tabs = [ - { id: 1, name: "Tasks" }, - { id: 2, name: "Waiting" }, - { id: 3, name: "Pending" }, + { id: 1, name: "tasks" }, + { id: 2, name: "waiting" }, + { id: 3, name: "pending" }, ]; // State for the currently selected tab @@ -94,6 +97,14 @@ export default function FamilyTableNew() { // Selected tab component based on the current 'tab' const selectedTabComponent = tabComponents[tab] || defaultTabComponent; + useEffect(()=>{ // EFFECT TO CHECK FOR PRE SELECTED TAB AND DEFAULT TO IT OR TO DEFAULT IF NOT AVALIABLE + if(preSelectedTab && tabs.map(item => item.name.toLowerCase()).includes(preSelectedTab.toLowerCase())){ + setTab(preSelectedTab) + }else{ + setTab(tabs[0].name) + } + },[]) + // Effect to manage active family task details useEffect(() => { diff --git a/src/components/jobPopout/OfferJobPopout.jsx b/src/components/jobPopout/OfferJobPopout.jsx index 5943d42..e704723 100644 --- a/src/components/jobPopout/OfferJobPopout.jsx +++ b/src/components/jobPopout/OfferJobPopout.jsx @@ -176,19 +176,30 @@ function OfferJobPopout({ details, onClose, situation }) { -

+

{details.title}

- + +

{details.description}

+ {/* */}
-
- -

{details.job_description || details.job_detail}

+
+ {/* +

{details.job_description || details.job_detail}

*/} + +