Skip to content

Develop from master 23may #2711

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

Merged
merged 25 commits into from
Jul 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d001468
Topcoder Member Profile UI Fixes and Enhancements - Part 1
Jun 9, 2019
4670c51
Merge pull request #2596 from nauhil/feature-profile-enhancements
codeMinter Jun 9, 2019
cb6bf50
Topcoder Member Profile UI Fixes and Enhancements - Part 2
Jun 13, 2019
87c4ce9
Fix scss lint
Jun 13, 2019
23407c3
Merge pull request #2618 from nauhil/feature-profile-enhancements
codeMinter Jun 13, 2019
d978cfc
Fix issue of Topcoder Member Profile UI Fixes and Enhancements - Part 2
Jun 14, 2019
0981144
Fix issue of add education
Jun 14, 2019
5648af5
Merge pull request #2622 from nauhil/feature-profile-enhancements
codeMinter Jun 14, 2019
7f449f9
Fix validations
codeMinter Jun 15, 2019
b20631f
Fix validations
codeMinter Jun 15, 2019
a5184e9
Update validateDates logic as backend and create common function for …
Jun 15, 2019
4531c3d
Merge branch 'feature-profile-enhancements' into feature-profile-enha…
codeMinter Jun 15, 2019
65396d3
fix merging issues
codeMinter Jun 15, 2019
890593f
fix lint issues
codeMinter Jun 15, 2019
514405d
Merge pull request #2628 from nauhil/feature-profile-enhancements
codeMinter Jun 15, 2019
283f9d4
Fix for Work Screen
codeMinter Jun 15, 2019
2aa917d
Fix for Work Screen
codeMinter Jun 15, 2019
0d0188d
Add branch feature-profile-enhancements to deploy on DEV
codeMinter Jun 22, 2019
6b657d9
fix UI elements for backend changes
codeMinter Jun 24, 2019
ecad773
fix lint issues
codeMinter Jun 24, 2019
898647f
Deploying on dev
sushilshinde Jul 2, 2019
c524b65
Fix for end date enables when any field on work is changed
codeMinter Jul 2, 2019
4c53844
Merge branch 'develop-from-master-23may' into feature-profile-enhance…
codeMinter Jul 2, 2019
cf4f516
Fix for end date enables when any field on work is changed
codeMinter Jul 2, 2019
5fb16cb
Merge pull request #2703 from topcoder-platform/feature-profile-enhan…
codeMinter Jul 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/assets/images/profile/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/device-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/service-provider-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/software-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/images/tools/subscription-types/ico-edit.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/shared/components/Settings/CofirmationModal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { Modal, PrimaryButton, GhostButton } from 'topcoder-react-ui-kit';
import modal from './styles.scss';

