diff --git a/apps/BosGenaDrop/widget/CPlanet/DAO/Index.jsx b/apps/BosGenaDrop/widget/CPlanet/DAO/Index.jsx index 35a003a0..0ab16eda 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DAO/Index.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DAO/Index.jsx @@ -329,6 +329,8 @@ policy?.roles?.length && members = [...new Set(members)]; // -- +if(!policy) return

Not a Valid DAO

+ function makeAccountIdShorter(accountId) { if (accountId.length > shortenLength) { return accountId.slice(0, shortenLength) + "..."; diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx index aee47a25..d7ba27a4 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Index.jsx @@ -40,13 +40,20 @@ const Root = styled.div` margin-top: 30px; } } + .error { + color: red; + font-size: 14px; + + } ` const [contestName, setName] = useState("") const [description, setDescription] = useState("") const [daoId, setDaoId] = useState("") const [price, setPrice] = useState(0) +const [dateError, setDateError] = useState(false) const [places, setPlaces] = useState(0) +const [daoIdError, setDaoIdError] = useState(false) const [minArtVote, setMinArtVote] = useState(0) const [submissionStart, setSubmissionStart] = useState("") const [submissionEnd, setSubmissionEnd] = useState("") @@ -64,13 +71,32 @@ function convertToTimestamp(dateString) { return unixTimestamp; } +const policy = Near.view(daoId.trim(), "get_policy"); + const handleSubmit = () => { - Near.call("fund-vf.genadrop.near", + if(!policy) return setDaoIdError(true) + const submissionStartTimeStamp = convertToTimestamp(submissionStart); + const submissionEndTimeStamp = convertToTimestamp(submissionEnd); + const votingStartTimeStamp = convertToTimestamp(votingStart); + const votingEndTimeStamp = convertToTimestamp(votingEnd); + + // Validation checks + if ( + !submissionStart || !submissionEnd || !votingStart || !votingEnd || + submissionStartTimeStamp >= submissionEndTimeStamp || + votingStartTimeStamp >= votingEndTimeStamp || + submissionEndTimeStamp >= votingStartTimeStamp + ) { + return setDateError(true); + } + + + Near.call("fund-beta.genadrop.near", "create_contest", { title: contestName, description, - dao_id: daoId, + dao_id: daoId.trim(), logo_url: "https://picsum.photos/200/300.jpg", submission_start_time: convertToTimestamp(submissionStart), submission_end_time: convertToTimestamp(submissionEnd), @@ -103,6 +129,7 @@ return (
setDaoId(e.target.value)} required /> + {daoIdError && Invalid DAO ID}
@@ -137,6 +164,7 @@ return ( setVotingEnd(e.target.value)} type="datetime-local" required />
+ {dateError && Invalid Date: Note that Voting time cannot be less than submission time and Start time cannot be less than End time.}
diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Payout.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Admin/Payout.jsx index 7fdec895..9d2c7226 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-vf.genadrop.near", + Near.call("fund-beta.genadrop.near", "set_payout_proposal_id", { contest_id: Number(contestId), diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx index 55ae42a3..9dea1352 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Card.jsx @@ -70,6 +70,7 @@ const Image = styled.div` border-radius: 6px; height: 100%; object-fit: cover; + cursor: pointer; } @media (max-width: 500px) { width: 250px; @@ -165,6 +166,18 @@ const StartedButton = styled.div` justify-content: space-between; align-items: center; width: 132px; + .imageContainer { + display: flex; + align-items: center; + img { + width: 24px; + margin-right: -10px; + height: 24px; + border-radius: 30px; + border: 1px solid #F8F8F8; + background: url(), lightgray 50% / cover no-repeat; + } + } .bannedUser { display: flex; margin-top: 5px; @@ -289,89 +302,194 @@ const Popup = styled.div` height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; - align-items: center; justify-content: center; - backdrop-filter: blur(5px); /* Apply background blur */ + backdrop-filter: blur(5px); z-index: 9999; `; const PopupContent = styled.div` - background-color: #fff; - padding: 20px; + position: relative; /* Add this line */ border-radius: 5px; align-items: center; - max-width: 500px; - height: 400px; display: flex; flex-direction: column; - width: 100%; - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); - .modal-content { + width: 881px; + height: 881px; + flex-shrink: 0; + border-radius: 16px; + background: #ECECEC; + box-shadow: 4px 4px 40px 32px rgba(0, 0, 0, 0.12); + display: flex; + flex-direction: column; + justify-content: space-between; + padding: 20px; + .cancel-button { display: flex; - flex-direction: column; - align-items: center; - span { - text-align: center; - color: #b0b0b0; + width: 100%; + flex-direction: row-reverse; + img { + cursor: pointer; + transition: 0.5s ease-in-out; } - h1 { - text-align: center; - font-size: 22px; - font-weight: 600; + img:hover { + opacity: 0.7; } - input { - width: 80%; - margin: 40px 0; + } + @media (max-width: 900px) { + width: 95%; + height: 75%; + .cancel-button { + img { + width: 50px; + height: 50px; + } } - button { - border-radius: 12px; - width: 150px; - border: 1px solid #000; + } +`; + +const FadeIn = styled.div` + position: absolute; + bottom: 0; + left: 0; + right: 0; + top: auto; + height: 450px; + background-color: #000; + z-index: 99; + mask-image: linear-gradient(to bottom, transparent, white 100%, transparent); +`; + +const TextContent = styled.div` + position: relative; + z-index: 99999; + color: rgba(0, 0, 0, 1); /* Set the desired text color */ + display: flex; + flex-direction: column; + width: 100%; + align-items: flex-start; + + .header-title{ + color: #FFF; + leading-trim: both; + text-edge: cap; + font-family: "Helvetica Neue"; + font-size: 32px; + font-style: normal; + font-weight: 500; + line-height: normal; + } + .headerName { + display: flex; + flex-wrap: wrap; + align-items: center; + } + .dots { + width: 7px; + height: 7px; + margin-bottom: 13px; + margin-right: 5px; + margin-left: 5px; background: #fff; - color: #000; - font-size: 12px; - transition: .6s ease-in-out; - font-weight: 700; - padding: 10px 15px; - margin: 10px 0; - text-transform: uppercase; + border-radius: 50%; } - button:hover { - background: #000; + p { color: #fff; + font-family: Helvetica Neue; + display: flex; + align-item: center; + font-size: 20px; + font-style: normal; + font-weight: 500; + line-height: normal + span { + color: ${(p) => (p.selected ? "#3BD07F" : "#b0b0b0")}; + font-weight: ${(p) => (p.selected ? "700" : "500")}; + } } - } - .cancel-button { - display: flex; - - width: 100%; - flex-direction: row-reverse; - - h1 { - cursor: pointer; - font-weight: 900; - text-align: center; - font-size: 24px; + img { + width: 20px !important; + height: 20px !important; + margin: 5px 5px 0 5px; + object-fit: cover; + border-radius: 50%; } - span { + .desc { + p { + overflow: hidden; + color: #FFF; + text-overflow: ellipsis; + font-family: "Helvetica Neue"; + font-size: 12px; + font-style: normal; + font-weight: 500; + line-height: 137%; /* 16.44px */ + } + } + .banned { + gap: 8px; + padding: 12px 30px; + border-radius: 32px; + border: 0.357px solid #F77; + background: #F77; + color: #fff; text-align: center; + + font-family: Helvetica Neue; + font-size: 16px; + font-weight: 500; + cursor: not-allowed; + } + .won { + display: flex; + width: max-content; + padding: 8px 20px; + border-radius: 32px; + border: 1px solid #3bd07f; + background: #e4fff0; + gap: 8px; + color: #3bd07f; + font-family: Helvetica Neue; + font-size: 16px; + margin-right: 40px; + font-weight: 700; + } + .disabled { + height: 48px; + gap: 8px; + width: max-content; color: #b0b0b0; + font-size: 12px; + font-style: normal; + font-weight: 500; + border: 2px solid #b0b0b0; + background: none; + border-radius: 32px; + cursor: not-allowed; + padding: 0 10px; + text-transform: uppercase; + font-family: Helvetica Neue; + margin-bottom: 10px; } - } -} -.submit-header { - h1 { - font-size: 25px; - text-transform: uppercase; - font-weight: 700; - } -} -`; + .disabled:hover { + background: none; + border-color: #b0b0b0; + color: #b0b0b0; + } + @media (max-width: 700px) { + .header-title { + font-size: 25px; + } + p { + font-size: 15px; + } + } +` + const handleVoteClick = () => { Near.call( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "vote", { submission_owner: props.owner, @@ -400,7 +518,7 @@ const formatTime = (time) => { }; const winnerDetails = Near.view( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "get_winner_payout_info", { subscribe: true, @@ -410,7 +528,7 @@ const winnerDetails = Near.view( ); const totalUsersVoted = Near.view( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "get_all_user_voted", { subscribe: true, @@ -524,7 +642,7 @@ function handleCreateProposal() { deposit: deposit }, { - contractName: "fund-vf.genadrop.near", + contractName: "fund-beta.genadrop.near", methodName: "set_payout_proposal_id", args: { contest_id: Number(props?.contestId), @@ -540,6 +658,12 @@ const notOwner = nftData?.owner && props?.owner !== nftData?.owner const userVoted = totalUsersVoted.includes(context.accountId) +const adminLists = ['genadrop.near', 'agwaze.near', 'minorityprogrammers.near', 'bashorun.near'] + +const userProfileImage = (profile) => { + const getProfile = Social.get(`${profile}/profile/**`, "final") + return getProfile.image ? getProfile.image.ipfs_cid : "bafkreih6spncoy6jyx2f46yxektxz44mmfq2juz4dvc36p7w5xwcnaqira" +}; return ( - + setOpenModal(true)} alt="" />
Owner no longer owns the NFT

)} -

{props?.content?.votes} Vote(s)

+ {/*
+ {adminLists.slice(0, 2).map((data, index) => )} +
+ {props?.content?.votes &&

{props?.content?.votes ? adminLists.length - 2 : 0 } other Vote(s)

} */} {openModal && ( - +
-

setOpenModal(false)}> - X -

-
-
-

Update Winner Details With Proposal ID

- This would enable us to pull that proposal for this user so voting can commence - setWinnerProposalId(e.target.value)} type="number" /> - + setOpenModal(false)} src={`https://ipfs.near.social/ipfs/bafkreifmoedfc7x34ly2q2qwqzyke4rpsmxvdudbjscsoljt3afmq7h3re`} />
- + + + +

