From 2f6f0bf501b39f6769a1197162e151c6c55378ea Mon Sep 17 00:00:00 2001 From: victorAnumudu Date: Wed, 24 Jul 2024 18:32:43 +0100 Subject: [PATCH] added icons --- src/components/History/JobsCompleted.jsx | 9 ++--- src/components/History/index.jsx | 42 +++++++++++++++++++----- src/components/customTabs/TabButton.jsx | 12 +++++-- 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/src/components/History/JobsCompleted.jsx b/src/components/History/JobsCompleted.jsx index 2418ed7..d060491 100644 --- a/src/components/History/JobsCompleted.jsx +++ b/src/components/History/JobsCompleted.jsx @@ -40,9 +40,6 @@ function JobsCompleted() { }).catch((error)=>{ setJobHistory(prev => ({...prev, loading: false, error: true})) }) - setTimeout(()=>{ - setJobHistory(prev => ({...prev, loading: false, error:true})) - },3000) } useEffect(()=>{ @@ -51,7 +48,7 @@ function JobsCompleted() { return (
- {jobHistory.loading ? + {jobHistory?.loading ? : jobHistory?.data?.length ? @@ -64,7 +61,7 @@ function JobsCompleted() { - {currentReward.map((item, index) => { + {currentReward?.map((item, index) => { let date = new Date(item?.delivery_date).toLocaleDateString() return ( @@ -86,7 +83,7 @@ function JobsCompleted() { )}
- :jobHistory.error ? + :jobHistory?.error ?
Opps! an error occurred. Please try again!
diff --git a/src/components/History/index.jsx b/src/components/History/index.jsx index b3329fd..04df522 100644 --- a/src/components/History/index.jsx +++ b/src/components/History/index.jsx @@ -19,9 +19,32 @@ export default function History() { const apiCall = new usersService() - let [tab, setTab] = useState("purchases"); //STATE FOR SWITCHING BETWEEN TABS const [selectedTab, setSelectedTab] = useState("purchases"); - const tabs = ["purchases", "recent activity", "rewards", 'jobs completed'] //STATE FOR SWITCHING BETWEEN TABS + // let [tab, setTab] = useState("purchases"); //STATE FOR SWITCHING BETWEEN TABS + // const tabs = ["purchases", "recent activity", "rewards", 'jobs completed'] //STATE FOR SWITCHING BETWEEN TABS + + const tabs = [ //STATE FOR SWITCHING BETWEEN TABS + { + id: 1, + title: "purchases", + iconName: "history", + }, + { + id: 2, + title: "recent activity", + iconName: "history", + }, + { + id: 3, + title: "rewards", + iconName: "history", + }, + { + id: 4, + title: "jobs completed", + iconName: "history", + }, + ] let [paymentHistory, setPaymentHistory] = useState({ // FOR PAYMENT HISTORY loading: true, @@ -91,12 +114,15 @@ export default function History() {
{tabs.map((item) => ( - +
+ +
))}
diff --git a/src/components/customTabs/TabButton.jsx b/src/components/customTabs/TabButton.jsx index 95ee3a0..2ece8fb 100644 --- a/src/components/customTabs/TabButton.jsx +++ b/src/components/customTabs/TabButton.jsx @@ -1,16 +1,22 @@ import React from 'react' +import Icons from '../Helpers/Icons' -export default function TabButton({ item='', selectedTab='', setSelectedTab=()=>{} }) { +export default function TabButton({ item='', iconName='', selectedTab='', setSelectedTab=()=>{} }) { return ( ) }