export default function ConfirmationModal(props) {
const { onConfirm, onCancel } = props;
const { onConfirm, onCancel, name } = props;
return (
<Modal theme={modal}>
<div styleName="modal.deletion-confirmation-container">
<div styleName="modal.deletion-confirmation">
<div styleName="modal.deletion-confirmation-title">Heads Up!</div>
<div styleName="modal.deletion-confirmation-title">HEADS UP!</div>
<div styleName="modal.deletion-confirmation-message">
Are you sure you want to delete? This action can&apos;t be undone
later.
Are you sure you want to delete `{name}`? This action can&apos;t be undone.
</div>
<div styleName="modal.deletion-confirmation-buttons">
<div styleName="modal.deletion-confirmation-button-yes">
Expand All @@ -31,4 +30,5 @@ export default function ConfirmationModal(props) {
ConfirmationModal.propTypes = {
onConfirm: PT.func.isRequired,
onCancel: PT.func.isRequired,
name: PT.string.isRequired,
};
30 changes: 30 additions & 0 deletions src/shared/components/Settings/ErrorMessage/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import PropTypes from 'prop-types';

import './styles.scss';

const marginTop = (value) => {
if (value) {
return 'active-margin';
}

return 'active';
};

const ErrorMessage = ({ invalid, message, addMargin }) => (
<span styleName={`error-message ${invalid ? marginTop(addMargin) : ''}`}>
{message}
</span>
);

ErrorMessage.defaultProps = {
addMargin: false,
};

ErrorMessage.propTypes = {
invalid: PropTypes.bool.isRequired,
message: PropTypes.string.isRequired,
addMargin: PropTypes.bool,
};

export default ErrorMessage;
27 changes: 27 additions & 0 deletions src/shared/components/Settings/ErrorMessage/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
@import "../style";

.error-message {
display: none;

&.active {
@include roboto-medium;

display: inline;
border-radius: 5px;
background-color: $tc-red-10;
color: $tc-red-110;
font-size: 15px;
margin: 0 auto 0 0;
}

&.active-margin {
@include roboto-medium;

display: inline;
border-radius: 5px;
background-color: $tc-red-10;
color: $tc-red-110;
font-size: 15px;
margin: 10px auto 0 0;
}
}
41 changes: 12 additions & 29 deletions src/shared/components/Settings/Profile/BasicInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ import { PrimaryButton } from 'topcoder-react-ui-kit';
import ConsentComponent from 'components/Settings/ConsentComponent';
import Select from 'components/Select';
import DatePicker from 'components/challenge-listing/Filters/DatePicker';
import ErrorMessage from 'components/Settings/ErrorMessage';
import ImageInput from '../ImageInput';
import Track from './Track';
import DefaultImageInput from './ImageInput';
import dropdowns from './dropdowns.json';
import tracks from './tracks';


import './styles.scss';

export default class BasicInfo extends ConsentComponent {
Expand All @@ -41,7 +43,6 @@ export default class BasicInfo extends ConsentComponent {
this.state = {
inputChanged: false,
formInvalid: false,
errorMessage: '',
basicInfoTrait: this.loadBasicInfoTraits(userTraits),
personalizationTrait: this.loadPersonalizationTrait(userTraits),
newBasicInfo: {
Expand Down Expand Up @@ -98,46 +99,26 @@ export default class BasicInfo extends ConsentComponent {

onCheckFormValue(newBasicInfo) {
let invalid = false;
let errorMessage = '';
let dateError = '';
let birthDateInvalid = false;
const invalidFields = [];

if (!_.trim(newBasicInfo.firstName).length) {
invalidFields.push('First Name');
invalid = true;
}

if (!_.trim(newBasicInfo.lastName).length) {
invalidFields.push('Last Name');
invalid = true;
}

if (!_.trim(newBasicInfo.country).length) {
invalidFields.push('Country');
invalid = true;
}

if (invalidFields.length > 0) {
errorMessage += invalidFields.join(', ');
errorMessage += ' cannot be empty';
}

if (_.trim(newBasicInfo.birthDate).length > 0) {
if (!moment().isAfter(newBasicInfo.birthDate)) {
dateError = 'You must enter a valid date for Birth Date';
birthDateInvalid = true;
invalid = true;
}
}

if (errorMessage.length > 0) {
errorMessage = `${errorMessage}. ${dateError}`;
} else if (dateError.length > 0) {
errorMessage = dateError;
invalid = birthDateInvalid;
}

this.setState({ errorMessage, formInvalid: invalid });
this.setState({ formInvalid: invalid });
return invalid;
}

Expand Down Expand Up @@ -170,7 +151,7 @@ export default class BasicInfo extends ConsentComponent {
*/
onHandleSaveBasicInfo(e) {
e.preventDefault();
this.setState({ isSaving: true });
this.setState({ isSaving: true, inputChange: true });
const { newBasicInfo } = this.state;
if (this.onCheckFormValue(newBasicInfo)) {
this.setState({ isSaving: false });
Expand Down Expand Up @@ -465,8 +446,7 @@ export default class BasicInfo extends ConsentComponent {
render() {
const {
newBasicInfo,
formInvalid,
errorMessage,
inputChanged,
} = this.state;

const canModifyTrait = !this.props.traitRequestCount;
Expand Down Expand Up @@ -507,6 +487,7 @@ export default class BasicInfo extends ConsentComponent {
<div styleName="field col-2">
<span styleName="text-required">* Required</span>
<input disabled={!canModifyTrait} id="firstName" name="firstName" type="text" placeholder="First Name" onChange={this.onUpdateInput} value={newBasicInfo.firstName} maxLength="64" required />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.firstName) && inputChanged} message="First Name cannot be empty" />
</div>
</div>
<div styleName="row">
Expand All @@ -519,6 +500,7 @@ export default class BasicInfo extends ConsentComponent {
<div styleName="field col-2">
<span styleName="text-required">* Required</span>
<input disabled={!canModifyTrait} id="lastName" name="lastName" type="text" placeholder="Last Name" onChange={this.onUpdateInput} value={newBasicInfo.lastName} maxLength="64" required />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.lastName) && inputChanged} message="Last Name cannot be empty" />
</div>
</div>
<div styleName="row">
Expand Down Expand Up @@ -619,6 +601,7 @@ export default class BasicInfo extends ConsentComponent {
disabled={!canModifyTrait}
clearable={false}
/>
<ErrorMessage invalid={_.isEmpty(newBasicInfo.country) && inputChanged} message="Country cannot be empty" addMargin />
</div>
</div>
</form>
Expand Down Expand Up @@ -745,6 +728,7 @@ export default class BasicInfo extends ConsentComponent {
</label>

<input disabled={!canModifyTrait} id="firstNameId" name="firstName" type="text" placeholder="First Name" onChange={this.onUpdateInput} value={newBasicInfo.firstName} maxLength="64" required />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.firstName) && inputChanged} addMargin message="First Name cannot be empty" />
</div>
<div styleName="field">
<label htmlFor="lastNameId">
Expand All @@ -753,6 +737,7 @@ export default class BasicInfo extends ConsentComponent {
<input type="hidden" />
</label>
<input disabled={!canModifyTrait} id="lastNameId" name="lastName" type="text" placeholder="Last Name" onChange={this.onUpdateInput} value={newBasicInfo.lastName} maxLength="64" required />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.lastName) && inputChanged} addMargin message="Last Name cannot be empty" />
</div>
</div>
</div>
Expand Down Expand Up @@ -826,6 +811,7 @@ export default class BasicInfo extends ConsentComponent {
clearable={false}
disabled={!canModifyTrait}
/>
<ErrorMessage invalid={_.isEmpty(newBasicInfo.country) && inputChanged} message="Country cannot be empty" />
</div>
</div>
<div styleName="row">
Expand Down Expand Up @@ -931,9 +917,6 @@ export default class BasicInfo extends ConsentComponent {
}
</div>
</div>
<div styleName={`error-message ${formInvalid ? 'active' : ''}`}>
{errorMessage}
</div>
<div styleName="button-save">
<PrimaryButton
styleName="white-label"
Expand Down
35 changes: 2 additions & 33 deletions src/shared/components/Settings/Profile/BasicInfo/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,6 @@
}
}

.error-message {
display: none;

&.active {
@include roboto-medium;

display: block;
border-radius: 5px;
background-color: $tc-red-10;
color: $tc-red-110;
font-size: 15px;
padding: 15px;
margin: 15px 0;
}
}

.form-container-default {
@include form-container-default;

Expand Down Expand Up @@ -181,22 +165,6 @@
}
}

.error-message {
display: none;

&.active {
@include roboto-medium;

display: block;
border-radius: 5px;
background-color: $tc-red-10;
color: $tc-red-110;
font-size: 15px;
padding: 15px;
margin-bottom: 15px;
}
}

.form-container {
flex: 1;
display: flex;
Expand Down Expand Up @@ -238,7 +206,8 @@
margin-right: 10px;

@include upto-sm {
display: block;
display: flex;
flex-direction: column;
margin-right: 0;
padding-bottom: 10px;
}
Expand Down
Loading