-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
container.tsx
48 lines (43 loc) · 1.49 KB
/
container.tsx
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
38
39
40
41
42
43
44
45
46
47
48
import Airdrop from '.'
import * as WalletsGen from '../../actions/wallets-gen'
import * as RouteTreeGen from '../../actions/route-tree-gen'
import * as Container from '../../util/container'
type OwnProps = Container.RouteProps<{}, {}>
const mapStateToProps = state => ({
_details: state.wallets.airdropDetails,
loading: state.wallets.airdropState === 'loading',
signedUp: state.wallets.airdropState === 'accepted',
})
const mapDispatchToProps = dispatch => ({
onBack: () => dispatch(RouteTreeGen.createNavigateUp()),
onCheckQualify: () => dispatch(RouteTreeGen.createNavigateAppend({path: ['airdropQualify']})),
onLoad: () => {
dispatch(WalletsGen.createUpdateAirdropState())
dispatch(WalletsGen.createUpdateAirdropDetails())
},
onReject: () => dispatch(WalletsGen.createChangeAirdrop({accept: false})),
})
const mergeProps = (stateProps, dispatchProps) => ({
headerBody: stateProps._details.header.body,
headerTitle: stateProps._details.header.title,
loading: stateProps.loading,
onBack: dispatchProps.onBack,
onCheckQualify: dispatchProps.onCheckQualify,
onLoad: dispatchProps.onLoad,
onReject: dispatchProps.onReject,
sections: stateProps._details.sections.toArray().map(s => ({
icon: s.icon,
lines: s.lines.toArray().map(l => ({
bullet: l.bullet,
text: l.text,
})),
section: s.section,
})),
signedUp: stateProps.signedUp,
title: 'Airdrop',
})
export default Container.connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
)(Airdrop)