mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Adding Refresh list
and import tokens
link to the main page (#11755)
This commit is contained in:
parent
18c35ad91e
commit
769beb2a26
@ -1085,6 +1085,9 @@
|
||||
"importTokenWarning": {
|
||||
"message": "Anyone can create a token with any name, including fake versions of existing tokens. Add and trade at your own risk!"
|
||||
},
|
||||
"importTokens": {
|
||||
"message": "import tokens"
|
||||
},
|
||||
"importWallet": {
|
||||
"message": "Import wallet"
|
||||
},
|
||||
@ -1328,8 +1331,11 @@
|
||||
"message": "verify the network details",
|
||||
"description": "Serves as link text for the 'mismatchedChain' key. This text will be embedded inside the translation for that key."
|
||||
},
|
||||
"missingToken": {
|
||||
"message": "Don't see your token?"
|
||||
},
|
||||
"mobileSyncWarning": {
|
||||
"message": "The 'Sync with extension' feature is temporarily disabled. If you want to use your extension wallet on MetaMask mobile, then on your mobile app: go back to the wallet setup options and select the 'Import with Secret Recovery Phrase' option. Use your extension wallet’s secret phrase to then import your wallet into mobile."
|
||||
"message": "⚠️ Proceeding will display a secret QR code that allows access to your accounts. Do not share it with anyone. Support staff will never ask you for it."
|
||||
},
|
||||
"mustSelectOne": {
|
||||
"message": "Must select at least 1 token."
|
||||
@ -1700,6 +1706,9 @@
|
||||
"recoveryPhraseReminderTitle": {
|
||||
"message": "Protect your funds"
|
||||
},
|
||||
"refreshList": {
|
||||
"message": "Refresh list"
|
||||
},
|
||||
"reject": {
|
||||
"message": "Reject"
|
||||
},
|
||||
|
@ -1179,6 +1179,12 @@ export default class MetamaskController extends EventEmitter {
|
||||
this.appStateController.removePollingToken,
|
||||
this.appStateController,
|
||||
),
|
||||
|
||||
// DetectTokenController
|
||||
detectNewTokens: nodeify(
|
||||
this.detectTokensController.detectNewTokens,
|
||||
this.detectTokensController,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -501,9 +501,9 @@ describe('MetaMask', function () {
|
||||
await driver.delay(largeDelayMs);
|
||||
});
|
||||
|
||||
it('clicks on the Add Token button', async function () {
|
||||
it('clicks on the import tokens button', async function () {
|
||||
await driver.clickElement(`[data-testid="home__asset-tab"]`);
|
||||
await driver.clickElement({ text: 'Add Token', tag: 'button' });
|
||||
await driver.clickElement({ text: 'import tokens', tag: 'a' });
|
||||
await driver.delay(regularDelayMs);
|
||||
});
|
||||
|
||||
|
@ -79,7 +79,7 @@ describe('Add existing token using search', function () {
|
||||
await driver.fill('#password', 'correct horse battery staple');
|
||||
await driver.press('#password', driver.Key.ENTER);
|
||||
|
||||
await driver.clickElement({ text: 'Add Token', tag: 'button' });
|
||||
await driver.clickElement({ text: 'import tokens', tag: 'a' });
|
||||
await driver.fill('#search-tokens', 'BAT');
|
||||
await driver.clickElement({ text: 'BAT', tag: 'span' });
|
||||
await driver.clickElement({ text: 'Next', tag: 'button' });
|
||||
|
@ -1 +0,0 @@
|
||||
export { default } from './add-token-button.component';
|
@ -1,6 +0,0 @@
|
||||
.add-token-button {
|
||||
&__button {
|
||||
max-width: 200px;
|
||||
margin: 16px auto;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/** Please import your files in alphabetical order **/
|
||||
@import 'account-list-item/index';
|
||||
@import 'account-menu/index';
|
||||
@import 'add-token-button/index';
|
||||
@import 'import-token-link/index';
|
||||
@import 'advanced-gas-controls/index';
|
||||
@import 'alerts/alerts';
|
||||
@import 'app-header/index';
|
||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
import AddTokenButton from '../add-token-button';
|
||||
import ImportTokenLink from '../import-token-link';
|
||||
import TokenList from '../token-list';
|
||||
import { ADD_TOKEN_ROUTE } from '../../../helpers/constants/routes';
|
||||
import AssetListItem from '../asset-list-item';
|
||||
@ -16,8 +16,18 @@ import {
|
||||
} from '../../../selectors';
|
||||
import { getNativeCurrency } from '../../../ducks/metamask/metamask';
|
||||
import { useCurrencyDisplay } from '../../../hooks/useCurrencyDisplay';
|
||||
import Typography from '../../ui/typography/typography';
|
||||
import Box from '../../ui/box/box';
|
||||
import {
|
||||
COLORS,
|
||||
TYPOGRAPHY,
|
||||
FONT_WEIGHT,
|
||||
JUSTIFY_CONTENT,
|
||||
} from '../../../helpers/constants/design-system';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
|
||||
const AssetList = ({ onClickAsset }) => {
|
||||
const t = useI18nContext();
|
||||
const history = useHistory();
|
||||
const selectedAccountBalance = useSelector(
|
||||
(state) => getCurrentAccountWithSendEtherInfo(state).balance,
|
||||
@ -85,12 +95,23 @@ const AssetList = ({ onClickAsset }) => {
|
||||
selectTokenEvent();
|
||||
}}
|
||||
/>
|
||||
<AddTokenButton
|
||||
onClick={() => {
|
||||
history.push(ADD_TOKEN_ROUTE);
|
||||
addTokenEvent();
|
||||
}}
|
||||
/>
|
||||
<Box marginTop={4}>
|
||||
<Box justifyContent={JUSTIFY_CONTENT.CENTER}>
|
||||
<Typography
|
||||
color={COLORS.UI4}
|
||||
variant={TYPOGRAPHY.H6}
|
||||
fontWeight={FONT_WEIGHT.NORMAL}
|
||||
>
|
||||
{t('missingToken')}
|
||||
</Typography>
|
||||
</Box>
|
||||
<ImportTokenLink
|
||||
onClick={() => {
|
||||
history.push(ADD_TOKEN_ROUTE);
|
||||
addTokenEvent();
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -4,8 +4,11 @@ import { useMetricEvent } from '../../../hooks/useMetricEvent';
|
||||
import { useI18nContext } from '../../../hooks/useI18nContext';
|
||||
import { ADD_TOKEN_ROUTE } from '../../../helpers/constants/routes';
|
||||
import Button from '../../ui/button';
|
||||
import Box from '../../ui/box/box';
|
||||
import { TEXT_ALIGN } from '../../../helpers/constants/design-system';
|
||||
import { detectNewTokens } from '../../../store/actions';
|
||||
|
||||
export default function AddTokenButton() {
|
||||
export default function ImportTokenLink() {
|
||||
const addTokenEvent = useMetricEvent({
|
||||
eventOpts: {
|
||||
category: 'Navigation',
|
||||
@ -17,18 +20,25 @@ export default function AddTokenButton() {
|
||||
const history = useHistory();
|
||||
|
||||
return (
|
||||
<div className="add-token-button">
|
||||
<Box className="import-token-link" textAlign={TEXT_ALIGN.CENTER}>
|
||||
<Button
|
||||
className="add-token-button__button"
|
||||
type="secondary"
|
||||
rounded
|
||||
className="import-token-link__link"
|
||||
type="link"
|
||||
onClick={() => detectNewTokens()}
|
||||
>
|
||||
{t('refreshList')}
|
||||
</Button>
|
||||
{' or '}
|
||||
<Button
|
||||
className="import-token-link__link"
|
||||
type="link"
|
||||
onClick={() => {
|
||||
history.push(ADD_TOKEN_ROUTE);
|
||||
addTokenEvent();
|
||||
}}
|
||||
>
|
||||
{t('addToken')}
|
||||
{t('importTokens')}
|
||||
</Button>
|
||||
</div>
|
||||
</Box>
|
||||
);
|
||||
}
|
1
ui/components/app/import-token-link/index.js
Normal file
1
ui/components/app/import-token-link/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './import-token-link.component';
|
8
ui/components/app/import-token-link/index.scss
Normal file
8
ui/components/app/import-token-link/index.scss
Normal file
@ -0,0 +1,8 @@
|
||||
.import-token-link {
|
||||
& &__link {
|
||||
@include H6;
|
||||
|
||||
display: inline;
|
||||
padding: 0 0 16px;
|
||||
}
|
||||
}
|
@ -2856,3 +2856,8 @@ export async function setUnconnectedAccountAlertShown(origin) {
|
||||
export async function setWeb3ShimUsageAlertDismissed(origin) {
|
||||
await promisifiedBackground.setWeb3ShimUsageAlertDismissed(origin);
|
||||
}
|
||||
|
||||
// DetectTokenController
|
||||
export async function detectNewTokens() {
|
||||
return promisifiedBackground.detectNewTokens();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user