mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 09:18:09 +00:00
token already added message
This commit is contained in:
parent
a1bad8a0d6
commit
cf863664b7
@ -73,14 +73,27 @@ const _render = (props: Props, state: AccountState): React$Element<string> => {
|
|||||||
onChange={ token => props.addToken(token, account) }
|
onChange={ token => props.addToken(token, account) }
|
||||||
loadOptions={ input => props.loadTokens(input, account.network) }
|
loadOptions={ input => props.loadTokens(input, account.network) }
|
||||||
filterOptions= {
|
filterOptions= {
|
||||||
(options: Array<NetworkToken>, search: string, values) => {
|
(options: Array<NetworkToken>, search: string, values: Array<NetworkToken>) => {
|
||||||
return options.filter(o => {
|
return options.map(o => {
|
||||||
return !tokens.find(t => t.symbol === o.symbol);
|
const added = tokens.find(t => t.symbol === o.symbol);
|
||||||
|
if (added) {
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
name: `${o.name} (Already added)`,
|
||||||
|
disabled: true
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return o;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// return options.filter(o => {
|
||||||
|
// return !tokens.find(t => t.symbol === o.symbol);
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
valueKey="symbol"
|
valueKey="symbol"
|
||||||
labelKey="symbol"
|
labelKey="name"
|
||||||
placeholder="Search for token"
|
placeholder="Search for token"
|
||||||
searchPromptText="Type token name or address"
|
searchPromptText="Type token name or address"
|
||||||
noResultsText="Token not found"
|
noResultsText="Token not found"
|
||||||
|
@ -213,7 +213,7 @@ aside {
|
|||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
margin-right: 4px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// .device-menu {
|
// .device-menu {
|
||||||
|
Loading…
Reference in New Issue
Block a user