Skip to content

Commit

Permalink
UI changes, copy changes
Browse files Browse the repository at this point in the history
  • Loading branch information
urko94 committed Sep 5, 2023
1 parent 06c3856 commit db891e9
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Paste the address of the NFT collection.
REACT_APP_NFT_ADDRESS=
REACT_APP_CONTRACT_ADDRESS=

# Uncomment the chain you are using:
# Moonbase
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ To configure the template, do the following:
Example:

```sh
const nftAddress = ""; // Paste the address of the NFT collection between the parenthesis
REACT_APP_CONTRACT_ADDRESS = ""; // Paste the address of the NFT collection between the parenthesis

// uncomment the chain you are using by deleting the slashes
// const chainId = "0x507"; // Moonbase
// const chainId = "0x504"; // Moonbeam
// const chainId = "0x250"; // Astar
// REACT_APP_CHAIN_ID = "0x507"; // Moonbase
// REACT_APP_CHAIN_ID = "0x504"; // Moonbeam
// REACT_APP_CHAIN_ID = "0x250"; // Astar
```

Once you have updated the .env. file, save it. Now the website files are ready to be deployed.
Expand Down
17 changes: 14 additions & 3 deletions src/components/CollectionInfo.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ethers } from 'ethers'
import { constants, ethers } from 'ethers'
import React, { useEffect, useState } from 'react'
import Mint from './Mint'

