Skip to content

Commit c92598a

Browse files
committed
#4891 team review fixes
1 parent e0ce3c2 commit c92598a

File tree

9 files changed

+82
-26
lines changed

9 files changed

+82
-26
lines changed
176 Bytes
Loading

src/shared/actions/recruitCRM.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,22 @@ function normalizeRecruitPayload(job, payload) {
106106
*/
107107
async function applyForJobDone(job, payload) {
108108
const ss = new Service();
109-
const res = await ss.applyForJob(job.slug, normalizeRecruitPayload(job, payload));
109+
try {
110+
const res = await ss.applyForJob(job.slug, normalizeRecruitPayload(job, payload));
110111

111-
return {
112-
id: job.slug,
113-
data: res,
114-
};
112+
return {
113+
id: job.slug,
114+
data: res,
115+
};
116+
} catch (error) {
117+
return {
118+
id: job.slug,
119+
data: {
120+
error: true,
121+
errorObj: error,
122+
},
123+
};
124+
}
115125
}
116126

117127
export default redux.createActions({

src/shared/components/GUIKit/Assets/Styles/Includes/_mixin.scss

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ $gui-kit-gray-30: #aaa;
33
$gui-kit-gray-90: #2a2a2a;
44
$gui-kit-level-2: #0ab88a;
55
$gui-kit-level-5: #ef476f;
6+
$gui-kit-active-label: #229174;
67

78
@mixin textInputLabel {
89
font-size: 12px;

src/shared/components/GUIKit/TextInput/style.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
}
4848

4949
input:not([type='checkbox']):focus + label {
50-
color: $gui-kit-level-2;
50+
color: $gui-kit-active-label;
5151
}
5252

5353
input:not([type='checkbox']).haveError + label,

src/shared/components/Gigs/GigApply/index.jsx

+13-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import { getCustomField } from 'utils/gigs';
1515
import Modal from 'components/Contentful/Modal';
1616
import FilestackFilePicker from 'components/GUIKit/FilePicker';
1717
import Dropdown from 'components/GUIKit/Dropdown';
18+
import LoadingIndicator from 'components/LoadingIndicator';
1819
import './style.scss';
1920
import bigCheckmark from 'assets/images/big-checkmark.png';
2021
import SadFace from 'assets/images/sad-face-icon.svg';
22+
import backArrowGig from 'assets/images/back-arrow-gig-apply.png';
2123

2224
export default function GigApply(props) {
2325
const {
@@ -36,8 +38,8 @@ export default function GigApply(props) {
3638
</div>
3739
) : (
3840
<div styleName="wrap">
41+
<Link to={`${config.GIGS_PAGES_PATH}/${job.slug}`} styleName="back-link"><img src={backArrowGig} alt="back-arrow-icon" /> GIG DETAILS</Link>
3942
<h2>{job.name}</h2>
40-
<Link to={`${config.GIGS_PAGES_PATH}/${job.slug}`} styleName="back-link">GIG DETAILS</Link>
4143
<div styleName="separator" />
4244
{
4345
application ? (
@@ -72,8 +74,16 @@ export default function GigApply(props) {
7274
) : null
7375
}
7476
{
75-
!application ? (
76-
<div styleName={`form-wrap ${applying ? 'applying' : ''}`}>
77+
applying ? (
78+
<div styleName="loading-wrap">
79+
<LoadingIndicator />
80+
<p styleName="loading-text">Processing your application…</p>
81+
</div>
82+
) : null
83+
}
84+
{
85+
!application && !applying ? (
86+
<div styleName="form-wrap">
7787
<h4>PERSONAL INFORMATION</h4>
7888
<p>Welcome to Topcoder Gigs! We’d like to get to know you.</p>
7989
<div styleName="form-section">

src/shared/components/Gigs/GigApply/style.scss

+29-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
@import '~styles/mixins';
22
@import "~components/Contentful/default";
33

4+
.loading-wrap {
5+
margin-top: 35px;
6+
7+
.loading-text {
8+
font-family: Roboto, sans-serif;
9+
font-size: 24px;
10+
line-height: 26px;
11+
color: #2a2a2a;
12+
text-align: center;
13+
margin-top: 26px;
14+
}
15+
}
16+
417
.container {
518
max-width: $screen-lg;
6-
min-height: 50vh;
19+
min-height: 80vh;
720
margin: auto;
821
color: #2a2a2a;
922

@@ -46,8 +59,8 @@
4659
h2 {
4760
color: #26b3c5;
4861
text-align: center;
49-
margin-top: 47px;
50-
margin-bottom: 40px;
62+
margin-top: 6px;
63+
margin-bottom: 83px;
5164

5265
@include xs-to-md {
5366
text-align: left;
@@ -77,6 +90,8 @@
7790

7891
h2 {
7992
color: #2a2a2a;
93+
margin-top: 31px;
94+
margin-bottom: 20px;
8095
}
8196

8297
p {
@@ -89,6 +104,10 @@
89104
line-height: 36px;
90105
}
91106
}
107+
108+
.cta-buttons {
109+
margin-top: 30px;
110+
}
92111
}
93112

94113
.form-wrap {
@@ -103,6 +122,10 @@
103122
p {
104123
font-size: 14px;
105124
line-height: 22px;
125+
126+
a {
127+
font-size: 14px;
128+
}
106129
}
107130

108131
.form-section {
@@ -112,7 +135,7 @@
112135
display: grid;
113136
gap: 20px;
114137
grid-template-columns: 1fr 1fr;
115-
margin-bottom: 20px;
138+
margin-bottom: 8px;
116139

117140
@include xs-to-md {
118141
display: flex;
@@ -212,7 +235,7 @@
212235
}
213236
}
214237
}
215-
238+
/* stylelint-disable */
216239
.cta-buttons {
217240
display: flex;
218241
justify-content: center;
@@ -222,7 +245,6 @@
222245
flex-direction: column;
223246
}
224247

225-
/* stylelint-disable */
226248
a {
227249
background-color: #fff;
228250
border: 1px solid #137d60;
@@ -243,11 +265,6 @@
243265
text-align: center;
244266
}
245267
}
246-
/* stylelint-enable */
247-
}
248-
249-
.form-wrap.applying .form-section {
250-
opacity: 0.6;
251-
pointer-events: none !important;
252268
}
269+
/* stylelint-enable */
253270
}

src/shared/components/Gigs/GigDetails/index.jsx

+11-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const ReactHtmlParserOptions = {
3535
};
3636

3737
export default function GigDetails(props) {
38-
const { job } = props;
38+
const { job, application } = props;
3939
let shareUrl;
4040
if (isomorphy.isClientSide()) {
4141
shareUrl = encodeURIComponent(window.location.href);
@@ -110,7 +110,11 @@ export default function GigDetails(props) {
110110
</strong>
111111
</div>
112112
<div styleName="cta-buttons">
113-
<Link styleName="primaryBtn" to={`${config.GIGS_PAGES_PATH}/${job.slug}/apply`}>APPLY TO THIS JOB</Link>
113+
{
114+
!application || !application.success ? (
115+
<Link styleName="primaryBtn" to={`${config.GIGS_PAGES_PATH}/${job.slug}/apply`}>APPLY TO THIS JOB</Link>
116+
) : null
117+
}
114118
<Link to={config.GIGS_PAGES_PATH}>VIEW OTHER JOBS</Link>
115119
</div>
116120
</div>
@@ -159,6 +163,11 @@ export default function GigDetails(props) {
159163
);
160164
}
161165

166+
GigDetails.defaultProps = {
167+
application: null,
168+
};
169+
162170
GigDetails.propTypes = {
163171
job: PT.shape().isRequired,
172+
application: PT.shape(),
164173
};

src/shared/containers/Gigs/RecruitCRMJobApply.jsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class RecruitCRMJobApplyContainer extends React.Component {
4646
this.setState({
4747
formData: _.merge(formData, user),
4848
});
49-
this.validateForm();
5049
}
5150

5251
onFormInputChange(key, value) {
@@ -65,7 +64,12 @@ class RecruitCRMJobApplyContainer extends React.Component {
6564
onApplyClick() {
6665
const { applyForJob, job } = this.props;
6766
const { formData } = this.state;
68-
applyForJob(job, formData);
67+
this.validateForm();
68+
this.setState((state) => {
69+
if (_.isEmpty(state.formErrors)) {
70+
applyForJob(job, formData);
71+
}
72+
});
6973
}
7074

7175
validateForm() {

src/shared/containers/Gigs/RecruitCRMJobDetails.jsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,21 @@ class RecruitCRMJobDetailsContainer extends React.Component {
3030
loading,
3131
job,
3232
isApply,
33+
application,
3334
} = this.props;
3435

3536
if (loading) {
3637
return <LoadingIndicator />;
3738
}
3839

39-
return isApply ? <RecruitCRMJobApply job={job} /> : <GigDetails job={job} />;
40+
return isApply
41+
? <RecruitCRMJobApply job={job} /> : <GigDetails job={job} application={application} />;
4042
}
4143
}
4244

4345
RecruitCRMJobDetailsContainer.defaultProps = {
4446
job: {},
47+
application: null,
4548
};
4649

4750
RecruitCRMJobDetailsContainer.propTypes = {
@@ -50,13 +53,15 @@ RecruitCRMJobDetailsContainer.propTypes = {
5053
job: PT.shape(),
5154
id: PT.string.isRequired,
5255
isApply: PT.bool.isRequired,
56+
application: PT.shape(),
5357
};
5458

5559
function mapStateToProps(state, ownProps) {
5660
const data = state.recruitCRM[ownProps.id];
5761
return {
5862
job: data ? data.job : {},
5963
loading: data ? data.loading : true,
64+
application: data ? data.application : null,
6065
};
6166
}
6267

0 commit comments

Comments
 (0)