feat(wallet): Close buttons on send/address pages to go back to wallet
This commit is contained in:
parent
35605fc2b3
commit
18ac6fd82d
4 changed files with 32 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { doCheckAddressIsMine, doGetNewAddress, selectReceiveAddress, selectGettingNewAddress } from 'lbry-redux';
|
||||
import WalletAddress from './view';
|
||||
import { withRouter } from 'react-router';
|
||||
|
||||
const select = state => ({
|
||||
receiveAddress: selectReceiveAddress(state),
|
||||
|
@ -12,7 +13,9 @@ const perform = dispatch => ({
|
|||
getNewAddress: () => dispatch(doGetNewAddress()),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(WalletAddress);
|
||||
export default withRouter(
|
||||
connect(
|
||||
select,
|
||||
perform
|
||||
)(WalletAddress)
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// @flow
|
||||
import React from 'react';
|
||||
import { REMOVE } from 'constants/icons';
|
||||
import Button from 'component/button';
|
||||
import CopyableText from 'component/copyableText';
|
||||
import QRCode from 'component/common/qr-code';
|
||||
|
@ -10,6 +11,7 @@ type Props = {
|
|||
receiveAddress: string,
|
||||
getNewAddress: () => void,
|
||||
gettingNewAddress: boolean,
|
||||
history: { goBack: () => void },
|
||||
};
|
||||
|
||||
type State = {
|
||||
|
@ -43,12 +45,17 @@ class WalletAddress extends React.PureComponent<Props, State> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { receiveAddress, getNewAddress, gettingNewAddress } = this.props;
|
||||
const { receiveAddress, getNewAddress, gettingNewAddress, history } = this.props;
|
||||
const { showQR } = this.state;
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={__('Receive Credits')}
|
||||
title={
|
||||
<React.Fragment>
|
||||
{__('Receive Credits')}
|
||||
<Button button="close" icon={REMOVE} onClick={() => history.goBack()} />
|
||||
</React.Fragment>
|
||||
}
|
||||
subtitle={__('Use this address to receive LBC.')}
|
||||
actions={
|
||||
<React.Fragment>
|
||||
|
|
|
@ -2,6 +2,7 @@ import { connect } from 'react-redux';
|
|||
import { selectBalance } from 'lbry-redux';
|
||||
import { doOpenModal } from 'redux/actions/app';
|
||||
import WalletSend from './view';
|
||||
import { withRouter } from 'react-router';
|
||||
|
||||
const perform = dispatch => ({
|
||||
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
||||
|
@ -11,7 +12,9 @@ const select = state => ({
|
|||
balance: selectBalance(state),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
select,
|
||||
perform
|
||||
)(WalletSend);
|
||||
export default withRouter(
|
||||
connect(
|
||||
select,
|
||||
perform
|
||||
)(WalletSend)
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// @flow
|
||||
import * as MODALS from 'constants/modal_types';
|
||||
import { REMOVE } from 'constants/icons';
|
||||
import React from 'react';
|
||||
import Button from 'component/button';
|
||||
import { Form, FormField } from 'component/common/form';
|
||||
|
@ -15,6 +16,7 @@ type DraftTransaction = {
|
|||
type Props = {
|
||||
openModal: (id: string, { address: string, amount: number }) => void,
|
||||
balance: number,
|
||||
history: { goBack: () => void },
|
||||
};
|
||||
|
||||
class WalletSend extends React.PureComponent<Props> {
|
||||
|
@ -34,11 +36,16 @@ class WalletSend extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
render() {
|
||||
const { balance } = this.props;
|
||||
const { balance, history } = this.props;
|
||||
|
||||
return (
|
||||
<Card
|
||||
title={__('Send Credits')}
|
||||
title={
|
||||
<React.Fragment>
|
||||
{__('Send Credits')}
|
||||
<Button button="close" icon={REMOVE} onClick={() => history.goBack()} />
|
||||
</React.Fragment>
|
||||
}
|
||||
subtitle={__('Send LBC to your friends or favorite creators.')}
|
||||
actions={
|
||||
<Formik
|
||||
|
|
Loading…
Add table
Reference in a new issue