mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
UI/UX update - Error message in Import NFT (#13772)
This commit is contained in:
parent
fda5b54def
commit
96ab979e7c
3
app/_locales/de/messages.json
generated
3
app/_locales/de/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Konto $1",
|
"message": "Konto $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Sammelobjekt wurde nicht hinzugefügt, weil: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Sammelobjekt wurde erfolgreich hinzugefügt!"
|
"message": "Sammelobjekt wurde erfolgreich hinzugefügt!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/el/messages.json
generated
3
app/_locales/el/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Λογαριασμός $1",
|
"message": "Λογαριασμός $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Το Collectible δεν προστέθηκε επειδή: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Το Collectible προστέθηκε με επιτυχία!"
|
"message": "Το Collectible προστέθηκε με επιτυχία!"
|
||||||
},
|
},
|
||||||
|
6
app/_locales/en/messages.json
generated
6
app/_locales/en/messages.json
generated
@ -486,6 +486,9 @@
|
|||||||
"close": {
|
"close": {
|
||||||
"message": "Close"
|
"message": "Close"
|
||||||
},
|
},
|
||||||
|
"collectibleAddFailedMessage": {
|
||||||
|
"message": "NFT can’t be added as the ownership details do not match. Make sure you have entered correct information."
|
||||||
|
},
|
||||||
"collectibleAddressError": {
|
"collectibleAddressError": {
|
||||||
"message": "This token is an NFT. Add on the $1",
|
"message": "This token is an NFT. Add on the $1",
|
||||||
"description": "$1 is a clickable link with text defined by the 'importNFTPage' key"
|
"description": "$1 is a clickable link with text defined by the 'importNFTPage' key"
|
||||||
@ -1961,9 +1964,6 @@
|
|||||||
"message": "Account $1",
|
"message": "Account $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Collectible was not added because: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Collectible was successfully added!"
|
"message": "Collectible was successfully added!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/es_419/messages.json
generated
3
app/_locales/es_419/messages.json
generated
@ -1787,9 +1787,6 @@
|
|||||||
"message": "Cuenta $1",
|
"message": "Cuenta $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "No se añadió el coleccionable porque: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "¡El coleccionable fue añadido con éxito!"
|
"message": "¡El coleccionable fue añadido con éxito!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/fr/messages.json
generated
3
app/_locales/fr/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Compte $1",
|
"message": "Compte $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Le collectible n’a pas été ajouté, car : $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Le collectible a été ajouté avec succès !"
|
"message": "Le collectible a été ajouté avec succès !"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/hi/messages.json
generated
3
app/_locales/hi/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "खाता $1",
|
"message": "खाता $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "संग्रहणीय नहीं जोड़ा गया था क्योंकि: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "संग्रहणीय सफलतापूर्वक जोड़ा गया!"
|
"message": "संग्रहणीय सफलतापूर्वक जोड़ा गया!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/id/messages.json
generated
3
app/_locales/id/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Akun $1",
|
"message": "Akun $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Koleksi tidak ditambahkan karena: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Koleksi berhasil ditambahkan!"
|
"message": "Koleksi berhasil ditambahkan!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/ja/messages.json
generated
3
app/_locales/ja/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "アカウント$1",
|
"message": "アカウント$1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "次の理由により、コレクティブルは追加されませんでした: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "コレクティブルが追加されました!"
|
"message": "コレクティブルが追加されました!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/ko/messages.json
generated
3
app/_locales/ko/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "계정 $1",
|
"message": "계정 $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "다음 이유 때문에 수집 금액이 추가되지 않았습니다: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "수집이 성공적으로 추가되었습니다!"
|
"message": "수집이 성공적으로 추가되었습니다!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/pt_BR/messages.json
generated
3
app/_locales/pt_BR/messages.json
generated
@ -1771,9 +1771,6 @@
|
|||||||
"message": "Conta $1",
|
"message": "Conta $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "O colecionável não foi adicionado pelo seguinte motivo: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "O colecionável foi adicionado com sucesso!"
|
"message": "O colecionável foi adicionado com sucesso!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/ru/messages.json
generated
3
app/_locales/ru/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Счет $1",
|
"message": "Счет $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Причина, по которой не был добавлен коллекционный актив: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Коллекционный актив успешно добавлен!"
|
"message": "Коллекционный актив успешно добавлен!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/tl/messages.json
generated
3
app/_locales/tl/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Account $1",
|
"message": "Account $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Ang collectible ay hindi idinagdag dahil: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Ang collectible ay tagumpay na naidagdag!"
|
"message": "Ang collectible ay tagumpay na naidagdag!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/tr/messages.json
generated
3
app/_locales/tr/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Hesap $1",
|
"message": "Hesap $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Tahsil edilebilir tutar eklenmedi ve sebebi: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Tahsil edilebilir tutar başarılı bir şekilde eklendi!"
|
"message": "Tahsil edilebilir tutar başarılı bir şekilde eklendi!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/vi/messages.json
generated
3
app/_locales/vi/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "Tài khoản $1",
|
"message": "Tài khoản $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "Bộ sưu tập đã không được thêm vì: $1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "Bộ sưu tập đã được thêm thành công!"
|
"message": "Bộ sưu tập đã được thêm thành công!"
|
||||||
},
|
},
|
||||||
|
3
app/_locales/zh_CN/messages.json
generated
3
app/_locales/zh_CN/messages.json
generated
@ -1738,9 +1738,6 @@
|
|||||||
"message": "账户 $1",
|
"message": "账户 $1",
|
||||||
"description": "Default name of next account to be created on create account screen"
|
"description": "Default name of next account to be created on create account screen"
|
||||||
},
|
},
|
||||||
"newCollectibleAddFailed": {
|
|
||||||
"message": "未添加收藏,因为:$1"
|
|
||||||
},
|
|
||||||
"newCollectibleAddedMessage": {
|
"newCollectibleAddedMessage": {
|
||||||
"message": "收藏已成功添加!"
|
"message": "收藏已成功添加!"
|
||||||
},
|
},
|
||||||
|
@ -5,7 +5,15 @@ import { util } from '@metamask/controllers';
|
|||||||
import { useI18nContext } from '../../hooks/useI18nContext';
|
import { useI18nContext } from '../../hooks/useI18nContext';
|
||||||
import { DEFAULT_ROUTE } from '../../helpers/constants/routes';
|
import { DEFAULT_ROUTE } from '../../helpers/constants/routes';
|
||||||
|
|
||||||
|
import {
|
||||||
|
DISPLAY,
|
||||||
|
FONT_WEIGHT,
|
||||||
|
TYPOGRAPHY,
|
||||||
|
} from '../../helpers/constants/design-system';
|
||||||
|
|
||||||
import Box from '../../components/ui/box';
|
import Box from '../../components/ui/box';
|
||||||
|
import Typography from '../../components/ui/typography';
|
||||||
|
import ActionableMessage from '../../components/ui/actionable-message';
|
||||||
import PageContainer from '../../components/ui/page-container';
|
import PageContainer from '../../components/ui/page-container';
|
||||||
import {
|
import {
|
||||||
addCollectibleVerifyOwnership,
|
addCollectibleVerifyOwnership,
|
||||||
@ -38,6 +46,7 @@ export default function AddCollectible() {
|
|||||||
);
|
);
|
||||||
const [tokenId, setTokenId] = useState('');
|
const [tokenId, setTokenId] = useState('');
|
||||||
const [disabled, setDisabled] = useState(true);
|
const [disabled, setDisabled] = useState(true);
|
||||||
|
const [collectibleAddFailed, setCollectibleAddFailed] = useState(false);
|
||||||
|
|
||||||
const handleAddCollectible = async () => {
|
const handleAddCollectible = async () => {
|
||||||
try {
|
try {
|
||||||
@ -47,7 +56,7 @@ export default function AddCollectible() {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
const { message } = error;
|
const { message } = error;
|
||||||
dispatch(setNewCollectibleAddedMessage(message));
|
dispatch(setNewCollectibleAddedMessage(message));
|
||||||
history.push(DEFAULT_ROUTE);
|
setCollectibleAddFailed(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (contractAddressToConvertFromTokenToCollectible) {
|
if (contractAddressToConvertFromTokenToCollectible) {
|
||||||
@ -84,24 +93,48 @@ export default function AddCollectible() {
|
|||||||
}}
|
}}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
contentComponent={
|
contentComponent={
|
||||||
<Box padding={4}>
|
<Box padding={[1, 4]}>
|
||||||
{isMainnet &&
|
{isMainnet &&
|
||||||
!useCollectibleDetection &&
|
!useCollectibleDetection &&
|
||||||
!collectibleDetectionNoticeDismissed ? (
|
!collectibleDetectionNoticeDismissed ? (
|
||||||
<CollectiblesDetectionNotice />
|
<CollectiblesDetectionNotice />
|
||||||
) : null}
|
) : null}
|
||||||
<Box>
|
{collectibleAddFailed && (
|
||||||
|
<ActionableMessage
|
||||||
|
type="danger"
|
||||||
|
useIcon="true"
|
||||||
|
iconFillColor="#d73a49"
|
||||||
|
message={
|
||||||
|
<Box display={DISPLAY.INLINE_FLEX}>
|
||||||
|
<Typography
|
||||||
|
variant={TYPOGRAPHY.H7}
|
||||||
|
fontWeight={FONT_WEIGHT.NORMAL}
|
||||||
|
margin={0}
|
||||||
|
>
|
||||||
|
{t('collectibleAddFailedMessage')}
|
||||||
|
</Typography>
|
||||||
|
<button
|
||||||
|
className="fas fa-times add-collectible__close"
|
||||||
|
title={t('close')}
|
||||||
|
onClick={() => setCollectibleAddFailed(false)}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Box marginTop={4}>
|
||||||
<FormField
|
<FormField
|
||||||
id="address"
|
id="address"
|
||||||
titleText={t('address')}
|
titleText={t('address')}
|
||||||
placeholder="0x..."
|
placeholder="0x..."
|
||||||
value={address}
|
value={address}
|
||||||
onChange={(val) => validateAndSetAddress(val)}
|
onChange={(val) => {
|
||||||
|
validateAndSetAddress(val);
|
||||||
|
setCollectibleAddFailed(false);
|
||||||
|
}}
|
||||||
tooltipText={t('importNFTAddressToolTip')}
|
tooltipText={t('importNFTAddressToolTip')}
|
||||||
autoFocus
|
autoFocus
|
||||||
/>
|
/>
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
<FormField
|
<FormField
|
||||||
id="token-id"
|
id="token-id"
|
||||||
titleText={t('tokenId')}
|
titleText={t('tokenId')}
|
||||||
@ -109,6 +142,7 @@ export default function AddCollectible() {
|
|||||||
value={tokenId}
|
value={tokenId}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
validateAndSetTokenId(val);
|
validateAndSetTokenId(val);
|
||||||
|
setCollectibleAddFailed(false);
|
||||||
}}
|
}}
|
||||||
tooltipText={t('importNFTTokenIdToolTip')}
|
tooltipText={t('importNFTTokenIdToolTip')}
|
||||||
numeric
|
numeric
|
||||||
|
9
ui/pages/add-collectible/index.scss
Normal file
9
ui/pages/add-collectible/index.scss
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
.add-collectible {
|
||||||
|
&__close {
|
||||||
|
color: var(--ui-black);
|
||||||
|
background: none;
|
||||||
|
flex: 0;
|
||||||
|
align-self: flex-start;
|
||||||
|
padding-right: 0;
|
||||||
|
}
|
||||||
|
}
|
@ -303,27 +303,21 @@ export default class Home extends PureComponent {
|
|||||||
: null
|
: null
|
||||||
///: END:ONLY_INCLUDE_IN
|
///: END:ONLY_INCLUDE_IN
|
||||||
}
|
}
|
||||||
{newCollectibleAddedMessage ? (
|
{newCollectibleAddedMessage === 'success' ? (
|
||||||
<ActionableMessage
|
<ActionableMessage
|
||||||
type={newCollectibleAddedMessage === 'success' ? 'info' : 'warning'}
|
type="info"
|
||||||
className="home__new-network-notification"
|
className="home__new-network-notification"
|
||||||
message={
|
message={
|
||||||
<div className="home__new-network-notification-message">
|
<div className="home__new-network-notification-message">
|
||||||
{newCollectibleAddedMessage === 'success' ? (
|
|
||||||
<img
|
<img
|
||||||
src="./images/check_circle.svg"
|
src="./images/check_circle.svg"
|
||||||
className="home__new-network-notification-message--image"
|
className="home__new-network-notification-message--image"
|
||||||
/>
|
/>
|
||||||
) : null}
|
|
||||||
<Typography
|
<Typography
|
||||||
variant={TYPOGRAPHY.H7}
|
variant={TYPOGRAPHY.H7}
|
||||||
fontWeight={FONT_WEIGHT.NORMAL}
|
fontWeight={FONT_WEIGHT.NORMAL}
|
||||||
>
|
>
|
||||||
{newCollectibleAddedMessage === 'success'
|
{t('newCollectibleAddedMessage')}
|
||||||
? t('newCollectibleAddedMessage')
|
|
||||||
: t('newCollectibleAddFailed', [
|
|
||||||
newCollectibleAddedMessage,
|
|
||||||
])}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
<button
|
<button
|
||||||
className="fas fa-times home__close"
|
className="fas fa-times home__close"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
/** Please import your files in alphabetical order **/
|
/** Please import your files in alphabetical order **/
|
||||||
|
@import 'add-collectible/index';
|
||||||
@import 'import-token/index';
|
@import 'import-token/index';
|
||||||
@import 'asset/asset';
|
@import 'asset/asset';
|
||||||
@import 'confirm-import-token/index';
|
@import 'confirm-import-token/index';
|
||||||
|
Loading…
Reference in New Issue
Block a user