1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-29 02:18:06 +00:00

removed <SelectedAccount> from components

This commit is contained in:
Szymon Lesisz 2018-10-03 17:39:23 +02:00
parent b6843d0ad0
commit 8229317ccf
3 changed files with 293 additions and 300 deletions

View File

@ -11,8 +11,6 @@ import colors from 'config/colors';
import Tooltip from 'components/Tooltip';
import { QRCode } from 'react-qr-svg';
import SelectedAccount from 'views/Wallet/components/SelectedAccount';
import { FONT_SIZE, FONT_WEIGHT, FONT_FAMILY } from 'config/variables';
import type { Props } from './Container';
@ -124,9 +122,10 @@ const AccountReceive = (props: Props) => {
const {
account,
discovery,
shouldRender,
} = props.selectedAccount;
if (!device || !account || !discovery) return null;
if (!device || !account || !discovery || !shouldRender) return null;
const {
addressVerified,
@ -143,7 +142,6 @@ const AccountReceive = (props: Props) => {
const isAddressHidden = !isAddressVerifying && !addressVerified && !addressUnverified;
return (
<SelectedAccount {...props}>
<Content>
<Wrapper>
<H2>Receive Ethereum or tokens</H2>
@ -219,7 +217,6 @@ const AccountReceive = (props: Props) => {
</AddressWrapper>
</Wrapper>
</Content>
</SelectedAccount>
);
};

View File

@ -13,7 +13,6 @@ import colors from 'config/colors';
import P from 'components/Paragraph';
import { H2 } from 'components/Heading';
import Content from 'views/Wallet/components/Content';
import SelectedAccount from 'views/Wallet/components/SelectedAccount';
import type { Token } from 'flowtype';
import AdvancedForm from './components/AdvancedForm';
import PendingTransactions from './components/PendingTransactions';
@ -176,6 +175,7 @@ const AccountSend = (props: Props) => {
network,
discovery,
tokens,
shouldRender,
} = props.selectedAccount;
const {
address,
@ -205,7 +205,7 @@ const AccountSend = (props: Props) => {
onSend,
} = props.sendFormActions;
if (!device || !account || !discovery || !network) return null;
if (!device || !account || !discovery || !network || !shouldRender) return null;
let isSendButtonDisabled: boolean = Object.keys(errors).length > 0 || total === '0' || amount.length === 0 || address.length === 0 || sending;
let sendButtonText: string = 'Send';
@ -230,7 +230,6 @@ const AccountSend = (props: Props) => {
const isAdvancedSettingsHidden = !advanced;
return (
<SelectedAccount {...props}>
<Content>
<Wrapper>
<H2>Send Ethereum or tokens</H2>
@ -375,7 +374,6 @@ const AccountSend = (props: Props) => {
)}
</Wrapper>
</Content>
</SelectedAccount>
);
};

View File

@ -12,7 +12,6 @@ import Content from 'views/Wallet/components/Content';
import CoinLogo from 'components/images/CoinLogo';
import * as stateUtils from 'reducers/utils';
import SelectedAccount from 'views/Wallet/components/SelectedAccount';
import Link from 'components/Link';
import AccountBalance from './components/Balance';
import AddedToken from './components/Token';
@ -67,17 +66,17 @@ const AccountSummary = (props: Props) => {
network,
tokens,
pending,
shouldRender,
} = props.selectedAccount;
// flow
if (!device || !account || !network) return <SelectedAccount {...props} />;
if (!device || !account || !network || !shouldRender) return null;
const explorerLink: string = `${network.explorer.address}${account.address}`;
const pendingAmount: BigNumber = stateUtils.getPendingAmount(pending, network.symbol);
const balance: string = new BigNumber(account.balance).minus(pendingAmount).toString(10);
return (
<SelectedAccount {...props}>
<Content>
<AccountHeading>
<AccountName>
@ -158,7 +157,6 @@ const AccountSummary = (props: Props) => {
))}
</AddedTokensWrapper>
</Content>
</SelectedAccount>
);
};