Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/personal email #1494

Merged
merged 2 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const Footer = styled.div`

const FooterShadowWrapper = ({ fields, footer, ...rest }) => (
<Container {...rest}>
<Fields>{fields}</Fields>
<Fields id={rest.scrollRefId}>{fields}</Fields>
<Footer>{footer}</Footer>
</Container>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ exports[`TierCard renders correctly with column view 1`] = `
nature="primary"
>
<FormattedMessage
defaultMessage="Unlock Gold"
id="components.identityverification.tiercard.goldcta"
defaultMessage="Unlock Gold 🥇"
id="components.identityverification.tiercard.goldctamedal"
values={Object {}}
/>
</TierCard__ActionButton>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ export const ctas = {
),
GOLD: (
<FormattedMessage
id='components.identityverification.tiercard.goldcta'
defaultMessage='Unlock Gold'
id='components.identityverification.tiercard.goldctamedal'
defaultMessage='Unlock Gold 🥇'
/>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import Personal from './template'
import Loading from './template.loading'
import DataError from 'components/DataError'

export const SCROLL_REF_ID = 'scroll-ref-id'

const getCountryElements = countries => [
{
group: '',
Expand All @@ -36,6 +38,11 @@ class PersonalContainer extends React.PureComponent {
this.fetchData()
}

scrollTop = () => {
const overflowElement = document.getElementById(SCROLL_REF_ID)
overflowElement.scrollTop = 0
}

fetchData = () => {
this.props.actions.fetchSupportedCountries()
this.props.actions.fetchStates()
Expand All @@ -52,6 +59,12 @@ class PersonalContainer extends React.PureComponent {
this.props.formActions.clearFields(PERSONAL_FORM, false, false, 'state')
}

onPromptForEmailVerification = e => {
Copy link
Contributor

@schnogz schnogz Mar 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for nice event handler name 🥰

e.preventDefault()
this.scrollTop()
this.setState({ showEmailError: true })
}

editEmail = () => {
this.props.actions.setEmailStep(EMAIL_STEPS.edit)
}
Expand Down Expand Up @@ -88,6 +101,7 @@ class PersonalContainer extends React.PureComponent {
email: initialEmail
}}
showEmail={!this.state.initialEmailVerified}
showEmailError={!emailVerified && this.state.showEmailError}
emailVerified={emailVerified}
email={email}
emailStep={emailStep}
Expand All @@ -103,7 +117,8 @@ class PersonalContainer extends React.PureComponent {
activeFieldError={activeFieldError}
editEmail={this.editEmail}
updateEmail={actions.updateEmail}
sendEmailVerification={actions.sendEmailVerification}
sendEmailVerification={this.onSendEmailVerification}
onPromptForEmailVerification={this.onPromptForEmailVerification}
onAddressSelect={this.selectAddress}
onCountrySelect={this.onCountryChange}
onSubmit={handleSubmit}
Expand Down