From 6aab8ef5ab429bec7ad01632bdba083776b8b952 Mon Sep 17 00:00:00 2001 From: Jose Date: Wed, 28 Apr 2021 20:35:04 -0500 Subject: [PATCH] Feature/m (#97) * artselector for tiered auction * useArt id * modal size, scroll body * format go live ts * fix progress circle * hide steps when publishing * auction congrats buttons * landing page, image height * revert key * art creation congrats buttons --- packages/metavinci/src/actions/nft.tsx | 6 +++- .../metavinci/src/views/artCreate/index.tsx | 35 +++++++++++++++---- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/packages/metavinci/src/actions/nft.tsx b/packages/metavinci/src/actions/nft.tsx index 5be69f1..6586ec3 100644 --- a/packages/metavinci/src/actions/nft.tsx +++ b/packages/metavinci/src/actions/nft.tsx @@ -43,7 +43,9 @@ export const mintNFT = async ( env: ENV, files: File[], metadata: { name: string; symbol: string }, -): Promise => { +): Promise<{ + metadataAccount: PublicKey, +} | void> => { if (!wallet?.publicKey) { return; } @@ -258,6 +260,8 @@ export const mintNFT = async ( // TODO: // 1. Jordan: --- upload file and metadata to storage API // 2. pay for storage by hashing files and attaching memo for each file + + return { metadataAccount } }; export const prepPayForFilesTxn = async ( diff --git a/packages/metavinci/src/views/artCreate/index.tsx b/packages/metavinci/src/views/artCreate/index.tsx index 1b0e92f..3ed13c0 100644 --- a/packages/metavinci/src/views/artCreate/index.tsx +++ b/packages/metavinci/src/views/artCreate/index.tsx @@ -33,7 +33,7 @@ import { LAMPORT_MULTIPLIER, solanaToUSD, } from '../../utils/assets'; -import { Connection } from '@solana/web3.js'; +import { Connection, PublicKey } from '@solana/web3.js'; import { MintLayout } from '@solana/spl-token'; import { useHistory, useParams } from 'react-router-dom'; @@ -51,6 +51,7 @@ export const ArtCreateView = () => { const [step, setStep] = useState(0); const [saving, setSaving] = useState(false); const [progress, setProgress] = useState(0); + const [nft, setNft] = useState<{ metadataAccount: PublicKey } | undefined>(undefined); const [attributes, setAttributes] = useState({ name: '', symbol: '', @@ -82,7 +83,8 @@ export const ArtCreateView = () => { setSaving(true); const inte = setInterval(() => setProgress(prog => prog + 1), 600); // Update progress inside mintNFT - await mintNFT(connection, wallet, env, attributes?.files || [], metadata); + const _nft = await mintNFT(connection, wallet, env, attributes?.files || [], metadata); + if (_nft) setNft(_nft) clearInterval(inte); }; @@ -153,7 +155,7 @@ export const ArtCreateView = () => { confirm={() => gotoStep(6)} /> )} - {step === 6 && } + {step === 6 && } {0 < step && step < 5 && ( )} @@ -752,7 +754,26 @@ const WaitingStep = (props: { ); }; -const Congrats = () => { +const Congrats = (props: { + nft?: { + metadataAccount: PublicKey, + } +}) => { + + const history = useHistory() + + const newTweetURL = () => { + const params = { + text: "I've created a new NFT artwork on Metaplex, check it out!", + url: `${window.location.origin}/#/art/${props.nft?.metadataAccount.toString()}`, + hashtags: "NFT,Crypto,Metaplex", + // via: "Metaplex", + related: "Metaplex,Solana", + } + const queryParams = new URLSearchParams(params).toString() + return `https://twitter.com/intent/tweet?${queryParams}` + } + return ( <>
@@ -760,15 +781,15 @@ const Congrats = () => { Congratulations, you created an NFT!
- - -