Skip to content

Commit

Permalink
Merge pull request #65 from GenaDrop/stagging
Browse files Browse the repository at this point in the history
Staging to main
  • Loading branch information
Ebube111 authored Jan 9, 2024
2 parents 5426734 + 849fdb1 commit 3153cbf
Show file tree
Hide file tree
Showing 14 changed files with 102 additions and 38 deletions.
2 changes: 1 addition & 1 deletion apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Payout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
40 changes: 36 additions & 4 deletions apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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 (
<ExploreContainer>
<ExploreRoot>
Expand All @@ -218,7 +230,7 @@ return (
</div>
<div className="searchContainer">
<Search>
<Input />
<Input placeholder="Search for Different Contests" value={searchValue} onChange={searchInputHandler} />
{searchSvg}
</Search>
<Filter>
Expand Down Expand Up @@ -250,7 +262,7 @@ return (
</Tab>
</Tabs>
<Cards>
{contest?.length > 0 ? contest?.map((data, index) => (
{searchValue === '' ? contest?.length > 0 ? contest?.map((data, index) => (
<Widget
src="bos.genadrop.near/widget/CPlanet.DropsFund.Explore.Card"
key={index}
Expand Down Expand Up @@ -285,7 +297,27 @@ return (

<NoContest>
<p>There are no {activeTab} Contest available</p>
</NoContest>}
</NoContest> : filteredValue.length ? filteredValue?.map((data, index) => (
<Widget
src="bos.genadrop.near/widget/CPlanet.DropsFund.Explore.Card"
key={index}
props={{
data: data[1],
update: props.update,
isSubmissionOpen: isFutureTimestamp(data[1]?.submission_end_time),
isVotingEnded: isFutureTimestamp(data[1]?.voting_end_time),
id: data[0],
update: props.update,
isGateway: props.isGateway
}}
/>
))
: (
<NoContest>
<p>No Contest Found</p>
</NoContest>
)
}
</Cards>
</ExploreRoot>
</ExploreContainer>
Expand Down
6 changes: 3 additions & 3 deletions apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Rules.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
10 changes: 5 additions & 5 deletions apps/BosGenaDrop/widget/CPlanet/DropsFund/Explore/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const CardRoot = styled.div`
}
.description {
padding: 0 15px;
height: 100px;
height: 60px;
p {
color: #808080;
font-family: Helvetica Neue;
Expand Down Expand Up @@ -250,8 +250,8 @@ return (
<CardRoot>
<div className="card-title">
<div className="name">
<h1>{makeAccountIdShorter(data?.title) ?? "Lorem Ipsum Contest"}</h1>
<a href={`#/bos.genadrop.near/widget/CPlanet.DAO.Index?daoId=${props?.data?.dao_id}`}>{props?.data?.dao_id}{checkSvg}</a>
<h1>{makeAccountIdShorter(data?.title) ?? "-- No Title --"}</h1>
<a href={`#/bos.genadrop.near/widget/CPlanet.DAO.Index?daoId=${props?.data?.dao_id}`}>{props?.data?.dao_id}{" "}{checkSvg}</a>
</div>
<p
className={
Expand All @@ -270,11 +270,11 @@ return (
</p>
</div>
<div className="description">
<p>{props?.data?.description?.substring(0, 120) ?? "No description"}</p>
<p>{props?.data?.description?.substring(0, 120) ?? "-- No description --"}</p>
</div>
<div className="card-footer">
<div className="one-sec">
<span className="prize">Prize per winner</span>
<span className="prize">Total Prize</span>
<div className="amount">
<img
src="https://ipfs.near.social/ipfs/bafkreierjvmroeb6tnfu3ckrfmet7wpx7k3ubjnc6gcdzauwqkxobnu57e"
Expand Down
2 changes: 1 addition & 1 deletion build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Payout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down
40 changes: 36 additions & 4 deletions build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down Expand Up @@ -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 (
<ExploreContainer>
<ExploreRoot>
Expand All @@ -218,7 +230,7 @@ return (
</div>
<div className="searchContainer">
<Search>
<Input />
<Input placeholder="Search for Different Contests" value={searchValue} onChange={searchInputHandler} />
{searchSvg}
</Search>
<Filter>
Expand Down Expand Up @@ -250,7 +262,7 @@ return (
</Tab>
</Tabs>
<Cards>
{contest?.length > 0 ? contest?.map((data, index) => (
{searchValue === '' ? contest?.length > 0 ? contest?.map((data, index) => (
<Widget
src="bos.genadrop.near/widget/CPlanet.DropsFund.Explore.Card"
key={index}
Expand Down Expand Up @@ -285,7 +297,27 @@ return (

<NoContest>
<p>There are no {activeTab} Contest available</p>
</NoContest>}
</NoContest> : filteredValue.length ? filteredValue?.map((data, index) => (
<Widget
src="bos.genadrop.near/widget/CPlanet.DropsFund.Explore.Card"
key={index}
props={{
data: data[1],
update: props.update,
isSubmissionOpen: isFutureTimestamp(data[1]?.submission_end_time),
isVotingEnded: isFutureTimestamp(data[1]?.voting_end_time),
id: data[0],
update: props.update,
isGateway: props.isGateway
}}
/>
))
: (
<NoContest>
<p>No Contest Found</p>
</NoContest>
)
}
</Cards>
</ExploreRoot>
</ExploreContainer>
Expand Down
6 changes: 3 additions & 3 deletions build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Rules.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
Loading

0 comments on commit 3153cbf

Please sign in to comment.