export default function Collection ({ collection, provider, address, isCollectionNestable }) {
export default function Collection ({ collection, provider, address }) {
const [totalSupply] = useState(collection.totalSupply)
const [maxSupply] = useState(collection.maxSupply)
const [dropStartDate, setDropStartDate] = useState(new Date())
Expand Down Expand Up @@ -92,13 +92,24 @@ export default function Collection ({ collection, provider, address, isCollectio
<b> Symbol: </b>
{collection.symbol}
</div>
<div>
<b> Revocable: </b>
{collection.revokable ? 'TRUE' : 'FALSE'}
</div>
<div>
<b> Soulbound: </b>
{collection.soulbound ? 'TRUE' : 'FALSE'}
</div>
<div>
<b> Supply: </b>
{totalSupply.toString()}/{maxSupply.toString()}
{(() => {
if (maxSupply.toString() === constants.MaxUint256.toString()) {
return (<div>{totalSupply.toString()} / &infin;</div>)
} else {
return (<div>{totalSupply.toString()} / {maxSupply.toString()}</div>)
}
})()}

</div>
{/* Is drop */}
{collection.drop && (
Expand Down
3 changes: 1 addition & 2 deletions src/components/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export default function Main () {
} catch (e) {
console.error(e)

toast('Apologies, we were unable to load NFT: ' + (i + 1), {
toast('Apologies, we were unable to load NFTs metadata.', {
type: 'error'
})
}
Expand All @@ -233,7 +233,6 @@ export default function Main () {
collection={collectionInfo}
provider={provider}
address={address}
isCollectionNestable={collectionNestable}
/>
)}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Mint.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Mint ({ price, provider, address }) {

async function mint () {
setLoading(true)
const NFT_ADDRESS = process.env.REACT_APP_NFT_ADDRESS
const NFT_ADDRESS = process.env.REACT_APP_CONTRACT_ADDRESS

if (!checkInputAmount(amount)) {
console.log('Wrong amount number')
Expand Down
6 changes: 3 additions & 3 deletions src/components/MintNestable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export default function MintNestable ({ price, provider, address }) {
async function mintWrapper () {
setLoadingMint(true)

mint(process.env.REACT_APP_NFT_ADDRESS)
mint(process.env.REACT_APP_CONTRACT_ADDRESS)

setLoadingMint(false)
}

async function childMintWrapper () {
setLoadingMintNestable(true)
const contractAddress = inputAddress || process.env.REACT_APP_NFT_ADDRESS
const contractAddress = inputAddress || process.env.REACT_APP_CONTRACT_ADDRESS

mint(contractAddress)

Expand Down Expand Up @@ -70,7 +70,7 @@ export default function MintNestable ({ price, provider, address }) {
</div>
<br />
<div className="field">
<label htmlFor="address">Contract Address:</label>
<label htmlFor="address">Child Contract Address:</label>
<input id="address" value={inputAddress} type="text" onChange={handleChange} />
</div>
<button disabled={loadingNestMint} onClick={childMintWrapper}>
Expand Down
10 changes: 5 additions & 5 deletions src/components/NftCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export default function NftCard ({ id, nft, isCollectionNestable, myNFTs }) {
<div className={styles.nft_content}>
<h3>#{id} {nft.name}</h3>
<p>{nft.description}</p>
{isCollectionNestable && isMyNFT && (
<button onClick={() => openModalNft()}>
Open NFT
</button>
)}
{isCollectionNestable && isMyNFT && (
<button onClick={() => openModalNft()}>
Open NFT
</button>
)}
</div>
<Modal
className='modal'
Expand Down
18 changes: 9 additions & 9 deletions src/components/NftNestable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ const NftNestable = ({ nftId, nftName, nftDescription, nftImage }) => {
const [loadingNestMint, setLoadingNestMint] = useState(false)
const [loadingTransferFrom, setLoadingTransferFrom] = useState(false)

const [addressNestMint, setAddressNestMint] = useState(process.env.REACT_APP_NFT_ADDRESS)
const [addressTransferFrom, setAddressTransferFrom] = useState(process.env.REACT_APP_NFT_ADDRESS)
const [addressNestMint, setAddressNestMint] = useState(process.env.REACT_APP_CONTRACT_ADDRESS)
const [addressTransferFrom, setAddressTransferFrom] = useState(process.env.REACT_APP_CONTRACT_ADDRESS)
const [tokenTransferFrom, setTokenTransferFrom] = useState(0)

const [pendingChild, setPendingChild] = useState({})
Expand Down Expand Up @@ -149,7 +149,7 @@ const NftNestable = ({ nftId, nftName, nftDescription, nftImage }) => {
try {
const provider = getProvider()
const walletAddress = await provider.getSigner().getAddress()
const toAddress = process.env.REACT_APP_NFT_ADDRESS
const toAddress = process.env.REACT_APP_CONTRACT_ADDRESS

await childNftContract
.connect(provider.getSigner())
Expand Down Expand Up @@ -231,12 +231,12 @@ const NftNestable = ({ nftId, nftName, nftDescription, nftImage }) => {
<div className="btn-group">
<div className="field">
<label htmlFor={`addressNestMint_${nftId}`}>
<span>Contract Address</span>
<span>Child Contract Address</span>
<a id={`infoNestMint_${nftId}`}>
<img src="images/info.svg" width={16} height={16} />
</a>
<Tooltip anchorSelect={`#infoNestMint_${nftId}`}type='warning' effect='solid'>
<span>Enter collection address from where you want to mint NFT and transfer it to this NFT. Initial address is from this collection.</span>
<span>Enter child collection address from where you want to mint NFT and transfer it to this NFT. Initial address is from this collection.</span>
</Tooltip>
</label>
<input
Expand All @@ -247,18 +247,18 @@ const NftNestable = ({ nftId, nftName, nftDescription, nftImage }) => {
/>
</div>
<button disabled={loadingNestMint} onClick={childNestMint}>
{loadingNestMint ? <Spinner /> : 'Mint Child'}
{loadingNestMint ? <Spinner /> : `Nest Mint Child under ${nftName}` }
</button>
</div>
<div className="btn-group">
<div className="field">
<label htmlFor={`addressTransferFrom_${nftId}`}>
<span>Contract Address</span>
<span>Child Contract Address</span>
<a id={`infoTransferFrom_${nftId}`}>
<img src="images/info.svg" width={16} height={16} />
</a>
<Tooltip anchorSelect={`#infoTransferFrom_${nftId}`}type='warning' effect='solid'>
<span>Enter collection address from where you want to transfer NFT. Initial address is from this collection.</span>
<span>Enter child collection address from where you want to transfer NFT. Initial address is from this collection.</span>
</Tooltip>
</label>
<input
Expand Down Expand Up @@ -287,7 +287,7 @@ const NftNestable = ({ nftId, nftName, nftDescription, nftImage }) => {
/>
</div>
<button disabled={loadingTransferFrom} onClick={nestTransferFrom}>
{loadingTransferFrom ? <Spinner /> : 'Nest Transfer From'}
{loadingTransferFrom ? <Spinner /> : `Nest NFT under ${nftName}`}
</button>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/NftNestedChild.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const NftNestedChild = ({ parentId, tokenId, contractAddress }) => {
} catch (error) {
console.error(error)

toast('Apologies, we were unable to load NFT: ' + (tokenId), {
toast('Apologies, we were unable to load NFTs metadata.', {
type: 'error'
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const getProvider = () => {
}

export const getContract = (contractAddress) => {
const NFT_ADDRESS = process.env.REACT_APP_NFT_ADDRESS
const NFT_ADDRESS = process.env.REACT_APP_CONTRACT_ADDRESS
return new ethers.Contract(contractAddress || NFT_ADDRESS, nftAbi, getProvider())
}

Expand Down

0 comments on commit db891e9

Please sign in to comment.