prepare empty bitcoin send page, refactor

pull/492/head
Vladimir Volek 5 years ago
parent 50767c77c3
commit c47ca11f8b

@ -1,5 +1,12 @@
{ {
"networks": [ "networks": [
{
"order": 1,
"type": "bitcoin",
"name": "Bitcoin",
"symbol": "BTC",
"shortcut": "btc"
},
{ {
"order": 2, "order": 2,
"type": "ethereum", "type": "ethereum",

@ -138,6 +138,7 @@ export const onNotification = (
}, },
coin: account.network, coin: account.network,
}); });
if (!updatedAccount.success) return; if (!updatedAccount.success) return;
dispatch( dispatch(

@ -14,6 +14,7 @@ type NetworkFeeLevel = {
export type Network = { export type Network = {
order: number, order: number,
isHidden: ?boolean,
type: string, type: string,
name: string, name: string,
testnet?: boolean, testnet?: boolean,

@ -80,6 +80,7 @@ class CoinMenu extends PureComponent<Props> {
return ( return (
<Wrapper data-test="Main__page__coin__menu"> <Wrapper data-test="Main__page__coin__menu">
{config.networks {config.networks
.filter(item => !item.isHidden)
.sort((a, b) => a.order - b.order) .sort((a, b) => a.order - b.order)
.map(item => ( .map(item => (
<NavLink <NavLink

@ -0,0 +1,53 @@
/* @flow */
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { injectIntl } from 'react-intl';
import SendFormActions from 'actions/ripple/SendFormActions';
import { openQrModal } from 'actions/ModalActions';
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
import type { State, Dispatch } from 'flowtype';
import AccountSend from './index';
type OwnProps = {
intl: any,
};
export type StateProps = {
selectedAccount: $ElementType<State, 'selectedAccount'>,
sendForm: $ElementType<State, 'sendFormRipple'>,
wallet: $ElementType<State, 'wallet'>,
fiat: $ElementType<State, 'fiat'>,
localStorage: $ElementType<State, 'localStorage'>,
};
export type DispatchProps = {
sendFormActions: typeof SendFormActions,
openQrModal: typeof openQrModal,
};
export type Props = OwnProps & StateProps & DispatchProps;
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (
state: State
): StateProps => ({
selectedAccount: state.selectedAccount,
sendForm: state.sendFormRipple,
wallet: state.wallet,
fiat: state.fiat,
localStorage: state.localStorage,
});
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (
dispatch: Dispatch
): DispatchProps => ({
sendFormActions: bindActionCreators(SendFormActions, dispatch),
});
export default injectIntl(
connect(
mapStateToProps,
mapDispatchToProps
)(AccountSend)
);

@ -0,0 +1,13 @@
import React from 'react';
import Content from 'views/Wallet/components/Content';
import Title from 'views/Wallet/components/Title';
const AccountSend = () => {
return (
<Content>
<Title>bitcoin</Title>
</Content>
);
};
export default AccountSend;

@ -5,7 +5,7 @@ import { colors, H5 } from 'trezor-ui-components';
import Transaction from 'components/Transaction'; import Transaction from 'components/Transaction';
import type { Network } from 'reducers/LocalStorageReducer'; import type { Network } from 'reducers/LocalStorageReducer';
import type { BaseProps } from '../../index'; import type { BaseProps } from '../../../index';
// import testData from './test.data'; // import testData from './test.data';
type Props = { type Props = {

@ -16,7 +16,7 @@ import AdvancedForm from './components/AdvancedForm';
import PendingTransactions from '../components/PendingTransactions'; import PendingTransactions from '../components/PendingTransactions';
import l10nMessages from './index.messages'; import l10nMessages from './index.messages';
import l10nSendMessages from '../../common.messages'; import l10nSendMessages from '../../../common.messages';
import type { Props } from './Container'; import type { Props } from './Container';
const AmountInputLabelWrapper = styled.div` const AmountInputLabelWrapper = styled.div`

@ -14,7 +14,7 @@ import PendingTransactions from '../components/PendingTransactions';
import AdvancedForm from './components/AdvancedForm'; import AdvancedForm from './components/AdvancedForm';
import l10nMessages from './index.messages'; import l10nMessages from './index.messages';
import l10nSendMessages from '../../common.messages'; import l10nSendMessages from '../../../common.messages';
import type { Props } from './Container'; import type { Props } from './Container';

@ -3,8 +3,9 @@ import React from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import type { State } from 'flowtype'; import type { State } from 'flowtype';
import EthereumTypeSendForm from './ethereum/Container'; import EthereumTypeSendForm from './components/ethereum/Container';
import RippleTypeSendForm from './ripple/Container'; import RippleTypeSendForm from './components/ripple/Container';
import BitcoinTypeSendForm from './components/bitcoin/Container';
export type BaseProps = { export type BaseProps = {
selectedAccount: $ElementType<State, 'selectedAccount'>, selectedAccount: $ElementType<State, 'selectedAccount'>,
@ -25,6 +26,8 @@ export default connect(
return <EthereumTypeSendForm />; return <EthereumTypeSendForm />;
case 'ripple': case 'ripple':
return <RippleTypeSendForm />; return <RippleTypeSendForm />;
case 'bitcoin':
return <BitcoinTypeSendForm />;
default: default:
return null; return null;
} }

@ -74,16 +74,18 @@ const Dashboard = (props: Props) => (
<FormattedMessage {...l10nMessages.TR_YOU_WILL_GAIN_ACCESS} /> <FormattedMessage {...l10nMessages.TR_YOU_WILL_GAIN_ACCESS} />
</StyledP> </StyledP>
<Coins> <Coins>
{props.localStorage.config.networks.map(network => ( {props.localStorage.config.networks
<StyledNavLink .filter(item => !item.isHidden)
key={network.shortcut} .map(network => (
to={`${getBaseUrl(props.wallet.selectedDevice)}/network/${ <StyledNavLink
network.shortcut key={network.shortcut}
}/account/0`} to={`${getBaseUrl(props.wallet.selectedDevice)}/network/${
> network.shortcut
<StyledCoinLogo network={network.shortcut} height={32} /> }/account/0`}
</StyledNavLink> >
))} <StyledCoinLogo network={network.shortcut} height={32} />
</StyledNavLink>
))}
</Coins> </Coins>
</Row> </Row>
</Wrapper> </Wrapper>

Loading…
Cancel
Save