mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Implement 'Add NFT' screen (#12544)
* Implement 'Add NFT' screen * Guarding added route with feature flag
This commit is contained in:
parent
a2033377e9
commit
5712539a38
@ -43,6 +43,9 @@
|
|||||||
"activityLog": {
|
"activityLog": {
|
||||||
"message": "activity log"
|
"message": "activity log"
|
||||||
},
|
},
|
||||||
|
"add": {
|
||||||
|
"message": "Add"
|
||||||
|
},
|
||||||
"addANetwork": {
|
"addANetwork": {
|
||||||
"message": "Add a network"
|
"message": "Add a network"
|
||||||
},
|
},
|
||||||
@ -100,6 +103,9 @@
|
|||||||
"addToken": {
|
"addToken": {
|
||||||
"message": "Add Token"
|
"message": "Add Token"
|
||||||
},
|
},
|
||||||
|
"address": {
|
||||||
|
"message": "Address"
|
||||||
|
},
|
||||||
"addressBookIcon": {
|
"addressBookIcon": {
|
||||||
"message": "Address book icon"
|
"message": "Address book icon"
|
||||||
},
|
},
|
||||||
@ -1132,6 +1138,9 @@
|
|||||||
"history": {
|
"history": {
|
||||||
"message": "History"
|
"message": "History"
|
||||||
},
|
},
|
||||||
|
"id": {
|
||||||
|
"message": "ID"
|
||||||
|
},
|
||||||
"import": {
|
"import": {
|
||||||
"message": "Import",
|
"message": "Import",
|
||||||
"description": "Button to import an account from a selected file"
|
"description": "Button to import an account from a selected file"
|
||||||
@ -1601,6 +1610,9 @@
|
|||||||
"message": "Nonce is higher than suggested nonce of $1",
|
"message": "Nonce is higher than suggested nonce of $1",
|
||||||
"description": "The next nonce according to MetaMask's internal logic"
|
"description": "The next nonce according to MetaMask's internal logic"
|
||||||
},
|
},
|
||||||
|
"nftTokenIdPlaceholder": {
|
||||||
|
"message": "Enter the collectible ID"
|
||||||
|
},
|
||||||
"nfts": {
|
"nfts": {
|
||||||
"message": "NFTs"
|
"message": "NFTs"
|
||||||
},
|
},
|
||||||
|
@ -38,6 +38,7 @@ const AWAITING_SIGNATURES_ROUTE = '/swaps/awaiting-signatures';
|
|||||||
const AWAITING_SWAP_ROUTE = '/swaps/awaiting-swap';
|
const AWAITING_SWAP_ROUTE = '/swaps/awaiting-swap';
|
||||||
const SWAPS_ERROR_ROUTE = '/swaps/swaps-error';
|
const SWAPS_ERROR_ROUTE = '/swaps/swaps-error';
|
||||||
const SWAPS_MAINTENANCE_ROUTE = '/swaps/maintenance';
|
const SWAPS_MAINTENANCE_ROUTE = '/swaps/maintenance';
|
||||||
|
const ADD_COLLECTIBLE_ROUTE = '/add-collectible';
|
||||||
|
|
||||||
const INITIALIZE_ROUTE = '/initialize';
|
const INITIALIZE_ROUTE = '/initialize';
|
||||||
const INITIALIZE_WELCOME_ROUTE = '/initialize/welcome';
|
const INITIALIZE_WELCOME_ROUTE = '/initialize/welcome';
|
||||||
@ -218,6 +219,7 @@ export {
|
|||||||
AWAITING_SIGNATURES_ROUTE,
|
AWAITING_SIGNATURES_ROUTE,
|
||||||
SWAPS_ERROR_ROUTE,
|
SWAPS_ERROR_ROUTE,
|
||||||
SWAPS_MAINTENANCE_ROUTE,
|
SWAPS_MAINTENANCE_ROUTE,
|
||||||
|
ADD_COLLECTIBLE_ROUTE,
|
||||||
ONBOARDING_ROUTE,
|
ONBOARDING_ROUTE,
|
||||||
ONBOARDING_HELP_US_IMPROVE_ROUTE,
|
ONBOARDING_HELP_US_IMPROVE_ROUTE,
|
||||||
ONBOARDING_CREATE_PASSWORD_ROUTE,
|
ONBOARDING_CREATE_PASSWORD_ROUTE,
|
||||||
|
65
ui/pages/add-collectible/add-collectible.component.js
Normal file
65
ui/pages/add-collectible/add-collectible.component.js
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
import { useI18nContext } from '../../hooks/useI18nContext';
|
||||||
|
import { DEFAULT_ROUTE } from '../../helpers/constants/routes';
|
||||||
|
|
||||||
|
import Box from '../../components/ui/box';
|
||||||
|
import TextField from '../../components/ui/text-field';
|
||||||
|
import PageContainer from '../../components/ui/page-container';
|
||||||
|
|
||||||
|
export default function AddCollectible() {
|
||||||
|
const t = useI18nContext();
|
||||||
|
const history = useHistory();
|
||||||
|
|
||||||
|
const [address, setAddress] = useState('');
|
||||||
|
const [tokenId, setTokenId] = useState('');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<PageContainer
|
||||||
|
title={t('addNFT')}
|
||||||
|
onSubmit={() => {
|
||||||
|
console.log(
|
||||||
|
`Adding collectible with ID: ${tokenId} and address ${address}`,
|
||||||
|
);
|
||||||
|
history.push(DEFAULT_ROUTE);
|
||||||
|
}}
|
||||||
|
submitText={t('add')}
|
||||||
|
onCancel={() => {
|
||||||
|
history.push(DEFAULT_ROUTE);
|
||||||
|
}}
|
||||||
|
onClose={() => {
|
||||||
|
history.push(DEFAULT_ROUTE);
|
||||||
|
}}
|
||||||
|
disabled={false}
|
||||||
|
contentComponent={
|
||||||
|
<Box padding={4}>
|
||||||
|
<Box>
|
||||||
|
<TextField
|
||||||
|
id="address"
|
||||||
|
label={t('address')}
|
||||||
|
placeholder="0x..."
|
||||||
|
type="text"
|
||||||
|
value={address}
|
||||||
|
onChange={(e) => setAddress(e.target.value)}
|
||||||
|
fullWidth
|
||||||
|
autoFocus
|
||||||
|
margin="normal"
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
<Box>
|
||||||
|
<TextField
|
||||||
|
id="token-id"
|
||||||
|
label={t('id')}
|
||||||
|
placeholder={t('nftTokenIdPlaceholder')}
|
||||||
|
type="number"
|
||||||
|
value={tokenId}
|
||||||
|
onChange={(e) => setTokenId(e.target.value)}
|
||||||
|
fullWidth
|
||||||
|
margin="normal"
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
1
ui/pages/add-collectible/index.js
Normal file
1
ui/pages/add-collectible/index.js
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { default } from './add-collectible.component';
|
@ -35,6 +35,7 @@ import {
|
|||||||
BUILD_QUOTE_ROUTE,
|
BUILD_QUOTE_ROUTE,
|
||||||
VIEW_QUOTE_ROUTE,
|
VIEW_QUOTE_ROUTE,
|
||||||
CONFIRMATION_V_NEXT_ROUTE,
|
CONFIRMATION_V_NEXT_ROUTE,
|
||||||
|
ADD_COLLECTIBLE_ROUTE,
|
||||||
} from '../../helpers/constants/routes';
|
} from '../../helpers/constants/routes';
|
||||||
import BetaHomeFooter from './beta-home-footer.component';
|
import BetaHomeFooter from './beta-home-footer.component';
|
||||||
|
|
||||||
@ -438,7 +439,7 @@ export default class Home extends PureComponent {
|
|||||||
>
|
>
|
||||||
<CollectiblesList
|
<CollectiblesList
|
||||||
onAddNFT={() => {
|
onAddNFT={() => {
|
||||||
console.log('Added NFT');
|
history.push(ADD_COLLECTIBLE_ROUTE);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Tab>
|
</Tab>
|
||||||
|
@ -18,6 +18,7 @@ import RestoreVaultPage from '../keychains/restore-vault';
|
|||||||
import RevealSeedConfirmation from '../keychains/reveal-seed';
|
import RevealSeedConfirmation from '../keychains/reveal-seed';
|
||||||
import MobileSyncPage from '../mobile-sync';
|
import MobileSyncPage from '../mobile-sync';
|
||||||
import ImportTokenPage from '../import-token';
|
import ImportTokenPage from '../import-token';
|
||||||
|
import AddCollectiblePage from '../add-collectible';
|
||||||
import ConfirmImportTokenPage from '../confirm-import-token';
|
import ConfirmImportTokenPage from '../confirm-import-token';
|
||||||
import ConfirmAddSuggestedTokenPage from '../confirm-add-suggested-token';
|
import ConfirmAddSuggestedTokenPage from '../confirm-add-suggested-token';
|
||||||
import CreateAccountPage from '../create-account';
|
import CreateAccountPage from '../create-account';
|
||||||
@ -55,6 +56,7 @@ import {
|
|||||||
CONFIRM_IMPORT_TOKEN_ROUTE,
|
CONFIRM_IMPORT_TOKEN_ROUTE,
|
||||||
INITIALIZE_ROUTE,
|
INITIALIZE_ROUTE,
|
||||||
ONBOARDING_ROUTE,
|
ONBOARDING_ROUTE,
|
||||||
|
ADD_COLLECTIBLE_ROUTE,
|
||||||
} from '../../helpers/constants/routes';
|
} from '../../helpers/constants/routes';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -155,6 +157,13 @@ export default class Routes extends Component {
|
|||||||
component={ImportTokenPage}
|
component={ImportTokenPage}
|
||||||
exact
|
exact
|
||||||
/>
|
/>
|
||||||
|
{process.env.COLLECTIBLES_V1 ? (
|
||||||
|
<Authenticated
|
||||||
|
path={ADD_COLLECTIBLE_ROUTE}
|
||||||
|
component={AddCollectiblePage}
|
||||||
|
exact
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
<Authenticated
|
<Authenticated
|
||||||
path={CONFIRM_IMPORT_TOKEN_ROUTE}
|
path={CONFIRM_IMPORT_TOKEN_ROUTE}
|
||||||
component={ConfirmImportTokenPage}
|
component={ConfirmImportTokenPage}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user