chore: final mint step and share (#174)

* chore: final mint step and share

* chore: fix comments PR

* Update ui/src/views/mint/mint-stepper.tsx

Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>

* Update ui/src/views/mint/mint.context.tsx

Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>

---------

Co-authored-by: Felipe Mendes <zo.fmendes@gmail.com>
This commit is contained in:
Camila Sosa Morales 2023-03-14 07:44:25 -05:00 committed by GitHub
parent 7985bb35bb
commit 2c0cfd9b9b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 99 additions and 111 deletions

View File

@ -16,4 +16,7 @@ export const env = Object.freeze({
appId: import.meta.env.VITE_FIREBASE_APP_ID || '', appId: import.meta.env.VITE_FIREBASE_APP_ID || '',
measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID || '', measurementId: import.meta.env.VITE_FIREBASE_MEASUREMENT_ID || '',
}, },
twitter: {
url: import.meta.env.VITE_TWITTER_URL || '',
},
}); });

View File

@ -1,10 +1,12 @@
import { lastMintsPaginatedDocument, totalTokensDocument } from '@/graphclient'; /* eslint-disable react/react-in-jsx-scope */
import { Button, Card, Flex, NoResults } from '@/components';
import { FleekERC721 } from '@/integrations/ethereum/contracts';
import { useQuery } from '@apollo/client'; import { useQuery } from '@apollo/client';
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { Button, Card, Flex, NoResults } from '@/components';
import { lastMintsPaginatedDocument, totalTokensDocument } from '@/graphclient';
import { FleekERC721 } from '@/integrations/ethereum/contracts';
const pageSize = 10; //Set this size to test pagination const pageSize = 10; //Set this size to test pagination
export const NFAList = () => { export const NFAList = () => {
@ -65,15 +67,19 @@ export const NFAList = () => {
Next page Next page
</Button> </Button>
</Flex> </Flex>
<Flex css={{ gap: '$2' }}> <div>
{dataMintedTokens && dataMintedTokens.newMints.length > 0 ? ( {dataMintedTokens && dataMintedTokens.newMints.length > 0 ? (
dataMintedTokens.newMints.map((mint) => ( dataMintedTokens.newMints.map((mint) => (
<Card.Container key={mint.tokenId}> <Card.Container
key={mint.tokenId}
css={{ display: 'inline-block', m: '$2' }}
>
<Card.Heading title={mint.name} /> <Card.Heading title={mint.name} />
<Card.Body css={{ display: 'flex', flexDirection: 'column' }}> <Card.Body css={{ display: 'flex', flexDirection: 'column' }}>
<a <a
target="_blank" target="_blank"
href={`https://testnets.opensea.io/assets/mumbai/${FleekERC721.address}/${mint.tokenId}`} href={`https://testnets.opensea.io/assets/mumbai/${FleekERC721.address}/${mint.tokenId}`}
rel="noreferrer"
> >
<u>Open NFA on Opensea</u> <u>Open NFA on Opensea</u>
</a> </a>
@ -84,7 +90,7 @@ export const NFAList = () => {
) : ( ) : (
<NoResults /> <NoResults />
)} )}
</Flex> </div>
</Flex> </Flex>
); );
}; };

View File

@ -4,35 +4,46 @@ import { GithubStep } from './github-step';
import { MintStep } from './mint-step'; import { MintStep } from './mint-step';
import { WalletStep } from './wallet-step'; import { WalletStep } from './wallet-step';
import { NFAStep } from './nfa-step'; import { NFAStep } from './nfa-step';
import { Mint } from './mint.context';
import { NftMinted } from './nft-minted';
export const MintStepper = () => { export const MintStepper = () => {
return ( const {
<Stepper.Root initialStep={1}> transaction: { isSuccess },
<Stepper.Container> } = Mint.useTransactionContext();
<Stepper.Step>
<MintStep header="Connect your Ethereum Wallet to mint an NFA">
<WalletStep />
</MintStep>
</Stepper.Step>
<Stepper.Step>
<MintStep header="Connect GitHub and select repository">
<GithubStep />
</MintStep>
</Stepper.Step>
<Stepper.Step> if (!isSuccess) {
<MintStep header="Finalize a few key things for your NFA"> return (
<NFAStep /> <Stepper.Root initialStep={1}>
</MintStep> <Stepper.Container>
</Stepper.Step> <Stepper.Step>
<MintStep header="Connect your Ethereum Wallet to mint an NFA">
<WalletStep />
</MintStep>
</Stepper.Step>
<Stepper.Step> <Stepper.Step>
<MintStep header="Review your NFA and mint it on Polygon"> <MintStep header="Connect GitHub and select repository">
<MintPreview /> <GithubStep />
</MintStep> </MintStep>
</Stepper.Step> </Stepper.Step>
</Stepper.Container>
</Stepper.Root> <Stepper.Step>
); <MintStep header="Finalize a few key things for your NFA">
<NFAStep />
</MintStep>
</Stepper.Step>
<Stepper.Step>
<MintStep header="Review your NFA and mint it on Polygon">
<MintPreview />
</MintStep>
</Stepper.Step>
</Stepper.Container>
</Stepper.Root>
);
} else {
return <NftMinted />;
}
}; };

View File

@ -2,8 +2,8 @@ import { useState } from 'react';
import { ComboboxItem, DropdownItem } from '@/components'; import { ComboboxItem, DropdownItem } from '@/components';
import { EthereumHooks } from '@/integrations'; import { EthereumHooks } from '@/integrations';
import { GithubState, useFleekERC721Billing } from '@/store';
import { AppLog, createContext } from '@/utils'; import { AppLog, createContext } from '@/utils';
import { GithubState, useFleekERC721Billing } from '@/store';
export type MintContext = { export type MintContext = {
billing: string | undefined; billing: string | undefined;
@ -118,8 +118,10 @@ export abstract class Mint {
config={{ config={{
transaction: { transaction: {
onSuccess: (data) => { onSuccess: (data) => {
AppLog.successToast('Successfully minted!'); AppLog.info('Transaction:', data);
alert('transaction hash: ' + data.transactionHash); },
onError: (error) => {
AppLog.errorToast(error.message);
}, },
}, },
}} }}

View File

@ -1,10 +1,19 @@
import { Icon } from '@/components'; import { Icon } from '@/components';
import { env } from '@/constants';
import { useNavigate } from 'react-router-dom';
import { NftCard } from './nft-card'; import { NftCard } from './nft-card';
export const NftMinted = () => { export const NftMinted = () => {
const navigate = useNavigate();
const handleButtonClick = () => {
window.open(env.twitter.url, '_blank'); //TODO replace with twitter share
navigate('/home');
};
return ( return (
<NftCard <NftCard
title="Mint Successful" title="Mint Successful"
isLoading={false}
leftIcon={ leftIcon={
<Icon <Icon
name="check-circle" name="check-circle"
@ -13,9 +22,7 @@ export const NftMinted = () => {
} }
message="You have successfully minted your NFA." message="You have successfully minted your NFA."
buttonText="Tweet about your NFA!" buttonText="Tweet about your NFA!"
onClick={() => { onClick={handleButtonClick}
alert('TODO: Tweet about your NFA!');
}}
leftIconButton={<Icon name="twitter" />} leftIconButton={<Icon name="twitter" />}
/> />
); );

View File

@ -5442,32 +5442,6 @@
dependencies: dependencies:
"@types/yargs-parser" "*" "@types/yargs-parser" "*"
"@typescript-eslint/eslint-plugin@^5.45.0":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.1.tgz#0c5091289ce28372e38ab8d28e861d2dbe1ab29e"
integrity sha512-a2RQAkosH3d3ZIV08s3DcL/mcGc2M/UC528VkPULFxR9VnVPT8pBu0IyBAJJmVsCmhVfwQX1v6q+QGnmSe1bew==
dependencies:
"@typescript-eslint/scope-manager" "5.54.1"
"@typescript-eslint/type-utils" "5.54.1"
"@typescript-eslint/utils" "5.54.1"
debug "^4.3.4"
grapheme-splitter "^1.0.4"
ignore "^5.2.0"
natural-compare-lite "^1.4.0"
regexpp "^3.2.0"
semver "^7.3.7"
tsutils "^3.21.0"
"@typescript-eslint/parser@^5.45.0":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.54.1.tgz#05761d7f777ef1c37c971d3af6631715099b084c"
integrity sha512-8zaIXJp/nG9Ff9vQNh7TI+C3nA6q6iIsGJ4B4L6MhZ7mHnTMR4YP5vp2xydmFXIy8rpyIVbNAG44871LMt6ujg==
dependencies:
"@typescript-eslint/scope-manager" "5.54.1"
"@typescript-eslint/types" "5.54.1"
"@typescript-eslint/typescript-estree" "5.54.1"
debug "^4.3.4"
"@typescript-eslint/scope-manager@5.54.1": "@typescript-eslint/scope-manager@5.54.1":
version "5.54.1" version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz#6d864b4915741c608a58ce9912edf5a02bb58735" resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.54.1.tgz#6d864b4915741c608a58ce9912edf5a02bb58735"
@ -5476,16 +5450,6 @@
"@typescript-eslint/types" "5.54.1" "@typescript-eslint/types" "5.54.1"
"@typescript-eslint/visitor-keys" "5.54.1" "@typescript-eslint/visitor-keys" "5.54.1"
"@typescript-eslint/type-utils@5.54.1":
version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/type-utils/-/type-utils-5.54.1.tgz#4825918ec27e55da8bb99cd07ec2a8e5f50ab748"
integrity sha512-WREHsTz0GqVYLIbzIZYbmUUr95DKEKIXZNH57W3s+4bVnuF1TKe2jH8ZNH8rO1CeMY3U4j4UQeqPNkHMiGem3g==
dependencies:
"@typescript-eslint/typescript-estree" "5.54.1"
"@typescript-eslint/utils" "5.54.1"
debug "^4.3.4"
tsutils "^3.21.0"
"@typescript-eslint/types@5.54.1": "@typescript-eslint/types@5.54.1":
version "5.54.1" version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.54.1.tgz#29fbac29a716d0f08c62fe5de70c9b6735de215c" resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.54.1.tgz#29fbac29a716d0f08c62fe5de70c9b6735de215c"
@ -5504,7 +5468,7 @@
semver "^7.3.7" semver "^7.3.7"
tsutils "^3.21.0" tsutils "^3.21.0"
"@typescript-eslint/utils@5.54.1", "@typescript-eslint/utils@^5.10.0": "@typescript-eslint/utils@^5.10.0":
version "5.54.1" version "5.54.1"
resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.54.1.tgz#7a3ee47409285387b9d4609ea7e1020d1797ec34" resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-5.54.1.tgz#7a3ee47409285387b9d4609ea7e1020d1797ec34"
integrity sha512-IY5dyQM8XD1zfDe5X8jegX6r2EVU5o/WJnLu/znLPWCBF7KNGC+adacXnt5jEYS9JixDcoccI6CvE4RCjHMzCQ== integrity sha512-IY5dyQM8XD1zfDe5X8jegX6r2EVU5o/WJnLu/znLPWCBF7KNGC+adacXnt5jEYS9JixDcoccI6CvE4RCjHMzCQ==
@ -12868,11 +12832,6 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1" snapdragon "^0.8.1"
to-regex "^3.0.1" to-regex "^3.0.1"
natural-compare-lite@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz#17b09581988979fddafe0201e931ba933c96cbb4"
integrity sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==
natural-compare@^1.4.0: natural-compare@^1.4.0:
version "1.4.0" version "1.4.0"
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"