Skip to content

Commit 4389bfe

Browse files
authored
Merge pull request #313 from akumar1503/fix-2857-connect-app
Fix for issue# 2857 on connect-app
2 parents 34d14a2 + dc5ef15 commit 4389bfe

File tree

3 files changed

+37
-38
lines changed

3 files changed

+37
-38
lines changed

components/Formsy/PhoneInput.jsx

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ class PhoneInput extends Component {
1515

1616
constructor(props) {
1717
super(props)
18-
18+
1919
this.changeValue = this.changeValue.bind(this)
2020
this.choseCountry = this.choseCountry.bind(this)
21-
this.isValidInput= this.isValidInput.bind(this)
21+
this.isValidInput = this.isValidInput.bind(this)
2222
this.state = {
2323
currentCountry: {},
2424
asYouType: {}
@@ -36,11 +36,11 @@ class PhoneInput extends Component {
3636
this.props.setValue(value)
3737
let currentCountry
3838
const asYouType = new AsYouType()
39-
asYouType.input(value)
39+
asYouType.input(value[0] === '+' ? value : '+' + value)
4040
if (asYouType.country) {
41-
currentCountry = _.filter(this.props.listCountry, {alpha2: asYouType.country})[0]
41+
currentCountry = _.filter(this.props.listCountry, { alpha2: asYouType.country })[0]
4242
if (currentCountry) {
43-
this.setState({asYouType, currentCountry})
43+
this.setState({ asYouType, currentCountry })
4444
}
4545
}
4646

@@ -54,15 +54,15 @@ class PhoneInput extends Component {
5454
choseCountry(country) {
5555
if (country.code !== this.state.currentCountry.code) {
5656
const asYouTypeTmp = new AsYouType(country.alpha2)
57-
const {asYouType} = this.state
57+
const { asYouType } = this.state
5858
let phoneNumber = ''
5959
if (asYouType && asYouType.getNationalNumber) {
6060
phoneNumber = ` ${asYouType.getNationalNumber()}`
6161
}
6262

6363
if (asYouTypeTmp.countryCallingCode) {
64-
this.setState({currentCountry: country})
65-
this.changeValue({target: { value: `+${asYouTypeTmp.countryCallingCode}${phoneNumber}` }})
64+
this.setState({ currentCountry: country })
65+
this.changeValue({ target: { value: `+${asYouTypeTmp.countryCallingCode}${phoneNumber}` } })
6666
}
6767
}
6868
}
@@ -76,7 +76,7 @@ class PhoneInput extends Component {
7676
[styles['readonly-wrapper']]: readonly,
7777
'phone-input-container': true
7878
})
79-
const classes = classNames('tc-file-field__inputs', {error: hasError}, {empty: this.props.getValue() === ''})
79+
const classes = classNames('tc-file-field__inputs', { error: hasError }, { empty: this.props.getValue() === '' })
8080
const errorMessage = this.props.getErrorMessage() || this.props.validationError
8181

8282
return (
@@ -99,20 +99,20 @@ class PhoneInput extends Component {
9999
max={maxValue}
100100
/>
101101
<Dropdown handleKeyboardNavigation pointerShadow>
102-
<div className="dropdown-menu-header flex center middle">{this.state.currentCountry ? this.state.currentCountry.alpha3 : ''}
102+
<div className="dropdown-menu-header flex center middle">{this.state.currentCountry ? this.state.currentCountry.alpha3 : ''}
103103
<IconDown width={20} height={12} fill="#fff" wrapperClass="arrow" /></div>
104-
<ul className="dropdown-menu-list">
105-
{
106-
this.props.listCountry.map((country, i) => {
107-
/* eslint-disable react/jsx-no-bind */
108-
return <li tabIndex="-1" className={(this.state.currentCountry.code === country.code) ? 'selected' : ''} onClick={() => this.choseCountry(country)} key={i}><a href="javascript:;">{country.name}</a></li>
109-
})
110-
}
111-
</ul>
112-
</Dropdown>
104+
<ul className="dropdown-menu-list">
105+
{
106+
this.props.listCountry.map((country, i) => {
107+
/* eslint-disable react/jsx-no-bind */
108+
return <li tabIndex="-1" className={(this.state.currentCountry.code === country.code) ? 'selected' : ''} onClick={() => this.choseCountry(country)} key={i}><a href="javascript:;">{country.name}</a></li>
109+
})
110+
}
111+
</ul>
112+
</Dropdown>
113113
</div>
114114
{this.isValidInput() && showCheckMark && (
115-
<IconUICheckSimple wrapperClass="check-success-icon" width={10} height={10} fill="#5CC900"/>
115+
<IconUICheckSimple wrapperClass="check-success-icon" width={10} height={10} fill="#5CC900" />
116116
)}
117117
{readonly && (
118118
<div styleName="readonly-value">
@@ -121,14 +121,14 @@ class PhoneInput extends Component {
121121
</div>
122122
)}
123123

124-
{ hasError ? (<p className="error-message">{errorMessage}</p>) : (this.props.forceErrorMessage && (<p className="error-message">{this.props.forceErrorMessage}</p>))}
124+
{hasError ? (<p className="error-message">{errorMessage}</p>) : (this.props.forceErrorMessage && (<p className="error-message">{this.props.forceErrorMessage}</p>))}
125125
</div>
126126
)
127127
}
128128
}
129129

130130
PhoneInput.defaultProps = {
131-
onChange: () => {},
131+
onChange: () => { },
132132
forceErrorMessage: null,
133133
listCountry: [],
134134
showCheckMark: false

components/RegistrationScreen/index.jsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {Component} from 'react'
1+
import React, { Component } from 'react'
22
import Formsy from 'formsy-react'
33
import TextInput from '../Formsy/TextInput'
44
import PhoneInput from '../Formsy/PhoneInput'
@@ -52,18 +52,18 @@ class RegistrationScreen extends Component {
5252
}
5353

5454
reRender() {
55-
this.setState({update: true})
55+
this.setState({ update: true })
5656
}
5757

58-
onChangeCountry({country}) {
59-
const {vm} = this.props
58+
onChangeCountry({ country }) {
59+
const { vm } = this.props
6060

6161
if (!country || !country.code) {
6262
vm.phoneErrorMessage = 'Please enter a valid phone number.'
6363
this.reRender()
6464
} else {
6565
vm.phoneErrorMessage = null
66-
this.setState({update: true, country})
66+
this.setState({ update: true, country })
6767
}
6868
}
6969

@@ -80,14 +80,14 @@ class RegistrationScreen extends Component {
8080
}
8181

8282
isValidForm() {
83-
const {vm} = this.props
84-
const {canSubmit} = this.state
83+
const { vm } = this.props
84+
const { canSubmit } = this.state
8585
return !vm.loading && canSubmit && !vm.usernameErrorMessage && !vm.emailErrorMessage && !vm.phoneErrorMessage && this.state.country
8686
}
8787

8888
submit(form) {
89-
const {vm} = this.props
90-
const {country} = this.state
89+
const { vm } = this.props
90+
const { country } = this.state
9191
const fullName = form.name
9292
vm.phone = form.phone
9393
vm.title = form.title
@@ -99,13 +99,13 @@ class RegistrationScreen extends Component {
9999
vm.country = country
100100
vm.firstName = fullName.trim().split(' ').slice(0, -1).join(' ')
101101
vm.lastName = fullName.trim().split(' ').slice(-1).join(' ')
102-
102+
103103
vm.submit()
104104

105105
}
106106

107107
render() {
108-
const {vm} = this.props
108+
const { vm } = this.props
109109
let preFillName = vm.firstName ? vm.firstName : null
110110
preFillName = vm.lastName ? `${preFillName} ${vm.lastName}` : preFillName
111111
const preFillEmail = vm.email ? vm.email : null
@@ -114,7 +114,7 @@ class RegistrationScreen extends Component {
114114
<div className="container flex column middle center">
115115
<div className="title">Let's start with introductions</div>
116116
<div className="sub-title">First we need to know you a bit better</div>
117-
{vm.errorMessage && (<div className="server-error-message">{vm.errorMessage}</div>)}
117+
{vm.errorMessage && (<div className="server-error-message">{vm.errorMessage}</div>)}
118118
<Formsy.Form onValidSubmit={this.submit} onValid={this.enableButton} onInvalid={this.disableButton} className="form flex column middle center">
119119
<TextInput
120120
wrapperClass={'input-container'}
@@ -203,7 +203,7 @@ class RegistrationScreen extends Component {
203203
validator={vm.usernameIsFree}
204204
showCheckMark
205205
/>
206-
{ !vm.ssoUser && <PasswordInput
206+
{!vm.ssoUser && <PasswordInput
207207
wrapperClass={'input-container'}
208208
label="Create a password (8–64 characters, A–Z, 0–9, . _ - ! ? allowed)"
209209
name="password"
@@ -227,10 +227,9 @@ class RegistrationScreen extends Component {
227227
wrapperClass={'input-container'}
228228
label="I agree to receive other communications from Topcoder."
229229
name="agreeTerm"
230-
required
231230
/>
232231
<div className="space" />
233-
<button type="submit" className="tc-btn tc-btn-sm tc-btn-primary flex middle center" disabled={vm.loading || !this.state.canSubmit || !this.state.country}>Continue</button>
232+
<button type="submit" className="tc-btn tc-btn-sm tc-btn-primary flex middle center" disabled={vm.loading || !this.state.canSubmit || !this.state.country}>Continue</button>
234233
<div className="by-clicking-continue">By clicking “Continue” you agree to our <a href={vm.termsUrl}>Terms</a> and <a href={vm.privacyUrl}>Privacy Policy</a>.
235234
We are never going to sell your data or send you spam messages. Your email is going to be used for communication purposes only.</div>
236235
</Formsy.Form>

components/Wizard/WizardRight/style.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
box-shadow: inset 0 80px 50px -40px rgba(0,0,0,0.8);
1212
position: absolute;
1313
width: 100%;
14-
height: 100%;
14+
height: 100px;
1515
top: 0;
1616
left: 0;
1717
z-index: 1;

0 commit comments

Comments
 (0)