From 60792eeb3cc51d29dffd60556d641b7b7147f41a Mon Sep 17 00:00:00 2001 From: Ebube Agwaze Date: Mon, 18 Dec 2023 12:29:25 +0100 Subject: [PATCH] fix: all contests display --- .../CPlanet/DropsFund/Contest/Index.jsx | 44 ++++++++++++++++--- .../CPlanet/DropsFund/Contest/Single.jsx | 2 +- .../src/CPlanet/DropsFund/Contest/Index.jsx | 44 ++++++++++++++++--- .../src/CPlanet/DropsFund/Contest/Single.jsx | 2 +- 4 files changed, 76 insertions(+), 16 deletions(-) diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx index 65955d34..bd1273a7 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx @@ -54,13 +54,19 @@ const Search = styled.div` border: 1px solid #efefef; height: 48px; background: #fff; - input { - border: none; - } - input:focus: { +`; + +const Input = styled.input` +&&& { + padding: 8px; + font-size: 16px; + border: none; + flex: 1; + &:focus { outline: none; border: none; } +} `; const Filter = styled.div` @@ -123,6 +129,20 @@ const Cards = styled.div` background: white; `; +const NoContest = styled.div` + display: flex; + align-items: center; + justify-content: center; + width: 100%; + padding: 24px 32px; + p { + color: #d0d0d0; + font-size: 24px; + font-weight: 600; + } + +` + const isFutureTimestamp = (timestamp) => { const currentTimestamp = Math.floor(Date.now() / 1000); // Convert current time to seconds @@ -151,12 +171,20 @@ useEffect(() => { ) ); break; + case "PAID": + setContest([]); + break; case "PAST": setContest( fetchedContests?.filter( (data) => !isFutureTimestamp(data[1]?.voting_end_time) ) ); + break; + default: + // Default case: handle the default state here + setContest(fetchedContests); + break; } }, [contest, activeTab]); @@ -168,7 +196,7 @@ return (
- + {searchSvg} @@ -200,7 +228,7 @@ return ( - {contest?.map((data, index) => ( + {contest?.length > 0 ? contest?.map((data, index) => ( - ))} + )): +

There are no {activeTab} Contest available

+
}
diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx index 45f9d14b..a7b52bfb 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx @@ -143,7 +143,7 @@ const Username = styled.div` font-family: Helvetica Neue; font-size: 16px; font-style: normal; - font-weight: 400; + font-weight: 400; line-height: normal; text-transform: uppercase; margin-bottom: 20px; diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx index 65955d34..bd1273a7 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx @@ -54,13 +54,19 @@ const Search = styled.div` border: 1px solid #efefef; height: 48px; background: #fff; - input { - border: none; - } - input:focus: { +`; + +const Input = styled.input` +&&& { + padding: 8px; + font-size: 16px; + border: none; + flex: 1; + &:focus { outline: none; border: none; } +} `; const Filter = styled.div` @@ -123,6 +129,20 @@ const Cards = styled.div` background: white; `; +const NoContest = styled.div` + display: flex; + align-items: center; + justify-content: center; + width: 100%; + padding: 24px 32px; + p { + color: #d0d0d0; + font-size: 24px; + font-weight: 600; + } + +` + const isFutureTimestamp = (timestamp) => { const currentTimestamp = Math.floor(Date.now() / 1000); // Convert current time to seconds @@ -151,12 +171,20 @@ useEffect(() => { ) ); break; + case "PAID": + setContest([]); + break; case "PAST": setContest( fetchedContests?.filter( (data) => !isFutureTimestamp(data[1]?.voting_end_time) ) ); + break; + default: + // Default case: handle the default state here + setContest(fetchedContests); + break; } }, [contest, activeTab]); @@ -168,7 +196,7 @@ return (
- + {searchSvg} @@ -200,7 +228,7 @@ return ( - {contest?.map((data, index) => ( + {contest?.length > 0 ? contest?.map((data, index) => ( - ))} + )): +

There are no {activeTab} Contest available

+
}
diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx index 45f9d14b..a7b52bfb 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx @@ -143,7 +143,7 @@ const Username = styled.div` font-family: Helvetica Neue; font-size: 16px; font-style: normal; - font-weight: 400; + font-weight: 400; line-height: normal; text-transform: uppercase; margin-bottom: 20px;