{props?.content?.title}

+
+ +

+ NFT by {profileImage?.image?.ipfs_cid ? : ""} {props?.owner} +

+
+ +

+ {formatTime(props?.content?.timestamp)} +

+
+
+

{nftData?.description ?? ""}

+
+ +
)} diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Content.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Content.jsx index dbb1b729..3e941f69 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Content.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Content.jsx @@ -131,10 +131,6 @@ return ( {searchSvg} - {/* - Filter - - */} {searchValue === '' ? userArts?.map((data, index) => ( diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/FilterOption.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/FilterOption.jsx index da8ae06c..4c610c40 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/FilterOption.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/FilterOption.jsx @@ -73,8 +73,8 @@ State.init({ const options = [ { value: "A-Z", label: "A-Z" }, { value: "Z-A", label: "Z-A" }, - { value: "oldest", label: "Oldest" }, - { value: "latest", label: "Latest" }, + { value: "Oldest", label: "Oldest" }, + { value: "Latest", label: "Latest" }, ] diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx index 474193f4..94d31294 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Index.jsx @@ -22,6 +22,27 @@ const ExploreRoot = styled.div` margin-right: auto; margin-top: 40px; .header { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + flex-wrap: wrap; + a { + background: #000; + border: 1px solid #000; + color: #fff; + width: max-width; + padding: 9px; + border-radius: 8px; + transition: 0.4s ease-in-out; + text-decoration: none; + } + a:hover { + background: #fff; + color: #000; + border: 1px solid #000; + } h1 { color: var(--Black, #000); leading-trim: both; @@ -33,8 +54,10 @@ const ExploreRoot = styled.div` line-height: normal; } @media (max-width: 500px) { + gap: 20px; + justify-content: center; h1 { - font-size: 30px; + font-size: 28px; } } } @@ -192,7 +215,7 @@ const isFutureTimestamp = (timestamp) => { }; const fetchedContests = - Near.view("fund-vf.genadrop.near", "get_contests", { + Near.view("fund-beta.genadrop.near", "get_contests", { subscribe: true, }) || []; @@ -275,11 +298,23 @@ const searchInputHandler = (e) => { setFilteredValue(searched) } +const adminLists = ['genadrop.near', 'agwaze.near', 'minorityprogrammers.near', 'bashorun.near'] + +const isAdmin = adminLists.includes(context.accountId) + return (
diff --git a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Rules.jsx b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Rules.jsx index b05e84b9..8e02b2e6 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-vf.genadrop.near", + "fund-beta.genadrop.near", "submit_art", { nft_contract_id: nft_data.contractId, @@ -370,7 +370,7 @@ const handleArtSelection = (nft_data) => { }; const totalUsersVoted = Near.view( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "get_all_user_voted", { subscribe: true, @@ -381,7 +381,7 @@ const totalUsersVoted = Near.view( const handleFinalize = () => { Near.call( - "fund-vf.genadrop.near", + "fund-beta.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 7d7669da..002c82cf 100644 --- a/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/DropsFund/Contest/Single.jsx @@ -262,13 +262,20 @@ if(!contestId) { ) } -const contest = Near.view("fund-vf.genadrop.near", "get_contest_detail", { +const contest = Near.view("fund-beta.genadrop.near", "get_contest_detail", { contest_id: Number(contestId), subscribe: true, }); +if(!contestId && !contest) { + return ( +
No ContestId Provided, Please Redirect to the Contest Overview page and Select a Contest
+ ) +} + + -const contestArts = Near.view("fund-vf.genadrop.near", "get_contest_arts", { +const contestArts = Near.view("fund-beta.genadrop.near", "get_contest_arts", { contest_id: Number(contestId), subscribe: true, }); diff --git a/apps/BosGenaDrop/widget/CPlanet/Profile/Editor.jsx b/apps/BosGenaDrop/widget/CPlanet/Profile/Editor.jsx index b2850374..d90b99ac 100644 --- a/apps/BosGenaDrop/widget/CPlanet/Profile/Editor.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/Profile/Editor.jsx @@ -207,12 +207,7 @@ return ( }, ], }, - feed: { - label: "Accounts To Display", - pageFeedPattern: "*/profile/*", - placeholder: - "rust, engineer, artist, humanguild, nft, learner, founder", - }, + }, }} /> diff --git a/apps/BosGenaDrop/widget/CPlanet/Profile/Large.jsx b/apps/BosGenaDrop/widget/CPlanet/Profile/Large.jsx index 16c22fe2..9d5c1aa4 100644 --- a/apps/BosGenaDrop/widget/CPlanet/Profile/Large.jsx +++ b/apps/BosGenaDrop/widget/CPlanet/Profile/Large.jsx @@ -90,12 +90,12 @@ return ( > {showEditButton && ( )}
@@ -105,12 +105,12 @@ return ( > {showEditButton && ( )} diff --git a/apps/BosGenaDrop/widget/DropFlow/CreatePage/Bet.jsx b/apps/BosGenaDrop/widget/DropFlow/CreatePage/Bet.jsx index 11da1ba6..e6904aea 100644 --- a/apps/BosGenaDrop/widget/DropFlow/CreatePage/Bet.jsx +++ b/apps/BosGenaDrop/widget/DropFlow/CreatePage/Bet.jsx @@ -1,4 +1,4 @@ -const accountId = context.accountId; +const accountId = props.accountId ?? context.accountId; const widgetOwner = "jgodwill.near"; if (!accountId) { @@ -25,14 +25,16 @@ State.init({ image: initialMetadata.image, backgroundImage: initialMetadata.backgroundImage, screenshots: initialMetadata.screenshots ?? {}, - collectionContractId: null, collectionContractIdIsValid: false, nftTokenId: null, nftContractId: null, isValidCummunityContractId: false, disabled: false, portfolioImage: {}, - nftsObject: initialMetadata.pageNFTs.data ?? {}, + nftsArray: + initialMetadata.pageNFTs.type === "single" + ? initialMetadata.pageNFTs.content + : [], pageNFTs: initialMetadata.pageNFTs ?? {}, feedTabs: initialMetadata.feedTabs ?? {}, discussion: initialMetadata.discussion ?? {}, @@ -107,8 +109,11 @@ const [discussionNFTContractId, setDiscussionNFTContractId] = useState(null); const [discussionType, setDiscussionType] = useState( state.initialMetadata.discussion.type ?? null ); -const [nftOrCollectionActive, setNFTOrCollectionActive] = useState(null); -const [collectionContractId, setCollectionContractId] = useState(null); +const [collectionContractId, setCollectionContractId] = useState( + initialMetadata.pageNFTs.type === "collection" + ? JSON.parse(initialMetadata.pageNFTs.content) + : [] +); const [createPoll, setCreatePoll] = useState(false); const [isLoading, setIsLoading] = useState(false); const [doc, setDoc] = useState(null); @@ -117,6 +122,7 @@ const [portfolioEntryTitle, setPortfolioEntryTitle] = useState(null); const [portfolioEntryText, setPortfolioEntryText] = useState( "Enter your portfolio content here" ); +const [allCollections, setAllCollections] = useState(null); function generateUID() { const maxHex = 0xffffffff; @@ -126,6 +132,8 @@ function generateUID() { return randomNumber.toString(16).padStart(8, "0"); } +console.log("single or collection active: ", singleOrCollectionActive); + const tabsData = [ { name: "Feed", @@ -158,7 +166,7 @@ const tabsData = [ function stringArrayToObject(stringArray) { return stringArray.reduce((obj, stringValue) => { - obj[stringValue.toLowerCase()] = ""; + obj[stringValue && stringValue.toLowerCase()] = ""; return obj; }, {}); } @@ -175,27 +183,33 @@ const handleTabChange = (tabName) => { : [...selectedTabNames, tabName] ); }; -console.log("selectedTabNames: ", selectedTabNames); -console.log("contains nfts? ", selectedTabNames.includes("nfts")); +// console.log("selectedTabNames: ", selectedTabNames); +// console.log("contains nfts? ", selectedTabNames.includes("nfts")); + +console.log("collectioninitial: ", collectionContractId); const FeedTabs = () => { + // I need to add logic to disable a tab (for users who aren't human, and propbably add a toolti when it's disabled with a help message) return (
{tabsData.map((tab) => { const { name, desc } = tab; - name = name.toLowerCase(); + const lowerCaseName = name.toLowerCase(); return ( - +
handleTabChange(name)} + id={lowerCaseName} + name={lowerCaseName} + checked={selectedTabNames.includes(lowerCaseName)} + onChange={() => handleTabChange(lowerCaseName)} className="form-check-input rounded-circle" /> - +

{desc}

@@ -220,7 +234,7 @@ const TabCard = styled.div` background: ${({ active }) => (active ? "#000" : "#fff")}; color: ${({ active }) => (active ? "#fff" : "#000")}; border: 1px solid #000; - max-width: 464px; + // max-width: 464px; .cardTop { display: flex; align-items: center; @@ -250,11 +264,11 @@ const Wrapper = styled.div` .tabsGrid { display: grid; grid-template-columns: repeat(2, 1fr); - gap: 16px; + row-gap: 16px; + column-gap: 28px; margin: 0 auto; align-items: center; justify-content: center; - align-content: center; width: 100%; @media (max-width: 768px) { grid-template-columns: repeat(1, 1fr); @@ -567,12 +581,13 @@ const Search = styled.div` flex-shrink: 0; height: 48px; width: 100%; + max-width: 500px; + padding: 0 16px; background: #f8f8f8; overflow: hidden; color: #b0b0b0; text-overflow: ellipsis; font-family: Helvetica Neue; - font-size: 20px; font-style: normal; font-weight: 400; line-height: 148%; /* 29.6px */ @@ -593,29 +608,53 @@ for (let i = 0; i < accounts.length; ++i) { allWidgets.push(accountId); } +const fetchCollections = () => { + const response = fetch("https://graph.mintbase.xyz/mainnet", { + method: "POST", + headers: { + "mb-api-key": "anon", + "Content-Type": "application/json", + }, + body: JSON.stringify({ + query: `query SearchCollections { + nft_contracts(order_by: {id: asc}) { + id + } + } +`, + }), + }); + let collections = response?.body?.data?.nft_contracts; + return collections; +}; + +if (accountId) { + const fetchedCollections = fetchCollections(); + // Extract id values and create a new list + const ids = + fetchedCollections && + fetchedCollections?.map((collection) => collection.id); + setAllCollections(ids); +} + const nftDataChangeHandler = (chain, tokenId, contractId) => { - const uniqueHex = generateUID(); - const nftId = `${chain.toLowerCase()}${uniqueHex}`; State.update({ nftTokenId: tokenId, nftContractId: contractId, chain: chain, - nftsObject: { - ...state.nftsObject, - [nftId]: { chain, tokenId, contractId }, - }, + nftsArray: [...state.nftsArray, { chain, tokenId, contractId }], metadata: { ...state.metadata, pageNFTs: { ...state.metadata.pageNFTs, type: singleOrCollectionActive, - data: state.nftsObject, + content: state.nftsArray, }, }, }); console.log("NFTtokenId:", state.nftTokenId); console.log("NFTcontractId:", state.nftContractId); - console.log("nftsObject:", state.nftsObject); + console.log("nftsArray:", state.nftsArray); }; // if (!state.metadata.pageNFTs.type || !state.initialMetadata.pageNFTs) { @@ -634,6 +673,21 @@ const onChangeAccount = (account) => { }); }; +const onChangeCollection = (address) => { + setCollectionContractId(address); + State.update({ + metadata: { + ...state.metadata, + pageNFTs: { + ...state.metadata.pageNFTs, + type: singleOrCollectionActive, + content: collectionContractId, + }, + }, + }); + console.log("Address: ", address); +}; + // console.log("tokenId and accoutId: ", state.nftTokenId); const Card = styled.div` @@ -713,14 +767,13 @@ function isNearAddress(address) { } const nftOrCollectionSwitchHandler = (clickedButtonId) => { - if (clickedButtonId === "nft") { - setNFTOrCollectionActive(null); - setSingleOrCollectionActive("single"); + if (clickedButtonId === "single") { + setSingleOrCollectionActive(null); } else if (clickedButtonId === "collection") { - setNFTOrCollectionActive(null); - state.nftsObject = {}; - setSingleOrCollectionActive(clickedButtonId); + setSingleOrCollectionActive(null); + state.nftsArray = []; } + setSingleOrCollectionActive(clickedButtonId); setCollectionContractId(null); State.update({ metadata: { @@ -728,11 +781,10 @@ const nftOrCollectionSwitchHandler = (clickedButtonId) => { pageNFTs: { ...state.metadata.pageNFTs, type: singleOrCollectionActive, - data: undefined, + content: undefined, }, }, }); - setNFTOrCollectionActive(clickedButtonId); }; singleOrCollectionActive && !collectionContractId; @@ -742,31 +794,11 @@ State.update({ pageNFTs: { ...state.metadata.pageNFTs, type: singleOrCollectionActive, - data: collectionContractId ? collectionContractId : state.nftsObject, + content: collectionContractId ? collectionContractId : state.nftsArray, }, }, }); -const collectionContractIdHandler = (e) => { - // e.preventDefault(); - const { value } = e.target; - const validNearAdress = isNearAddress(value); - console.log("collectionContractId: ", value); - setCollectionContractId(value); - - State.update({ - metadata: { - ...state.metadata, - pageNFTs: { - ...state.metadata.pageNFTs, - type: singleOrCollectionActive, - data: value, - }, - }, - collectionContractIdIsValid: validNearAdress, - }); -}; - const onChangeDisabled = (e) => { // e.preventDefault(); const { checked } = e.target; @@ -793,12 +825,8 @@ const getFirstSBTToken = () => { return view?.[0]?.[1]?.[0]; }; -console.log("isValidcollectionContractId? ", state.collectionContractIdIsValid); - const hasSBTToken = getFirstSBTToken() !== undefined; -// console.log("clicked: ", nftOrCollectionActive); - const [fileData, setFileData] = useState(null); const portfolioDocHandler = (files) => { @@ -815,6 +843,11 @@ const portfolioDocHandler = (files) => { setMsg("Attach a file"); }; +const portfolioEntryTitleHandler = (e) => { + const { value } = e.target; + setPortfolioEntryTitle(value); +}; + const addPortfolioEntryHandler = () => { const entryId = generateUID(); const portfolioEntry = { @@ -856,7 +889,7 @@ const addPortfolioEntryHandler = () => { const imagetooltip = Upload an image; return ( - +

Customize your Page

Select the Tabs that you want to display
@@ -943,7 +976,7 @@ return (
{discussionType === "hashtag" && (
-

{options.tags.label ?? "Create Hashtags"}

+

Create Hashtags

- {nftOrCollectionActive === "nft" && ( + {singleOrCollectionActive === "single" && (
Near Wallet Address: @@ -1069,11 +1105,10 @@ return ( id="type" className="type-ahead" isLoading={isLoading} - labelKey="search" + labelKey="single" options={allWidgets} onChange={(value) => onChangeAccount(value)} placeholder={accountId} - allowNew value={state.account} /> @@ -1116,25 +1151,24 @@ return (
)} - {nftOrCollectionActive === "collection" && ( + {singleOrCollectionActive === "collection" && ( //
Select Collection
- collectionContractIdHandler(e)} - value={collectionContractId} - /> + + onChangeCollection(v)} + placeholder={"Enter or select the NFT contract address"} + selected={collectionContractId} + /> +
)}
@@ -1306,7 +1340,7 @@ return ( name="portfoliotitle" className="txt w-100" placeholder="Enter the title of the portfolio" - onChange={(e) => setPortfolioEntryTitle(e.target.value)} + onChange={(e) => portfolioEntryTitleHandler(e)} value={portfolioEntryTitle} /> @@ -1378,15 +1412,20 @@ return (
) } - - Save Page - - {/* */} +
+ + Save Page + + + View Page + +
); diff --git a/build/BosGenaDrop/src/CPlanet/DAO/Index.jsx b/build/BosGenaDrop/src/CPlanet/DAO/Index.jsx index 35a003a0..0ab16eda 100644 --- a/build/BosGenaDrop/src/CPlanet/DAO/Index.jsx +++ b/build/BosGenaDrop/src/CPlanet/DAO/Index.jsx @@ -329,6 +329,8 @@ policy?.roles?.length && members = [...new Set(members)]; // -- +if(!policy) return

Not a Valid DAO

+ function makeAccountIdShorter(accountId) { if (accountId.length > shortenLength) { return accountId.slice(0, shortenLength) + "..."; diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Index.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Index.jsx index aee47a25..d7ba27a4 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Index.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Index.jsx @@ -40,13 +40,20 @@ const Root = styled.div` margin-top: 30px; } } + .error { + color: red; + font-size: 14px; + + } ` const [contestName, setName] = useState("") const [description, setDescription] = useState("") const [daoId, setDaoId] = useState("") const [price, setPrice] = useState(0) +const [dateError, setDateError] = useState(false) const [places, setPlaces] = useState(0) +const [daoIdError, setDaoIdError] = useState(false) const [minArtVote, setMinArtVote] = useState(0) const [submissionStart, setSubmissionStart] = useState("") const [submissionEnd, setSubmissionEnd] = useState("") @@ -64,13 +71,32 @@ function convertToTimestamp(dateString) { return unixTimestamp; } +const policy = Near.view(daoId.trim(), "get_policy"); + const handleSubmit = () => { - Near.call("fund-vf.genadrop.near", + if(!policy) return setDaoIdError(true) + const submissionStartTimeStamp = convertToTimestamp(submissionStart); + const submissionEndTimeStamp = convertToTimestamp(submissionEnd); + const votingStartTimeStamp = convertToTimestamp(votingStart); + const votingEndTimeStamp = convertToTimestamp(votingEnd); + + // Validation checks + if ( + !submissionStart || !submissionEnd || !votingStart || !votingEnd || + submissionStartTimeStamp >= submissionEndTimeStamp || + votingStartTimeStamp >= votingEndTimeStamp || + submissionEndTimeStamp >= votingStartTimeStamp + ) { + return setDateError(true); + } + + + Near.call("fund-beta.genadrop.near", "create_contest", { title: contestName, description, - dao_id: daoId, + dao_id: daoId.trim(), logo_url: "https://picsum.photos/200/300.jpg", submission_start_time: convertToTimestamp(submissionStart), submission_end_time: convertToTimestamp(submissionEnd), @@ -103,6 +129,7 @@ return (
setDaoId(e.target.value)} required /> + {daoIdError && Invalid DAO ID}
@@ -137,6 +164,7 @@ return ( setVotingEnd(e.target.value)} type="datetime-local" required />
+ {dateError && Invalid Date: Note that Voting time cannot be less than submission time and Start time cannot be less than End time.}
diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Payout.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Admin/Payout.jsx index 7fdec895..9d2c7226 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-vf.genadrop.near", + Near.call("fund-beta.genadrop.near", "set_payout_proposal_id", { contest_id: Number(contestId), diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx index 55ae42a3..9dea1352 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Card.jsx @@ -70,6 +70,7 @@ const Image = styled.div` border-radius: 6px; height: 100%; object-fit: cover; + cursor: pointer; } @media (max-width: 500px) { width: 250px; @@ -165,6 +166,18 @@ const StartedButton = styled.div` justify-content: space-between; align-items: center; width: 132px; + .imageContainer { + display: flex; + align-items: center; + img { + width: 24px; + margin-right: -10px; + height: 24px; + border-radius: 30px; + border: 1px solid #F8F8F8; + background: url(), lightgray 50% / cover no-repeat; + } + } .bannedUser { display: flex; margin-top: 5px; @@ -289,89 +302,194 @@ const Popup = styled.div` height: 100%; background-color: rgba(0, 0, 0, 0.5); display: flex; - align-items: center; justify-content: center; - backdrop-filter: blur(5px); /* Apply background blur */ + backdrop-filter: blur(5px); z-index: 9999; `; const PopupContent = styled.div` - background-color: #fff; - padding: 20px; + position: relative; /* Add this line */ border-radius: 5px; align-items: center; - max-width: 500px; - height: 400px; display: flex; flex-direction: column; - width: 100%; - box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); - .modal-content { + width: 881px; + height: 881px; + flex-shrink: 0; + border-radius: 16px; + background: #ECECEC; + box-shadow: 4px 4px 40px 32px rgba(0, 0, 0, 0.12); + display: flex; + flex-direction: column; + justify-content: space-between; + padding: 20px; + .cancel-button { display: flex; - flex-direction: column; - align-items: center; - span { - text-align: center; - color: #b0b0b0; + width: 100%; + flex-direction: row-reverse; + img { + cursor: pointer; + transition: 0.5s ease-in-out; } - h1 { - text-align: center; - font-size: 22px; - font-weight: 600; + img:hover { + opacity: 0.7; } - input { - width: 80%; - margin: 40px 0; + } + @media (max-width: 900px) { + width: 95%; + height: 75%; + .cancel-button { + img { + width: 50px; + height: 50px; + } } - button { - border-radius: 12px; - width: 150px; - border: 1px solid #000; + } +`; + +const FadeIn = styled.div` + position: absolute; + bottom: 0; + left: 0; + right: 0; + top: auto; + height: 450px; + background-color: #000; + z-index: 99; + mask-image: linear-gradient(to bottom, transparent, white 100%, transparent); +`; + +const TextContent = styled.div` + position: relative; + z-index: 99999; + color: rgba(0, 0, 0, 1); /* Set the desired text color */ + display: flex; + flex-direction: column; + width: 100%; + align-items: flex-start; + + .header-title{ + color: #FFF; + leading-trim: both; + text-edge: cap; + font-family: "Helvetica Neue"; + font-size: 32px; + font-style: normal; + font-weight: 500; + line-height: normal; + } + .headerName { + display: flex; + flex-wrap: wrap; + align-items: center; + } + .dots { + width: 7px; + height: 7px; + margin-bottom: 13px; + margin-right: 5px; + margin-left: 5px; background: #fff; - color: #000; - font-size: 12px; - transition: .6s ease-in-out; - font-weight: 700; - padding: 10px 15px; - margin: 10px 0; - text-transform: uppercase; + border-radius: 50%; } - button:hover { - background: #000; + p { color: #fff; + font-family: Helvetica Neue; + display: flex; + align-item: center; + font-size: 20px; + font-style: normal; + font-weight: 500; + line-height: normal + span { + color: ${(p) => (p.selected ? "#3BD07F" : "#b0b0b0")}; + font-weight: ${(p) => (p.selected ? "700" : "500")}; + } } - } - .cancel-button { - display: flex; - - width: 100%; - flex-direction: row-reverse; - - h1 { - cursor: pointer; - font-weight: 900; - text-align: center; - font-size: 24px; + img { + width: 20px !important; + height: 20px !important; + margin: 5px 5px 0 5px; + object-fit: cover; + border-radius: 50%; } - span { + .desc { + p { + overflow: hidden; + color: #FFF; + text-overflow: ellipsis; + font-family: "Helvetica Neue"; + font-size: 12px; + font-style: normal; + font-weight: 500; + line-height: 137%; /* 16.44px */ + } + } + .banned { + gap: 8px; + padding: 12px 30px; + border-radius: 32px; + border: 0.357px solid #F77; + background: #F77; + color: #fff; text-align: center; + + font-family: Helvetica Neue; + font-size: 16px; + font-weight: 500; + cursor: not-allowed; + } + .won { + display: flex; + width: max-content; + padding: 8px 20px; + border-radius: 32px; + border: 1px solid #3bd07f; + background: #e4fff0; + gap: 8px; + color: #3bd07f; + font-family: Helvetica Neue; + font-size: 16px; + margin-right: 40px; + font-weight: 700; + } + .disabled { + height: 48px; + gap: 8px; + width: max-content; color: #b0b0b0; + font-size: 12px; + font-style: normal; + font-weight: 500; + border: 2px solid #b0b0b0; + background: none; + border-radius: 32px; + cursor: not-allowed; + padding: 0 10px; + text-transform: uppercase; + font-family: Helvetica Neue; + margin-bottom: 10px; } - } -} -.submit-header { - h1 { - font-size: 25px; - text-transform: uppercase; - font-weight: 700; - } -} -`; + .disabled:hover { + background: none; + border-color: #b0b0b0; + color: #b0b0b0; + } + @media (max-width: 700px) { + .header-title { + font-size: 25px; + } + p { + font-size: 15px; + } + } +` + const handleVoteClick = () => { Near.call( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "vote", { submission_owner: props.owner, @@ -400,7 +518,7 @@ const formatTime = (time) => { }; const winnerDetails = Near.view( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "get_winner_payout_info", { subscribe: true, @@ -410,7 +528,7 @@ const winnerDetails = Near.view( ); const totalUsersVoted = Near.view( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "get_all_user_voted", { subscribe: true, @@ -524,7 +642,7 @@ function handleCreateProposal() { deposit: deposit }, { - contractName: "fund-vf.genadrop.near", + contractName: "fund-beta.genadrop.near", methodName: "set_payout_proposal_id", args: { contest_id: Number(props?.contestId), @@ -540,6 +658,12 @@ const notOwner = nftData?.owner && props?.owner !== nftData?.owner const userVoted = totalUsersVoted.includes(context.accountId) +const adminLists = ['genadrop.near', 'agwaze.near', 'minorityprogrammers.near', 'bashorun.near'] + +const userProfileImage = (profile) => { + const getProfile = Social.get(`${profile}/profile/**`, "final") + return getProfile.image ? getProfile.image.ipfs_cid : "bafkreih6spncoy6jyx2f46yxektxz44mmfq2juz4dvc36p7w5xwcnaqira" +}; return ( - + setOpenModal(true)} alt="" />
Owner no longer owns the NFT

)} -

{props?.content?.votes} Vote(s)

+ {/*
+ {adminLists.slice(0, 2).map((data, index) => )} +
+ {props?.content?.votes &&

{props?.content?.votes ? adminLists.length - 2 : 0 } other Vote(s)

} */} {openModal && ( - +
-

setOpenModal(false)}> - X -

-
-
-

Update Winner Details With Proposal ID

- This would enable us to pull that proposal for this user so voting can commence - setWinnerProposalId(e.target.value)} type="number" /> - + setOpenModal(false)} src={`https://ipfs.near.social/ipfs/bafkreifmoedfc7x34ly2q2qwqzyke4rpsmxvdudbjscsoljt3afmq7h3re`} />
- + + + +

{props?.content?.title}

+
+ +

+ NFT by {profileImage?.image?.ipfs_cid ? : ""} {props?.owner} +

+
+ +

+ {formatTime(props?.content?.timestamp)} +

+
+
+

{nftData?.description ?? ""}

+
+ +
)} diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Content.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Content.jsx index dbb1b729..3e941f69 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Content.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Content.jsx @@ -131,10 +131,6 @@ return ( {searchSvg} - {/* - Filter - - */} {searchValue === '' ? userArts?.map((data, index) => ( diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/FilterOption.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/FilterOption.jsx index da8ae06c..4c610c40 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/FilterOption.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/FilterOption.jsx @@ -73,8 +73,8 @@ State.init({ const options = [ { value: "A-Z", label: "A-Z" }, { value: "Z-A", label: "Z-A" }, - { value: "oldest", label: "Oldest" }, - { value: "latest", label: "Latest" }, + { value: "Oldest", label: "Oldest" }, + { value: "Latest", label: "Latest" }, ] diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx index 474193f4..94d31294 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Index.jsx @@ -22,6 +22,27 @@ const ExploreRoot = styled.div` margin-right: auto; margin-top: 40px; .header { + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-between; + width: 100%; + flex-wrap: wrap; + a { + background: #000; + border: 1px solid #000; + color: #fff; + width: max-width; + padding: 9px; + border-radius: 8px; + transition: 0.4s ease-in-out; + text-decoration: none; + } + a:hover { + background: #fff; + color: #000; + border: 1px solid #000; + } h1 { color: var(--Black, #000); leading-trim: both; @@ -33,8 +54,10 @@ const ExploreRoot = styled.div` line-height: normal; } @media (max-width: 500px) { + gap: 20px; + justify-content: center; h1 { - font-size: 30px; + font-size: 28px; } } } @@ -192,7 +215,7 @@ const isFutureTimestamp = (timestamp) => { }; const fetchedContests = - Near.view("fund-vf.genadrop.near", "get_contests", { + Near.view("fund-beta.genadrop.near", "get_contests", { subscribe: true, }) || []; @@ -275,11 +298,23 @@ const searchInputHandler = (e) => { setFilteredValue(searched) } +const adminLists = ['genadrop.near', 'agwaze.near', 'minorityprogrammers.near', 'bashorun.near'] + +const isAdmin = adminLists.includes(context.accountId) + return (
diff --git a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Rules.jsx b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Rules.jsx index b05e84b9..8e02b2e6 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-vf.genadrop.near", + "fund-beta.genadrop.near", "submit_art", { nft_contract_id: nft_data.contractId, @@ -370,7 +370,7 @@ const handleArtSelection = (nft_data) => { }; const totalUsersVoted = Near.view( - "fund-vf.genadrop.near", + "fund-beta.genadrop.near", "get_all_user_voted", { subscribe: true, @@ -381,7 +381,7 @@ const totalUsersVoted = Near.view( const handleFinalize = () => { Near.call( - "fund-vf.genadrop.near", + "fund-beta.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 7d7669da..002c82cf 100644 --- a/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx +++ b/build/BosGenaDrop/src/CPlanet/DropsFund/Contest/Single.jsx @@ -262,13 +262,20 @@ if(!contestId) { ) } -const contest = Near.view("fund-vf.genadrop.near", "get_contest_detail", { +const contest = Near.view("fund-beta.genadrop.near", "get_contest_detail", { contest_id: Number(contestId), subscribe: true, }); +if(!contestId && !contest) { + return ( +
No ContestId Provided, Please Redirect to the Contest Overview page and Select a Contest
+ ) +} + + -const contestArts = Near.view("fund-vf.genadrop.near", "get_contest_arts", { +const contestArts = Near.view("fund-beta.genadrop.near", "get_contest_arts", { contest_id: Number(contestId), subscribe: true, }); diff --git a/build/BosGenaDrop/src/CPlanet/Profile/Editor.jsx b/build/BosGenaDrop/src/CPlanet/Profile/Editor.jsx index b2850374..d90b99ac 100644 --- a/build/BosGenaDrop/src/CPlanet/Profile/Editor.jsx +++ b/build/BosGenaDrop/src/CPlanet/Profile/Editor.jsx @@ -207,12 +207,7 @@ return ( }, ], }, - feed: { - label: "Accounts To Display", - pageFeedPattern: "*/profile/*", - placeholder: - "rust, engineer, artist, humanguild, nft, learner, founder", - }, + }, }} /> diff --git a/build/BosGenaDrop/src/CPlanet/Profile/Large.jsx b/build/BosGenaDrop/src/CPlanet/Profile/Large.jsx index c1640554..5e715498 100644 --- a/build/BosGenaDrop/src/CPlanet/Profile/Large.jsx +++ b/build/BosGenaDrop/src/CPlanet/Profile/Large.jsx @@ -90,12 +90,12 @@ return ( > {showEditButton && ( )}
@@ -105,12 +105,12 @@ return ( > {showEditButton && ( )}
diff --git a/build/BosGenaDrop/src/DropFlow/CreatePage/Bet.jsx b/build/BosGenaDrop/src/DropFlow/CreatePage/Bet.jsx index 11da1ba6..e6904aea 100644 --- a/build/BosGenaDrop/src/DropFlow/CreatePage/Bet.jsx +++ b/build/BosGenaDrop/src/DropFlow/CreatePage/Bet.jsx @@ -1,4 +1,4 @@ -const accountId = context.accountId; +const accountId = props.accountId ?? context.accountId; const widgetOwner = "jgodwill.near"; if (!accountId) { @@ -25,14 +25,16 @@ State.init({ image: initialMetadata.image, backgroundImage: initialMetadata.backgroundImage, screenshots: initialMetadata.screenshots ?? {}, - collectionContractId: null, collectionContractIdIsValid: false, nftTokenId: null, nftContractId: null, isValidCummunityContractId: false, disabled: false, portfolioImage: {}, - nftsObject: initialMetadata.pageNFTs.data ?? {}, + nftsArray: + initialMetadata.pageNFTs.type === "single" + ? initialMetadata.pageNFTs.content + : [], pageNFTs: initialMetadata.pageNFTs ?? {}, feedTabs: initialMetadata.feedTabs ?? {}, discussion: initialMetadata.discussion ?? {}, @@ -107,8 +109,11 @@ const [discussionNFTContractId, setDiscussionNFTContractId] = useState(null); const [discussionType, setDiscussionType] = useState( state.initialMetadata.discussion.type ?? null ); -const [nftOrCollectionActive, setNFTOrCollectionActive] = useState(null); -const [collectionContractId, setCollectionContractId] = useState(null); +const [collectionContractId, setCollectionContractId] = useState( + initialMetadata.pageNFTs.type === "collection" + ? JSON.parse(initialMetadata.pageNFTs.content) + : [] +); const [createPoll, setCreatePoll] = useState(false); const [isLoading, setIsLoading] = useState(false); const [doc, setDoc] = useState(null); @@ -117,6 +122,7 @@ const [portfolioEntryTitle, setPortfolioEntryTitle] = useState(null); const [portfolioEntryText, setPortfolioEntryText] = useState( "Enter your portfolio content here" ); +const [allCollections, setAllCollections] = useState(null); function generateUID() { const maxHex = 0xffffffff; @@ -126,6 +132,8 @@ function generateUID() { return randomNumber.toString(16).padStart(8, "0"); } +console.log("single or collection active: ", singleOrCollectionActive); + const tabsData = [ { name: "Feed", @@ -158,7 +166,7 @@ const tabsData = [ function stringArrayToObject(stringArray) { return stringArray.reduce((obj, stringValue) => { - obj[stringValue.toLowerCase()] = ""; + obj[stringValue && stringValue.toLowerCase()] = ""; return obj; }, {}); } @@ -175,27 +183,33 @@ const handleTabChange = (tabName) => { : [...selectedTabNames, tabName] ); }; -console.log("selectedTabNames: ", selectedTabNames); -console.log("contains nfts? ", selectedTabNames.includes("nfts")); +// console.log("selectedTabNames: ", selectedTabNames); +// console.log("contains nfts? ", selectedTabNames.includes("nfts")); + +console.log("collectioninitial: ", collectionContractId); const FeedTabs = () => { + // I need to add logic to disable a tab (for users who aren't human, and propbably add a toolti when it's disabled with a help message) return (
{tabsData.map((tab) => { const { name, desc } = tab; - name = name.toLowerCase(); + const lowerCaseName = name.toLowerCase(); return ( - +
handleTabChange(name)} + id={lowerCaseName} + name={lowerCaseName} + checked={selectedTabNames.includes(lowerCaseName)} + onChange={() => handleTabChange(lowerCaseName)} className="form-check-input rounded-circle" /> - +

{desc}

@@ -220,7 +234,7 @@ const TabCard = styled.div` background: ${({ active }) => (active ? "#000" : "#fff")}; color: ${({ active }) => (active ? "#fff" : "#000")}; border: 1px solid #000; - max-width: 464px; + // max-width: 464px; .cardTop { display: flex; align-items: center; @@ -250,11 +264,11 @@ const Wrapper = styled.div` .tabsGrid { display: grid; grid-template-columns: repeat(2, 1fr); - gap: 16px; + row-gap: 16px; + column-gap: 28px; margin: 0 auto; align-items: center; justify-content: center; - align-content: center; width: 100%; @media (max-width: 768px) { grid-template-columns: repeat(1, 1fr); @@ -567,12 +581,13 @@ const Search = styled.div` flex-shrink: 0; height: 48px; width: 100%; + max-width: 500px; + padding: 0 16px; background: #f8f8f8; overflow: hidden; color: #b0b0b0; text-overflow: ellipsis; font-family: Helvetica Neue; - font-size: 20px; font-style: normal; font-weight: 400; line-height: 148%; /* 29.6px */ @@ -593,29 +608,53 @@ for (let i = 0; i < accounts.length; ++i) { allWidgets.push(accountId); } +const fetchCollections = () => { + const response = fetch("https://graph.mintbase.xyz/mainnet", { + method: "POST", + headers: { + "mb-api-key": "anon", + "Content-Type": "application/json", + }, + body: JSON.stringify({ + query: `query SearchCollections { + nft_contracts(order_by: {id: asc}) { + id + } + } +`, + }), + }); + let collections = response?.body?.data?.nft_contracts; + return collections; +}; + +if (accountId) { + const fetchedCollections = fetchCollections(); + // Extract id values and create a new list + const ids = + fetchedCollections && + fetchedCollections?.map((collection) => collection.id); + setAllCollections(ids); +} + const nftDataChangeHandler = (chain, tokenId, contractId) => { - const uniqueHex = generateUID(); - const nftId = `${chain.toLowerCase()}${uniqueHex}`; State.update({ nftTokenId: tokenId, nftContractId: contractId, chain: chain, - nftsObject: { - ...state.nftsObject, - [nftId]: { chain, tokenId, contractId }, - }, + nftsArray: [...state.nftsArray, { chain, tokenId, contractId }], metadata: { ...state.metadata, pageNFTs: { ...state.metadata.pageNFTs, type: singleOrCollectionActive, - data: state.nftsObject, + content: state.nftsArray, }, }, }); console.log("NFTtokenId:", state.nftTokenId); console.log("NFTcontractId:", state.nftContractId); - console.log("nftsObject:", state.nftsObject); + console.log("nftsArray:", state.nftsArray); }; // if (!state.metadata.pageNFTs.type || !state.initialMetadata.pageNFTs) { @@ -634,6 +673,21 @@ const onChangeAccount = (account) => { }); }; +const onChangeCollection = (address) => { + setCollectionContractId(address); + State.update({ + metadata: { + ...state.metadata, + pageNFTs: { + ...state.metadata.pageNFTs, + type: singleOrCollectionActive, + content: collectionContractId, + }, + }, + }); + console.log("Address: ", address); +}; + // console.log("tokenId and accoutId: ", state.nftTokenId); const Card = styled.div` @@ -713,14 +767,13 @@ function isNearAddress(address) { } const nftOrCollectionSwitchHandler = (clickedButtonId) => { - if (clickedButtonId === "nft") { - setNFTOrCollectionActive(null); - setSingleOrCollectionActive("single"); + if (clickedButtonId === "single") { + setSingleOrCollectionActive(null); } else if (clickedButtonId === "collection") { - setNFTOrCollectionActive(null); - state.nftsObject = {}; - setSingleOrCollectionActive(clickedButtonId); + setSingleOrCollectionActive(null); + state.nftsArray = []; } + setSingleOrCollectionActive(clickedButtonId); setCollectionContractId(null); State.update({ metadata: { @@ -728,11 +781,10 @@ const nftOrCollectionSwitchHandler = (clickedButtonId) => { pageNFTs: { ...state.metadata.pageNFTs, type: singleOrCollectionActive, - data: undefined, + content: undefined, }, }, }); - setNFTOrCollectionActive(clickedButtonId); }; singleOrCollectionActive && !collectionContractId; @@ -742,31 +794,11 @@ State.update({ pageNFTs: { ...state.metadata.pageNFTs, type: singleOrCollectionActive, - data: collectionContractId ? collectionContractId : state.nftsObject, + content: collectionContractId ? collectionContractId : state.nftsArray, }, }, }); -const collectionContractIdHandler = (e) => { - // e.preventDefault(); - const { value } = e.target; - const validNearAdress = isNearAddress(value); - console.log("collectionContractId: ", value); - setCollectionContractId(value); - - State.update({ - metadata: { - ...state.metadata, - pageNFTs: { - ...state.metadata.pageNFTs, - type: singleOrCollectionActive, - data: value, - }, - }, - collectionContractIdIsValid: validNearAdress, - }); -}; - const onChangeDisabled = (e) => { // e.preventDefault(); const { checked } = e.target; @@ -793,12 +825,8 @@ const getFirstSBTToken = () => { return view?.[0]?.[1]?.[0]; }; -console.log("isValidcollectionContractId? ", state.collectionContractIdIsValid); - const hasSBTToken = getFirstSBTToken() !== undefined; -// console.log("clicked: ", nftOrCollectionActive); - const [fileData, setFileData] = useState(null); const portfolioDocHandler = (files) => { @@ -815,6 +843,11 @@ const portfolioDocHandler = (files) => { setMsg("Attach a file"); }; +const portfolioEntryTitleHandler = (e) => { + const { value } = e.target; + setPortfolioEntryTitle(value); +}; + const addPortfolioEntryHandler = () => { const entryId = generateUID(); const portfolioEntry = { @@ -856,7 +889,7 @@ const addPortfolioEntryHandler = () => { const imagetooltip = Upload an image; return ( - +

Customize your Page

Select the Tabs that you want to display
@@ -943,7 +976,7 @@ return (
{discussionType === "hashtag" && (
-

{options.tags.label ?? "Create Hashtags"}

+

Create Hashtags

- {nftOrCollectionActive === "nft" && ( + {singleOrCollectionActive === "single" && (
Near Wallet Address: @@ -1069,11 +1105,10 @@ return ( id="type" className="type-ahead" isLoading={isLoading} - labelKey="search" + labelKey="single" options={allWidgets} onChange={(value) => onChangeAccount(value)} placeholder={accountId} - allowNew value={state.account} /> @@ -1116,25 +1151,24 @@ return (
)} - {nftOrCollectionActive === "collection" && ( + {singleOrCollectionActive === "collection" && ( //
Select Collection
- collectionContractIdHandler(e)} - value={collectionContractId} - /> + + onChangeCollection(v)} + placeholder={"Enter or select the NFT contract address"} + selected={collectionContractId} + /> +
)}
@@ -1306,7 +1340,7 @@ return ( name="portfoliotitle" className="txt w-100" placeholder="Enter the title of the portfolio" - onChange={(e) => setPortfolioEntryTitle(e.target.value)} + onChange={(e) => portfolioEntryTitleHandler(e)} value={portfolioEntryTitle} /> @@ -1378,15 +1412,20 @@ return (
) } - - Save Page - - {/* */} +
+ + Save Page + + + View Page + +
);