From f087e501a15c90f72fa51a5a331071cc9f8fb840 Mon Sep 17 00:00:00 2001 From: Alex Donesky Date: Wed, 19 Jan 2022 12:42:41 -0600 Subject: [PATCH] Add modal with directions to re-add token as NFT (#13291) * Add modal pop for NFTs previously added as tokens - with directions to re-add as NFTs --- app/_locales/el/messages.json | 3 - app/_locales/en/messages.json | 20 ++++- app/_locales/fr/messages.json | 3 - app/_locales/hi/messages.json | 3 - app/_locales/id/messages.json | 3 - app/_locales/ja/messages.json | 3 - app/_locales/ko/messages.json | 3 - app/_locales/ru/messages.json | 3 - app/_locales/tl/messages.json | 3 - app/_locales/tr/messages.json | 3 - app/_locales/vi/messages.json | 3 - app/_locales/zh_CN/messages.json | 3 - .../app/asset-list-item/asset-list-item.js | 30 ++++--- .../collectibles-detection-notice.js | 2 +- .../collectibles-detection-notice/index.scss | 2 +- .../convert-token-to-nft-modal.js | 46 ++++++++++ .../convert-token-to-nft-modal/index.scss | 4 + ui/components/app/modals/index.scss | 1 + ui/components/app/modals/modal.js | 14 +++ .../app/wallet-overview/token-overview.js | 36 ++++++-- .../wallet-overview/token-overview.test.js | 74 +++++++++++++++ ui/components/ui/form-field/form-field.js | 7 ++ .../ui/form-field/form-field.stories.js | 1 + .../numeric-input/numeric-input.component.js | 3 + ui/ducks/send/send.js | 90 ++++++++++++------- ui/ducks/send/send.test.js | 67 +++++++++++--- ui/helpers/constants/common.js | 1 + ui/helpers/constants/error-keys.js | 1 + ui/hooks/gasFeeInput/test-utils.js | 8 ++ ui/pages/add-collectible/add-collectible.js | 57 ++++++++---- ui/pages/asset/asset.js | 2 +- .../import-token/import-token.component.js | 2 +- .../send-content/send-content.component.js | 3 + .../send-content/send-content.container.js | 2 + 34 files changed, 383 insertions(+), 123 deletions(-) create mode 100644 ui/components/app/modals/convert-token-to-nft-modal/convert-token-to-nft-modal.js create mode 100644 ui/components/app/modals/convert-token-to-nft-modal/index.scss create mode 100644 ui/components/app/wallet-overview/token-overview.test.js diff --git a/app/_locales/el/messages.json b/app/_locales/el/messages.json index bc842087e..4c308c91b 100644 --- a/app/_locales/el/messages.json +++ b/app/_locales/el/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "Ιστορικό" }, - "id": { - "message": "Αναγνωριστικό" - }, "import": { "message": "Εισαγωγή", "description": "Button to import an account from a selected file" diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index b70a85694..44fa92710 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -596,6 +596,9 @@ "contractInteraction": { "message": "Contract Interaction" }, + "convertTokenToNFTDescription": { + "message": "We've detected that this asset is an NFT. Metamask now has full native support for NFTs. Would you like to remove it from your token list and add it as an NFT?" + }, "copiedExclamation": { "message": "Copied!" }, @@ -1367,9 +1370,6 @@ "history": { "message": "History" }, - "id": { - "message": "ID" - }, "import": { "message": "Import", "description": "Button to import an account from a selected file" @@ -1406,9 +1406,15 @@ "importNFT": { "message": "Import NFT" }, + "importNFTAddressToolTip": { + "message": "On OpenSea, for example, on the NFT's page under Details, there is a blue hyperlinked value labeled 'Contract Address'. If you click on this, it will take you to the contract's address on Etherscan; at the top-left of that page, there should be an icon labeled 'Contract', and to the right, a long string of letters and numbers. This is the address of the contract that created your NFT. Click on the 'copy' icon to the right of the address, and you'll have it on your clipboard." + }, "importNFTPage": { "message": "Import NFT page" }, + "importNFTTokenIdToolTip": { + "message": "A collectible's ID is a unique identifier since no two NFTs are alike. Again, on OpenSea this number is under 'Details'. Make a note of it, or copy it onto your clipboard." + }, "importNFTs": { "message": "Import NFTs" }, @@ -1462,6 +1468,9 @@ "invalidAddressRecipientNotEthNetwork": { "message": "Not ETH network, set to lowercase" }, + "invalidAssetType": { + "message": "This asset is an NFT and needs to be re-added on the Import NFTs page found under the NFTs tab" + }, "invalidBlockExplorerURL": { "message": "Invalid Block Explorer URL" }, @@ -1914,7 +1923,7 @@ "description": "The next nonce according to MetaMask's internal logic" }, "nftTokenIdPlaceholder": { - "message": "Enter the collectible ID" + "message": "Enter the Token ID" }, "nfts": { "message": "NFTs" @@ -3531,6 +3540,9 @@ "message": "$1 of $2 pending", "description": "$1 and $2 are intended to be two numbers, where $2 is a total number of pending confirmations, and $1 is a count towards that total" }, + "yes": { + "message": "Yes" + }, "yesLetsTry": { "message": "Yes, let's try" }, diff --git a/app/_locales/fr/messages.json b/app/_locales/fr/messages.json index 30a055b87..7250f14c3 100644 --- a/app/_locales/fr/messages.json +++ b/app/_locales/fr/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "Historique" }, - "id": { - "message": "ID" - }, "import": { "message": "Importer", "description": "Button to import an account from a selected file" diff --git a/app/_locales/hi/messages.json b/app/_locales/hi/messages.json index b6cf3ed1a..25f9f5c7e 100644 --- a/app/_locales/hi/messages.json +++ b/app/_locales/hi/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "इतिहास" }, - "id": { - "message": "ID" - }, "import": { "message": "आयात करें", "description": "Button to import an account from a selected file" diff --git a/app/_locales/id/messages.json b/app/_locales/id/messages.json index 32a1485df..b951b3887 100644 --- a/app/_locales/id/messages.json +++ b/app/_locales/id/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "Riwayat" }, - "id": { - "message": "ID" - }, "import": { "message": "Impor", "description": "Button to import an account from a selected file" diff --git a/app/_locales/ja/messages.json b/app/_locales/ja/messages.json index c6d4be056..3361819c2 100644 --- a/app/_locales/ja/messages.json +++ b/app/_locales/ja/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "履歴" }, - "id": { - "message": "ID" - }, "import": { "message": "インポート", "description": "Button to import an account from a selected file" diff --git a/app/_locales/ko/messages.json b/app/_locales/ko/messages.json index 1645eff00..4f1477f7a 100644 --- a/app/_locales/ko/messages.json +++ b/app/_locales/ko/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "기록" }, - "id": { - "message": "ID" - }, "import": { "message": "가져오기", "description": "Button to import an account from a selected file" diff --git a/app/_locales/ru/messages.json b/app/_locales/ru/messages.json index 2623ae63d..99085c5f5 100644 --- a/app/_locales/ru/messages.json +++ b/app/_locales/ru/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "История" }, - "id": { - "message": "Ид." - }, "import": { "message": "Импорт", "description": "Button to import an account from a selected file" diff --git a/app/_locales/tl/messages.json b/app/_locales/tl/messages.json index f90ef7fe6..efef53600 100644 --- a/app/_locales/tl/messages.json +++ b/app/_locales/tl/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "History" }, - "id": { - "message": "ID" - }, "import": { "message": "Mag-import", "description": "Button to import an account from a selected file" diff --git a/app/_locales/tr/messages.json b/app/_locales/tr/messages.json index bab183e51..99f68d427 100644 --- a/app/_locales/tr/messages.json +++ b/app/_locales/tr/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "Geçmiş" }, - "id": { - "message": "Kimlik" - }, "import": { "message": "Al", "description": "Button to import an account from a selected file" diff --git a/app/_locales/vi/messages.json b/app/_locales/vi/messages.json index 7f2ad991a..13edabecb 100644 --- a/app/_locales/vi/messages.json +++ b/app/_locales/vi/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "Lịch sử" }, - "id": { - "message": "ID" - }, "import": { "message": "Nhập", "description": "Button to import an account from a selected file" diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json index b90d3be9c..53f8da176 100644 --- a/app/_locales/zh_CN/messages.json +++ b/app/_locales/zh_CN/messages.json @@ -1306,9 +1306,6 @@ "history": { "message": "历史记录" }, - "id": { - "message": "ID" - }, "import": { "message": "导入", "description": "Button to import an account from a selected file" diff --git a/ui/components/app/asset-list-item/asset-list-item.js b/ui/components/app/asset-list-item/asset-list-item.js index 56667db55..a571ee42b 100644 --- a/ui/components/app/asset-list-item/asset-list-item.js +++ b/ui/components/app/asset-list-item/asset-list-item.js @@ -13,6 +13,7 @@ import { useMetricEvent } from '../../../hooks/useMetricEvent'; import { ASSET_TYPES, updateSendAsset } from '../../../ducks/send'; import { SEND_ROUTE } from '../../../helpers/constants/routes'; import { SEVERITIES } from '../../../helpers/constants/design-system'; +import { INVALID_ASSET_TYPE } from '../../../helpers/constants/error-keys'; const AssetListItem = ({ className, @@ -65,21 +66,26 @@ const AssetListItem = ({