Skip to content

Commit 9d0252e

Browse files
author
Maksym Mykhailenko
committed
fix: progressive registration form issue
ref issue #3833 - show "Company Name" for customers - align labels when showing validation errors - added validation for business email - fixed "Send My Request" button typo
1 parent 1296302 commit 9d0252e

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

src/projects/create/components/UpdateUserInfo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ class UpdateUserInfo extends Component {
6262
showAvatar={false}
6363
showBusinessEmail={!isTopcoderUser}
6464
showBusinessPhone={!isTopcoderUser}
65-
showCompanyName={false}
65+
showCompanyName={!isTopcoderUser}
6666
isRequiredTimeZone={isTopcoderUser}
6767
isRequiredCountry={isTopcoderUser}
6868
isRequiredWorkingHours={isTopcoderUser}
6969
isRequiredBusinessEmail={!isTopcoderUser}
70-
submitButton="Send my Request"
70+
submitButton="Send My Request"
7171
showBackButton
7272
onBack={closeUserSettings}
7373
shouldDoValidateOnStart

src/routes/settings/routes/profile/components/ProfileSettingsForm.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,24 @@ class ProfileSettingsForm extends Component {
120120

121121
getField(label, name, isRequired = false, isDisabled = false) {
122122
let validations = null
123+
let validationErrors
124+
123125
if (name === 'businessPhone') {
124126
validations = {
125127
// use same regexp as on server side
126128
matchRegexp: /^\+(?:[0-9] ?){6,14}[0-9]$/,
127129
}
128130
}
129131

132+
if (name === 'businessEmail') {
133+
validations = {
134+
isEmail: true,
135+
}
136+
validationErrors = {
137+
isEmail: 'Please, enter correct email'
138+
}
139+
}
140+
130141
return (
131142
<div className="field">
132143
<div className="label">
@@ -139,7 +150,8 @@ class ProfileSettingsForm extends Component {
139150
name={name}
140151
validations={validations}
141152
value={this.props.values.settings[name] || ''}
142-
validationError={`Please enter ${label}`}
153+
validationError={`Please, enter ${label}`}
154+
validationErrors={validationErrors}
143155
required={isRequired}
144156
disabled={isDisabled}
145157
/>
@@ -340,12 +352,12 @@ class ProfileSettingsForm extends Component {
340352
</div>
341353
<div className="field">
342354
{isRequiredWorkingHours ? (
343-
<div className="label">
355+
<div className="label label-working-hours">
344356
<span styleName="fieldLabelText">Normal Working Hours</span>&nbsp;
345357
<sup styleName="requiredMarker">*</sup>
346358
</div>
347359
) : (
348-
<div className="label">
360+
<div className="label label-working-hours">
349361
<span styleName="fieldLabelText">Normal Working Hours</span>
350362
</div>
351363
)}

src/routes/settings/routes/profile/components/ProfileSettingsForm.scss

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
> .field {
1313
display: flex;
1414
flex-wrap: wrap;
15-
align-items: center;
15+
align-items: flex-start;
1616

1717
@media screen and (max-width: $screen-md - 1px) {
1818
flex-direction: column;
@@ -34,16 +34,26 @@
3434
min-width: 180px;
3535
max-width: 200px;
3636
text-align: right;
37-
padding-right: 15px;
37+
padding: 11px 15px 11px 0;
3838
color: $tc-gray-80;
3939
font-size: 15px;
4040
line-height: 18px;
4141

42+
&.label-working-hours {
43+
padding-top: 28px;
44+
}
45+
4246
@media screen and (max-width: $screen-md - 1px) {
4347
flex: none;
4448
margin-bottom: 10px;
4549
margin-left: 10px;
50+
padding-top: 0;
51+
padding-bottom: 0;
4652
text-align: left;
53+
54+
&.label-working-hours {
55+
padding-top: 0;
56+
}
4757
}
4858
}
4959

0 commit comments

Comments
 (0)