1
0
mirror of https://github.com/trezor/trezor-wallet synced 2025-02-15 01:22:01 +00:00

add empty content to both sections in menu

This commit is contained in:
Vladimir Volek 2019-05-23 15:03:11 +02:00
parent 01ddcf5349
commit 814ed30940

View File

@ -93,6 +93,25 @@ class CoinMenu extends PureComponent<Props> {
});
}
getEmptyContent() {
return (
<Empty>
<Gray>
<FormattedMessage
{...l10nMessages.TR_SELECT_COINS}
values={{
TR_SELECT_COINS_LINK: (
<StyledLinkEmpty to="/settings">
<FormattedMessage {...l10nMessages.TR_SELECT_COINS_LINK} />
</StyledLinkEmpty>
),
}}
/>{' '}
</Gray>
</Empty>
);
}
isTopMenuEmpty() {
const numberOfVisibleNetworks = this.props.localStorage.config.networks
.filter(item => !item.isHidden) // hide coins globally in config
@ -119,24 +138,7 @@ class CoinMenu extends PureComponent<Props> {
const { config } = this.props.localStorage;
return (
<Wrapper data-test="Main__page__coin__menu">
{this.isMenuEmpty() && (
<Empty>
<Gray>
<FormattedMessage
{...l10nMessages.TR_SELECT_COINS}
values={{
TR_SELECT_COINS_LINK: (
<StyledLinkEmpty to="/settings">
<FormattedMessage
{...l10nMessages.TR_SELECT_COINS_LINK}
/>
</StyledLinkEmpty>
),
}}
/>{' '}
</Gray>
</Empty>
)}
{this.isMenuEmpty() || (this.isTopMenuEmpty() && this.getEmptyContent())}
{config.networks
.filter(item => !item.isHidden) // hide coins globally in config
.filter(item => !hiddenCoins.includes(item.shortcut)) // hide coins by user settings
@ -154,14 +156,15 @@ class CoinMenu extends PureComponent<Props> {
/>
</NavLink>
))}
{!this.isBottomMenuEmpty() && (
{!this.isMenuEmpty() && (
<Divider
testId="Main__page__coin__menu__divider"
textLeft={<FormattedMessage {...l10nMessages.TR_OTHER_COINS} />}
hasBorder
/>
)}
{this.getOtherCoins()}
{this.isBottomMenuEmpty() && this.getEmptyContent()}
{!this.isBottomMenuEmpty() && this.getOtherCoins()}
</Wrapper>
);
}