1
0
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:
Szymon Lesisz 2018-05-10 17:30:26 +02:00
parent a1bad8a0d6
commit cf863664b7
2 changed files with 18 additions and 5 deletions

View File

@ -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"

View File

@ -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 {