From d35490c1ee5c02816cd1bacd89aaadb482d7ec08 Mon Sep 17 00:00:00 2001 From: Ebube Agwaze Date: Tue, 9 Jan 2024 11:26:16 +0100 Subject: [PATCH] fix: made ui changes and updated contract name as well --- .../widget/CPlanet/DropsFund/Admin/Index.jsx | 2 +- .../widget/CPlanet/DropsFund/Admin/Payout.jsx | 2 +- .../widget/CPlanet/DropsFund/Contest/Card.jsx | 6 +-- .../CPlanet/DropsFund/Contest/Index.jsx | 40 +++++++++++++++++-- .../CPlanet/DropsFund/Contest/Rules.jsx | 6 +-- .../CPlanet/DropsFund/Contest/Single.jsx | 4 +- .../widget/CPlanet/DropsFund/Explore/Card.jsx | 10 ++--- .../src/CPlanet/DropsFund/Admin/Index.jsx | 2 +- .../src/CPlanet/DropsFund/Admin/Payout.jsx | 2 +- .../src/CPlanet/DropsFund/Contest/Card.jsx | 6 +-- .../src/CPlanet/DropsFund/Contest/Index.jsx | 40 +++++++++++++++++-- .../src/CPlanet/DropsFund/Contest/Rules.jsx | 6 +-- .../src/CPlanet/DropsFund/Contest/Single.jsx | 4 +- .../src/CPlanet/DropsFund/Explore/Card.jsx | 10 ++--- 14 files changed, 102 insertions(+), 38 deletions(-) diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx index f1c7fb48..9a47dad0 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx @@ -65,7 +65,7 @@ function convertToTimestamp(dateString) { } const handleSubmit = () => { - Near.call("fund-v2.genadrop.near", + Near.call("fund-vf.genadrop.near", "create_contest", { title: contestName, diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Payout.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Payout.jsx index 24cce60c..266509a2 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Payout.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Payout.jsx @@ -54,7 +54,7 @@ const [contestId, setContestId] = useState(0) const [proposalId, setProposalId] = useState(0) const handleSubmit = () => { - Near.call("fund-v2.genadrop.near", + Near.call("fund-vf.genadrop.near", "set_payout_proposal_id", { contest_id: contestId, diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx index c3c5423a..dbd757c0 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx @@ -269,7 +269,7 @@ const StartedButton = styled.div` const handleVoteClick = () => { Near.call( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "vote", { submission_owner: props.owner, @@ -295,7 +295,7 @@ const formatTime = (time) => { }; const winnerDetails = Near.view( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "get_winner_payout_info", { subscribe: true, @@ -305,7 +305,7 @@ const winnerDetails = Near.view( ); const totalUsersVoted = Near.view( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "get_all_user_voted", { subscribe: true, diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx index f6521551..0458d850 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx @@ -173,12 +173,15 @@ const isFutureTimestamp = (timestamp) => { }; const fetchedContests = - Near.view("fund-v2.genadrop.near", "get_contests", { + Near.view("fund-vf.genadrop.near", "get_contests", { subscribe: true, }) || []; const [activeTab, setActiveTab] = useState("ALL"); const [contest, setContest] = useState(fetchedContests || []); +const [searchValue, setSearchValue] = useState("") +const [filteredValue, setFilteredValue] = useState([]) + useEffect(() => { @@ -210,6 +213,15 @@ useEffect(() => { } }, [contest, activeTab]); +const searchInputHandler = (e) => { + const value = e.target.value.toLowerCase(); + const searched = contest.filter((nft) => + nft[1]?.title.toLowerCase().includes(value) + ); + setSearchValue(value) + setFilteredValue(searched) +} + return ( @@ -218,7 +230,7 @@ return (
- + {searchSvg} @@ -250,7 +262,7 @@ return ( - {contest?.length > 0 ? contest?.map((data, index) => ( + {searchValue === '' ? contest?.length > 0 ? contest?.map((data, index) => (

There are no {activeTab} Contest available

- } + : filteredValue.length ? filteredValue?.map((data, index) => ( + + )) + : ( + +

No Contest Found

+
+ ) + }
diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Rules.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Rules.jsx index 6ae2384a..4ac21697 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Rules.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Rules.jsx @@ -356,7 +356,7 @@ const [openModal, setOpenModal] = useState(false); const handleArtSelection = (nft_data) => { Near.call( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "submit_art", { nft_contract_id: nft_data.contractId, @@ -370,7 +370,7 @@ const handleArtSelection = (nft_data) => { }; const totalUsersVoted = Near.view( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "get_all_user_voted", { subscribe: true, @@ -381,7 +381,7 @@ const totalUsersVoted = Near.view( const handleFinalize = () => { Near.call( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "finalise_contest", { contest_id: Number(props.contestId), diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx index d3df279c..f0c41107 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx @@ -254,13 +254,13 @@ const PriceBucket = styled.div` const contestId = props.contestId; const [userSubmitted, setUserSubmitted] = useState(false); -const contest = Near.view("fund-v2.genadrop.near", "get_contest_detail", { +const contest = Near.view("fund-vf.genadrop.near", "get_contest_detail", { contest_id: Number(contestId), subscribe: true, }); -const contestArts = Near.view("fund-v2.genadrop.near", "get_contest_arts", { +const contestArts = Near.view("fund-vf.genadrop.near", "get_contest_arts", { contest_id: Number(contestId), subscribe: true, }); diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Explore/Card.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Explore/Card.jsx index a35415ec..f83cf462 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Explore/Card.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Explore/Card.jsx @@ -90,7 +90,7 @@ const CardRoot = styled.div` } .description { padding: 0 15px; - height: 100px; + height: 60px; p { color: #808080; font-family: Helvetica Neue; @@ -250,8 +250,8 @@ return (
-

{makeAccountIdShorter(data?.title) ?? "Lorem Ipsum Contest"}

- {props?.data?.dao_id}{checkSvg} +

{makeAccountIdShorter(data?.title) ?? "-- No Title --"}

+ {props?.data?.dao_id}{" "}{checkSvg}

-

{props?.data?.description?.substring(0, 120) ?? "No description"}

+

{props?.data?.description?.substring(0, 120) ?? "-- No description --"}

- Prize per winner + Total Prize
{ - Near.call("fund-v2.genadrop.near", + Near.call("fund-vf.genadrop.near", "create_contest", { title: contestName, diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Payout.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Payout.jsx index 24cce60c..266509a2 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Payout.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Payout.jsx @@ -54,7 +54,7 @@ const [contestId, setContestId] = useState(0) const [proposalId, setProposalId] = useState(0) const handleSubmit = () => { - Near.call("fund-v2.genadrop.near", + Near.call("fund-vf.genadrop.near", "set_payout_proposal_id", { contest_id: contestId, diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx index c3c5423a..dbd757c0 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx @@ -269,7 +269,7 @@ const StartedButton = styled.div` const handleVoteClick = () => { Near.call( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "vote", { submission_owner: props.owner, @@ -295,7 +295,7 @@ const formatTime = (time) => { }; const winnerDetails = Near.view( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "get_winner_payout_info", { subscribe: true, @@ -305,7 +305,7 @@ const winnerDetails = Near.view( ); const totalUsersVoted = Near.view( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "get_all_user_voted", { subscribe: true, diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx index f6521551..0458d850 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx @@ -173,12 +173,15 @@ const isFutureTimestamp = (timestamp) => { }; const fetchedContests = - Near.view("fund-v2.genadrop.near", "get_contests", { + Near.view("fund-vf.genadrop.near", "get_contests", { subscribe: true, }) || []; const [activeTab, setActiveTab] = useState("ALL"); const [contest, setContest] = useState(fetchedContests || []); +const [searchValue, setSearchValue] = useState("") +const [filteredValue, setFilteredValue] = useState([]) + useEffect(() => { @@ -210,6 +213,15 @@ useEffect(() => { } }, [contest, activeTab]); +const searchInputHandler = (e) => { + const value = e.target.value.toLowerCase(); + const searched = contest.filter((nft) => + nft[1]?.title.toLowerCase().includes(value) + ); + setSearchValue(value) + setFilteredValue(searched) +} + return ( @@ -218,7 +230,7 @@ return (
- + {searchSvg} @@ -250,7 +262,7 @@ return ( - {contest?.length > 0 ? contest?.map((data, index) => ( + {searchValue === '' ? contest?.length > 0 ? contest?.map((data, index) => (

There are no {activeTab} Contest available

- } + : filteredValue.length ? filteredValue?.map((data, index) => ( + + )) + : ( + +

No Contest Found

+
+ ) + }
diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Rules.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Rules.jsx index 6ae2384a..4ac21697 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Rules.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Rules.jsx @@ -356,7 +356,7 @@ const [openModal, setOpenModal] = useState(false); const handleArtSelection = (nft_data) => { Near.call( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "submit_art", { nft_contract_id: nft_data.contractId, @@ -370,7 +370,7 @@ const handleArtSelection = (nft_data) => { }; const totalUsersVoted = Near.view( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "get_all_user_voted", { subscribe: true, @@ -381,7 +381,7 @@ const totalUsersVoted = Near.view( const handleFinalize = () => { Near.call( - "fund-v2.genadrop.near", + "fund-vf.genadrop.near", "finalise_contest", { contest_id: Number(props.contestId), diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx index d3df279c..f0c41107 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx @@ -254,13 +254,13 @@ const PriceBucket = styled.div` const contestId = props.contestId; const [userSubmitted, setUserSubmitted] = useState(false); -const contest = Near.view("fund-v2.genadrop.near", "get_contest_detail", { +const contest = Near.view("fund-vf.genadrop.near", "get_contest_detail", { contest_id: Number(contestId), subscribe: true, }); -const contestArts = Near.view("fund-v2.genadrop.near", "get_contest_arts", { +const contestArts = Near.view("fund-vf.genadrop.near", "get_contest_arts", { contest_id: Number(contestId), subscribe: true, }); diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Explore/Card.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Explore/Card.jsx index a35415ec..f83cf462 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Explore/Card.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Explore/Card.jsx @@ -90,7 +90,7 @@ const CardRoot = styled.div` } .description { padding: 0 15px; - height: 100px; + height: 60px; p { color: #808080; font-family: Helvetica Neue; @@ -250,8 +250,8 @@ return (
-

{makeAccountIdShorter(data?.title) ?? "Lorem Ipsum Contest"}

- {props?.data?.dao_id}{checkSvg} +

{makeAccountIdShorter(data?.title) ?? "-- No Title --"}

+ {props?.data?.dao_id}{" "}{checkSvg}

-

{props?.data?.description?.substring(0, 120) ?? "No description"}

+

{props?.data?.description?.substring(0, 120) ?? "-- No description --"}

- Prize per winner + Total Prize