mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
Show warning when no tokens are found after scan (#711)
* Show warning when no tokens are found. * Rework no tokens message so users can still add customs or scan for new ones.
This commit is contained in:
parent
88532cdc3c
commit
b4f2934878
@ -40,7 +40,9 @@ export default class TokenBalances extends React.Component<Props, State> {
|
|||||||
const { showCustomTokenForm, trackedTokens } = this.state;
|
const { showCustomTokenForm, trackedTokens } = this.state;
|
||||||
|
|
||||||
let bottom;
|
let bottom;
|
||||||
if (!hasSavedWalletTokens) {
|
let help;
|
||||||
|
if (tokenBalances.length && !hasSavedWalletTokens) {
|
||||||
|
help = 'Select which tokens you would like to keep track of';
|
||||||
bottom = (
|
bottom = (
|
||||||
<div className="TokenBalances-buttons">
|
<div className="TokenBalances-buttons">
|
||||||
<button className="btn btn-primary btn-block" onClick={this.handleSetWalletTokens}>
|
<button className="btn btn-primary btn-block" onClick={this.handleSetWalletTokens}>
|
||||||
@ -76,28 +78,31 @@ export default class TokenBalances extends React.Component<Props, State> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{!hasSavedWalletTokens && (
|
{help && <p className="TokenBalances-help">{help}</p>}
|
||||||
<p className="TokenBalances-help">Select which tokens you would like to keep track of</p>
|
|
||||||
|
{tokenBalances.length ? (
|
||||||
|
<table className="TokenBalances-rows">
|
||||||
|
<tbody>
|
||||||
|
{tokenBalances.map(
|
||||||
|
token =>
|
||||||
|
token ? (
|
||||||
|
<TokenRow
|
||||||
|
key={token.symbol}
|
||||||
|
balance={token.balance}
|
||||||
|
symbol={token.symbol}
|
||||||
|
custom={token.custom}
|
||||||
|
decimal={token.decimal}
|
||||||
|
tracked={trackedTokens[token.symbol]}
|
||||||
|
toggleTracked={!hasSavedWalletTokens && this.toggleTrack}
|
||||||
|
onRemove={this.props.onRemoveCustomToken}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
) : (
|
||||||
|
<div className="well well-sm text-center">No tokens found</div>
|
||||||
)}
|
)}
|
||||||
<table className="TokenBalances-rows">
|
|
||||||
<tbody>
|
|
||||||
{tokenBalances.map(
|
|
||||||
token =>
|
|
||||||
token ? (
|
|
||||||
<TokenRow
|
|
||||||
key={token.symbol}
|
|
||||||
balance={token.balance}
|
|
||||||
symbol={token.symbol}
|
|
||||||
custom={token.custom}
|
|
||||||
decimal={token.decimal}
|
|
||||||
tracked={trackedTokens[token.symbol]}
|
|
||||||
toggleTracked={!hasSavedWalletTokens && this.toggleTrack}
|
|
||||||
onRemove={this.props.onRemoveCustomToken}
|
|
||||||
/>
|
|
||||||
) : null
|
|
||||||
)}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{bottom}
|
{bottom}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -14,6 +14,11 @@
|
|||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&-none {
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: -5px;
|
||||||
|
}
|
||||||
|
|
||||||
&-loader {
|
&-loader {
|
||||||
padding: 25px 0;
|
padding: 25px 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
@ -38,7 +38,7 @@ interface ActionProps {
|
|||||||
}
|
}
|
||||||
type Props = StateProps & ActionProps;
|
type Props = StateProps & ActionProps;
|
||||||
|
|
||||||
class TokenBalances extends React.Component<Props, {}> {
|
class TokenBalances extends React.Component<Props> {
|
||||||
public render() {
|
public render() {
|
||||||
const {
|
const {
|
||||||
tokens,
|
tokens,
|
||||||
@ -96,6 +96,7 @@ class TokenBalances extends React.Component<Props, {}> {
|
|||||||
private scanWalletForTokens = () => {
|
private scanWalletForTokens = () => {
|
||||||
if (this.props.wallet) {
|
if (this.props.wallet) {
|
||||||
this.props.scanWalletForTokens(this.props.wallet);
|
this.props.scanWalletForTokens(this.props.wallet);
|
||||||
|
this.setState({ hasScanned: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user