-
Notifications
You must be signed in to change notification settings - Fork 504
/
index.js
154 lines (144 loc) · 3.92 KB
/
index.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
import React from 'react'
import styled from 'styled-components'
import { prop } from 'ramda'
import { compose, bindActionCreators } from 'redux'
import { connect } from 'react-redux'
import { FormattedMessage } from 'react-intl'
import { reduxForm } from 'redux-form'
import { actions, model, selectors } from 'data'
import modalEnhancer from 'providers/ModalEnhancer'
import {
Button,
HeartbeatLoader,
Image,
Modal,
ModalBody,
ModalHeader,
Text
} from 'blockchain-info-components'
const { CAMPAIGNS } = model.components.identityVerification
const AbsoluteModalHeader = styled(ModalHeader)`
position: absolute;
border: none;
> span {
&:hover {
cursor: pointer;
}
}
z-index: 99;
`
const Body = styled(ModalBody)`
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
text-align: center;
margin-top: 24px;
`
const Header = styled(Text)`
font-size: 24px;
font-weight: 600;
margin-top: 18px;
color: ${props => props.theme['gray-6']};
`
const Copy = styled(Text)`
margin-top: 16px;
font-weight: 500;
line-height: 1.6;
max-width: 300px;
color: ${props => props.theme['gray-6']};
`
const FooterButton = styled(Button)`
height: 56px;
font-weight: 500;
margin-top: 24px;
`
class AirdropClaim extends React.PureComponent {
componentDidMount () {
this.props.preferencesActions.hideAirdropClaimModal()
}
render () {
const {
actions,
campaign,
close,
isCampaignTagged,
position,
submitting,
total
} = this.props
return (
<Modal size='small' position={position} total={total}>
<AbsoluteModalHeader onClose={close} />
<Body>
<Image width='52px' name='gold-verified' />
<Header>
<FormattedMessage
id='modals.airdropclaim.claimairdrop'
defaultMessage='Claim Your Airdrop'
/>
</Header>
{isCampaignTagged ? (
<Copy>
<FormattedMessage
id='modals.airdropclaim.thanksforparticipating'
defaultMessage='Thanks for claiming your airdrop. You should be receiving your {coinName} ({coinCode}) soon!'
values={{
coinName: prop('coinName', CAMPAIGNS[campaign]),
coinCode: prop('coinCode', CAMPAIGNS[campaign])
}}
/>
</Copy>
) : (
<Copy weight={400}>
<FormattedMessage
id='modals.airdropclaim.completeprofilefree'
defaultMessage='You’re eligible for our airdrop program. Click the button to join our Airdrop Program.'
/>
</Copy>
)}
{!isCampaignTagged && (
<FooterButton
nature='primary'
size='18px'
fullwidth
type='submit'
disabled={submitting}
onClick={() => actions.airdropClaimSubmitClicked(campaign)}
>
{submitting ? (
<HeartbeatLoader height='20px' width='20px' color='white' />
) : (
<FormattedMessage
defaultMessage='Claim My Free Airdrop'
id='modals.airdropclaim.claimairdropnow'
/>
)}
</FooterButton>
)}
</Body>
</Modal>
)
}
}
AirdropClaim.defaultProps = {
campaign: 'sunriver'
}
const mapStateToProps = state => ({
isCampaignTagged: selectors.modules.profile
.getSunRiverTag(state)
.getOrElse(false)
})
const mapDispatchToProps = dispatch => ({
actions: bindActionCreators(actions.components.onboarding, dispatch),
preferencesActions: bindActionCreators(actions.preferences, dispatch)
})
const enhance = compose(
modalEnhancer('AirdropClaim'),
reduxForm({ form: 'airdropClaim' }),
connect(
mapStateToProps,
mapDispatchToProps
)
)
export default enhance(AirdropClaim)