Skip to content

/nft-mint page sell offer create must be possible for signed-in users only #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion components/Services/NftMint/NFTokenMint.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import ExpirationSelect from '../../UI/ExpirationSelect'
import TokenSelector from '../../UI/TokenSelector'
import { useRouter } from 'next/router'

export default function NFTokenMint({ setSignRequest, uriQuery, taxonQuery }) {
export default function NFTokenMint({ setSignRequest, uriQuery, taxonQuery, account }) {
const router = useRouter()
const [uri, setUri] = useState(uriQuery)
const [agreeToSiteTerms, setAgreeToSiteTerms] = useState(false)
Expand Down Expand Up @@ -41,6 +41,13 @@ export default function NFTokenMint({ setSignRequest, uriQuery, taxonQuery }) {
}
}, [agreeToSiteTerms, agreeToPrivacyPolicy])


useEffect(() => {
if (!account?.address) {
setCreateSellOffer(false)
}
}, [account?.address])

useEffect(() => {
let queryAddList = []
let queryRemoveList = []
Expand Down Expand Up @@ -337,9 +344,15 @@ export default function NFTokenMint({ setSignRequest, uriQuery, taxonQuery }) {
setCreateSellOffer(!createSellOffer)
}}
name="create-sell-offer"
disabled={!account?.address}
>
Create a Sell offer
</CheckBox>
{!account?.address && (
<div className="orange" style={{ marginTop: '5px', fontSize: '14px' }}>
Login first if you want to add the sell offer in the same transaction.
</div>
)}
</div>

{/* Sell Offer Fields */}
Expand Down
4 changes: 2 additions & 2 deletions pages/services/nft-mint.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const getServerSideProps = async (context) => {
}
}

export default function NftMint({ setSignRequest, uriQuery, digestQuery, taxonQuery }) {
export default function NftMint({ setSignRequest, uriQuery, digestQuery, taxonQuery, account }) {
const { t } = useTranslation()

return (
Expand All @@ -47,7 +47,7 @@ export default function NftMint({ setSignRequest, uriQuery, digestQuery, taxonQu
{xahauNetwork ? (
<URITokenMint setSignRequest={setSignRequest} uriQuery={uriQuery} digestQuery={digestQuery} />
) : (
<NFTokenMint setSignRequest={setSignRequest} uriQuery={uriQuery} taxonQuery={taxonQuery} />
<NFTokenMint setSignRequest={setSignRequest} uriQuery={uriQuery} taxonQuery={taxonQuery} account={account} />
)}
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions pages/services/trustline.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default function TrustSet({ setSignRequest }) {
setIssuer(selectedToken.issuer)
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedToken, mode])

// Sync limit when switching modes
Expand Down