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
{props?.content?.votes} Vote(s)
+ {/*{props?.content?.votes ? adminLists.length - 2 : 0 } other Vote(s)
} */} {openModal && (
+ NFT by {profileImage?.image?.ipfs_cid ? : ""} {props?.owner}
+
+ {formatTime(props?.content?.timestamp)} +
+{nftData?.description ?? ""}
+{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 ={props?.content?.votes} Vote(s)
+ {/*{props?.content?.votes ? adminLists.length - 2 : 0 } other Vote(s)
} */} {openModal && (
+ NFT by {profileImage?.image?.ipfs_cid ? : ""} {props?.owner}
+
+ {formatTime(props?.content?.timestamp)} +
+{nftData?.description ?? ""}
+{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 =