mirror of https://github.com/trezor/trezor-wallet
parent
49ca5992fd
commit
e59c9ec714
@ -0,0 +1,55 @@
|
||||
/* @flow */
|
||||
import { bindActionCreators } from 'redux';
|
||||
import { connect } from 'react-redux';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
|
||||
import ModalActions from 'actions/ModalActions';
|
||||
import ReceiveActions from 'actions/ReceiveActions';
|
||||
|
||||
import type { MapStateToProps, MapDispatchToProps } from 'react-redux';
|
||||
import type { State, Dispatch } from 'flowtype';
|
||||
|
||||
import Modal from './index';
|
||||
|
||||
type OwnProps = { }
|
||||
|
||||
type StateProps = {
|
||||
modal: $ElementType<State, 'modal'>,
|
||||
accounts: $ElementType<State, 'accounts'>,
|
||||
devices: $ElementType<State, 'devices'>,
|
||||
connect: $ElementType<State, 'connect'>,
|
||||
selectedAccount: $ElementType<State, 'selectedAccount'>,
|
||||
sendForm: $ElementType<State, 'sendForm'>,
|
||||
receive: $ElementType<State, 'receive'>,
|
||||
localStorage: $ElementType<State, 'localStorage'>,
|
||||
wallet: $ElementType<State, 'wallet'>,
|
||||
}
|
||||
|
||||
type DispatchProps = {
|
||||
modalActions: typeof ModalActions,
|
||||
receiveActions: typeof ReceiveActions,
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
||||
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (state: State): StateProps => ({
|
||||
modal: state.modal,
|
||||
accounts: state.accounts,
|
||||
devices: state.devices,
|
||||
connect: state.connect,
|
||||
selectedAccount: state.selectedAccount,
|
||||
sendForm: state.sendForm,
|
||||
receive: state.receive,
|
||||
localStorage: state.localStorage,
|
||||
wallet: state.wallet,
|
||||
});
|
||||
|
||||
const mapDispatchToProps: MapDispatchToProps<Dispatch, OwnProps, DispatchProps> = (dispatch: Dispatch): DispatchProps => ({
|
||||
modalActions: bindActionCreators(ModalActions, dispatch),
|
||||
receiveActions: bindActionCreators(ReceiveActions, dispatch),
|
||||
});
|
||||
|
||||
// export default connect(mapStateToProps, mapDispatchToProps)(Modal);
|
||||
export default withRouter(
|
||||
connect(mapStateToProps, mapDispatchToProps)(Modal),
|
||||
);
|
@ -1,27 +1,31 @@
|
||||
/* @flow */
|
||||
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import styled from 'styled-components';
|
||||
|
||||
import { H3 } from 'components/Heading';
|
||||
import P from 'components/Paragraph';
|
||||
import { CONTEXT_DEVICE } from 'actions/constants/modal';
|
||||
|
||||
import type { Props } from '../../index';
|
||||
import type { TrezorDevice } from 'flowtype';
|
||||
|
||||
type Props = {
|
||||
device: TrezorDevice;
|
||||
}
|
||||
|
||||
const Wrapper = styled.div`
|
||||
padding: 24px 48px;
|
||||
`;
|
||||
|
||||
const InvalidPin = (props: Props) => {
|
||||
if (props.modal.context !== CONTEXT_DEVICE) return null;
|
||||
const InvalidPin = (props: Props) => (
|
||||
<Wrapper>
|
||||
<H3>Entered PIN for { props.device.label } is not correct</H3>
|
||||
<P isSmaller>Retrying...</P>
|
||||
</Wrapper>
|
||||
);
|
||||
|
||||
const { device } = props.modal;
|
||||
return (
|
||||
<Wrapper>
|
||||
<H3>Entered PIN for { device.label } is not correct</H3>
|
||||
<P isSmaller>Retrying...</P>
|
||||
</Wrapper>
|
||||
);
|
||||
InvalidPin.propTypes = {
|
||||
device: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
export default InvalidPin;
|
Loading…
Reference in new issue