aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers/connected_account_payment_method.ts
blob: ee57d182903f668ab0a9ecb1de610a7df6989b34 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as React from 'react';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';

import { PaymentMethod } from '../components/payment_method';
import { Action, actions } from '../redux/actions';
import { State } from '../redux/reducer';
import { Account, Network, StandardSlidingPanelContent } from '../types';

export interface ConnectedAccountPaymentMethodProps {}

interface ConnectedState {
    account: Account;
    network: Network;
}

interface ConnectedDispatch {
    openStandardSlidingPanel: (content: StandardSlidingPanelContent) => void;
}

const mapStateToProps = (state: State, _ownProps: ConnectedAccountPaymentMethodProps): ConnectedState => ({
    account: state.providerState.account,
    network: state.network,
});

const mapDispatchToProps = (
    dispatch: Dispatch<Action>,
    ownProps: ConnectedAccountPaymentMethodProps,
): ConnectedDispatch => ({
    openStandardSlidingPanel: (content: StandardSlidingPanelContent) =>
        dispatch(actions.openStandardSlidingPanel(content)),
});

export const ConnectedAccountPaymentMethod: React.ComponentClass<ConnectedAccountPaymentMethodProps> = connect(
    mapStateToProps,
    mapDispatchToProps,
)(PaymentMethod);