From fe956ee249e44b96422ca9a47a12530f5218888a Mon Sep 17 00:00:00 2001 From: Jose Date: Tue, 13 Apr 2021 11:08:14 -0500 Subject: [PATCH] Metavinci: Waiting view (#61) * MainAuctionCard * trending auctions * fix scroll, reduce padding * fixing errors/warnings and formatting * formatting & sold auctions * artists cards * initial presale banner. move sample data to own file * new home layout * presale banner image fix * countdown implementation * initial artwork implementation * getCountdown * presale card * fix presale banner image * fix width. show preview. load only 1 file * remove preview/keep filename. url id for steps * slider > input number * upload step for every category * fix file handling * hashrouter * waiting view Co-authored-by: B <264380+bartosz-lipinski@users.noreply.github.com> --- .../metavinci/src/views/artCreate/index.tsx | 87 +++++++++++++------ .../metavinci/src/views/artCreate/styles.less | 13 +++ 2 files changed, 74 insertions(+), 26 deletions(-) diff --git a/packages/metavinci/src/views/artCreate/index.tsx b/packages/metavinci/src/views/artCreate/index.tsx index 1963779..6fa4ba8 100644 --- a/packages/metavinci/src/views/artCreate/index.tsx +++ b/packages/metavinci/src/views/artCreate/index.tsx @@ -42,8 +42,9 @@ export const ArtCreateView = () => { const { step_param }: { step_param: string } = useParams() const history = useHistory() - const [step, setStep] = useState(0); - const [saving, setSaving] = useState(false); + const [step, setStep] = useState(0); + const [saving, setSaving] = useState(false); + const [progress, setProgress] = useState(0); const [attributes, setAttributes] = useState({ name: '', symbol: '', @@ -70,28 +71,18 @@ export const ArtCreateView = () => { ...(attributes as any), image: attributes.files && attributes.files?.[0] && attributes.files[0].name, files: (attributes?.files || []).map(f => f.name), - }; - setSaving(true); - await mintNFT(connection, wallet, env, (attributes?.files || []), metadata); - setSaving(false); - }; + } + setSaving(true) + const inte = setInterval(() => setProgress(prog => prog + 1), 600) + // Update progress inside mintNFT + await mintNFT(connection, wallet, env, (attributes?.files || []), metadata) + clearInterval(inte) + } return ( <> - - - - + {!saving && { - - + } + {step === 0 && ( { @@ -142,11 +133,21 @@ export const ArtCreateView = () => { {step === 4 && ( mint()} + confirm={() => gotoStep(5)} connection={connection} /> )} - {step > 0 && } + {step === 5 && ( + gotoStep(6)} + /> + )} + {step === 6 && ( + + )} + {(0 < step && step < 5) && } @@ -255,7 +256,7 @@ const UploadStep = (props: { }} >
-

Upload your creation

+

Upload your creation

Drag and drop, or click to browse @@ -286,7 +287,7 @@ const UploadStep = (props: { }} >

-

Upload your cover image or video

+

Upload your cover image or video

Drag and drop, or click to browse @@ -570,3 +571,37 @@ const LaunchStep = (props: { ); }; + +const WaitingStep = (props: { + mint: Function, + progress: number, + confirm: Function, +}) => { + + useEffect(() => { + const func = async () => { + await props.mint() + props.confirm() + } + func() + }, []) + + return ( +

+ +
+ Your creation is being uploaded to the decentralized web... +
+
This can take up to 1 minute.
+
+ ) +} + +const Congrats = () => { + return <> + Congrats! + +} diff --git a/packages/metavinci/src/views/artCreate/styles.less b/packages/metavinci/src/views/artCreate/styles.less index a99c21f..8a50952 100644 --- a/packages/metavinci/src/views/artCreate/styles.less +++ b/packages/metavinci/src/views/artCreate/styles.less @@ -179,3 +179,16 @@ flex-grow: 0; margin: 12px 0px; } + +.waiting-title { + font-weight: 700; + font-size: 2rem; + color: #FFFFFF; + margin-top: 100px; +} + +.waiting-subtitle { + font-size: 1.5rem; + color: rgba(255, 255, 255, 0.7); + margin-top: 20px; +}