Skip to content

Commit 243d43c

Browse files
authored
Merge pull request #69 from CodeYourFuture/staging
merge staging into master
2 parents ae697b1 + f36341e commit 243d43c

File tree

7 files changed

+121
-139
lines changed

7 files changed

+121
-139
lines changed

src/App.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ body {
2323
-webkit-animation: spin 2s linear infinite;
2424
animation: spin 2s linear infinite;
2525
}
26+
button:disabled {
27+
background: gray;
28+
}
Lines changed: 53 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,62 @@
11
import React, { Fragment } from 'react'
2+
import { FormGroup, Label, Input } from 'reactstrap'
23

3-
export default ({ onChange, checked, isEmpty }) => {
4+
export default ({ onChange, agreeToTOU, agreeToReceiveCommunication }) => {
45
return (
56
<Fragment>
6-
<span className="form-acknowledgement-header">
7-
Acknowledgement: (* Required)
8-
</span>
9-
<div className={`form-check ml-4 pl-4 mt-2 ${isEmpty && 'is-empty'}`}>
10-
<input
11-
className={`form-check-input`}
12-
type="checkbox"
13-
name="acknowledgement"
14-
onChange={onChange}
15-
checked={checked}
16-
></input>
17-
<label className="form-check-label">
18-
I have{' '}
19-
<span
20-
className="form-acknowledgement-read-about"
21-
data-toggle="modal"
22-
data-target={`#id-form-acknowledgement`}
7+
<div className="form-acknowledgement-header mt-4">Acknowledgement:</div>
8+
<hr className="mt-0" />
9+
<p>
10+
Code Your Future may call you, send you SMS or email you as part of your
11+
volunteering process with us. Your data is protected in accordance with
12+
our privacy policy.
13+
</p>
14+
<FormGroup check>
15+
<Label check htmlFor="agreeToTOU">
16+
<Input
17+
className={`form-check-input`}
18+
type="checkbox"
19+
name="agreeToTOU"
20+
onChange={onChange}
21+
id="agreeToTOU"
22+
checked={agreeToTOU}
23+
/>
24+
Yes, I have read and accepted the{' '}
25+
<a
26+
href="https://codeyourfuture.io/terms/"
27+
target="_blank"
28+
rel="noopener noreferrer"
2329
>
24-
read about
25-
</span>{' '}
26-
what to expect when volunteering at CYF
27-
</label>
28-
29-
<div>
30-
<div
31-
className="modal fade"
32-
id={`id-form-acknowledgement`}
33-
role="dialog"
30+
terms of use
31+
</a>{' '}
32+
and{' '}
33+
<a
34+
href="https://codeyourfuture.io/privacy-policy/"
35+
target="_blank"
36+
rel="noopener noreferrer"
3437
>
35-
<div className="modal-dialog">
36-
<div className="modal-content">
37-
<div className="modal-body">
38-
<div>
39-
<h1>JOIN OUR COMMUNITY</h1>
40-
<p>
41-
Welcome to a fun, inclusive community where your knowledge
42-
and expertise can transform the lives of refugees, asylum
43-
seekers and local disadvantaged people. A young nonprofit
44-
is a lot like a start-up: growing quickly and always
45-
looking for versatile, dependable people. You can join us
46-
in one of 6 CYF cities worldwide or set up a new CYF
47-
chapter to support your local communities.{' '}
48-
</p>
49-
<ul>
50-
We are looking for volunteers in the following areas:
51-
<li>
52-
<strong>Volunteers</strong> from virtually any
53-
background to help us run and grow our organization (to
54-
help with events, marketing, admin, etc.)
55-
</li>
56-
<li>
57-
Professionals from the tech industry to join our
58-
<strong>mentorship programme</strong> and give a student
59-
guidance and support
60-
</li>
61-
<li>
62-
<strong>Experienced web developers</strong> (HTML/CSS,
63-
JavaScript, Node, React, Databases) to help teach our
64-
classes
65-
</li>
66-
</ul>
67-
<p>
68-
Previous volunteers at Code Your Future have developed
69-
their skills, learnt valuable new ones, and made wonderful
70-
friends along the way. Roles can last a few weeks, a
71-
month, or longer - depending on how much time you can
72-
commit. Apply using the volunteer form linked below and
73-
we'll be in touch.
74-
</p>
75-
</div>
76-
</div>
77-
<div className="modal-footer">
78-
<span className="close" data-dismiss="modal">
79-
close
80-
</span>
81-
</div>
82-
</div>
83-
</div>
84-
</div>
85-
</div>
86-
</div>
38+
privacy policy
39+
</a>{' '}
40+
<strong className="text-danger">*</strong>
41+
</Label>
42+
</FormGroup>
43+
<FormGroup check>
44+
<Label check htmlFor="agreeToReceiveCommunication">
45+
<Input
46+
className={`form-check-input`}
47+
type="checkbox"
48+
name="agreeToReceiveCommunication"
49+
id="agreeToReceiveCommunication"
50+
onChange={onChange}
51+
checked={agreeToReceiveCommunication}
52+
/>
53+
Yes, contact me about volunteering activities and related events{' '}
54+
<strong className="text-danger">*</strong>
55+
</Label>
56+
</FormGroup>
57+
<p className="pt-2">
58+
<strong className="text-danger">*</strong> fields are mandatory
59+
</p>
8760
</Fragment>
8861
)
8962
}

src/Components/forms/header.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
import React, { Fragment } from 'react'
1+
import React from 'react'
22

33
export default ({ err, formInComplete, userId }) => {
44
return (
5-
<Fragment>
5+
<div>
6+
<div className="mb-2">
7+
{err && (
8+
<p className="errors">
9+
{err}
10+
{window.scrollTo(0, 0)}
11+
</p>
12+
)}
13+
{formInComplete ? (
14+
<p className="errors">
15+
Form is incomplete, please check all your details.
16+
{window.scrollTo(0, 0)}
17+
</p>
18+
) : (
19+
''
20+
)}
21+
</div>
622
<span className="form-header">Volunteer Application Form</span>
723
<hr />
824
{userId ? (
@@ -16,20 +32,6 @@ export default ({ err, formInComplete, userId }) => {
1632
complete the form below:
1733
</p>
1834
)}
19-
{err && (
20-
<p className="errors">
21-
{err}
22-
{window.scrollTo(0, 0)}
23-
</p>
24-
)}
25-
{formInComplete ? (
26-
<span className="errors container">
27-
Form is incomplete, please check all your details.
28-
{window.scrollTo(0, 0)}
29-
</span>
30-
) : (
31-
''
32-
)}
33-
</Fragment>
35+
</div>
3436
)
3537
}

src/Components/forms/helper.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export const initialState = {
2121
formInComplete: false,
2222
userId: '',
2323
dashboardUrl: '',
24+
agreeToTOU: false,
25+
agreeToReceiveCommunication: false,
2426
errors: {
2527
firstName: false,
2628
lastName: false,
@@ -29,7 +31,8 @@ export const initialState = {
2931
cityId: false,
3032
interestedInVolunteer: false,
3133
interestedInCYF: false,
32-
acknowledgement: false
34+
agreeToTOU: false,
35+
agreeToReceiveCommunication: false
3336
}
3437
}
3538

src/Components/forms/index.css

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@
8989
border: none !important;
9090
}
9191
.volunteer-submit-btn {
92-
background: #03a9f4;
92+
background-color: #03a9f4;
9393
border-radius: 5px;
9494
letter-spacing: 0.75px;
9595
text-transform: capitalize;
9696
color: #ffffff;
97-
margin: 40px 0;
97+
margin: 20px 0;
9898
width: 140px;
9999
}
100100
.form-acknowledgement-header {
@@ -120,9 +120,7 @@
120120
font-size: 24px;
121121
border-radius: 5px;
122122
padding: 20px;
123-
position: absolute;
124-
top: 0px;
125-
width: 92%;
123+
width: 100% !important;
126124
background-color: #ecdada;
127125
height: fit-content;
128126
}

src/Components/forms/index.js

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ class Forms extends Component {
9393
guidePeople,
9494
techSkill,
9595
otherSkill,
96-
acknowledgement,
97-
userId
96+
userId,
97+
agreeToTOU,
98+
agreeToReceiveCommunication
9899
} = this.state
99100

100101
const validatedInputs = this.validateForm({
@@ -104,15 +105,17 @@ class Forms extends Component {
104105
cityId,
105106
interestedInVolunteer,
106107
tel,
108+
agreeToTOU,
107109
interestedInCYF,
108-
acknowledgement
110+
agreeToReceiveCommunication
109111
})
110112
await this.validateArray({ guidePeople, techSkill, otherSkill })
111113
const emptyValues = validatedInputs.includes(true)
112114
const { valuationError } = this.state
113115
if (emptyValues || valuationError) {
114116
this.setState({ formInComplete: true })
115117
}
118+
116119
if (!emptyValues && !valuationError) {
117120
this.props.createVolunteerHandler({
118121
firstName,
@@ -127,7 +130,9 @@ class Forms extends Component {
127130
guidePeople: filterEmptyValue(guidePeople),
128131
techSkill: filterEmptyValue(techSkill),
129132
otherSkill: filterEmptyValue(otherSkill),
130-
userId
133+
userId,
134+
agreeToTOU,
135+
agreeToReceiveCommunication
131136
})
132137
}
133138
}
@@ -149,15 +154,20 @@ class Forms extends Component {
149154
return ''
150155
}
151156
}
152-
157+
showModal = e => {
158+
if (e && e.target.id) {
159+
this.setState({ selectedModal: e.target.id })
160+
}
161+
}
153162
render() {
154163
const { err, volunteer } = this.props
155164
const {
156165
disabled,
157-
acknowledgement,
166+
agreeToTOU,
158167
formInComplete,
159168
userId,
160-
dashboardUrl
169+
dashboardUrl,
170+
agreeToReceiveCommunication
161171
} = this.state
162172
if (volunteer && volunteer._id) {
163173
return (
@@ -185,30 +195,24 @@ class Forms extends Component {
185195
}
186196
return (
187197
<div className="form-container container">
188-
<div>
189-
<Header err={err} formInComplete={formInComplete} userId={userId} />
190-
<form className="mb-4" onSubmit={this.handleSubmit} method="post">
191-
<Inputs
192-
{...this.props}
193-
{...this.state}
194-
onChange={this.onChange}
195-
telOnChange={this.telOnChange}
196-
onChangeCheckList={this.onChangeCheckList}
197-
/>
198-
<Acknowledgement
199-
onChange={this.onChange}
200-
checked={this.state.acknowledgement}
201-
isEmpty={this.state.errors.acknowledgement}
202-
/>
203-
<button
204-
className="btn volunteer-submit-btn"
205-
type="submit"
206-
disabled={disabled || !acknowledgement}
207-
>
208-
Submit
209-
</button>
210-
</form>
211-
</div>
198+
<Header err={err} formInComplete={formInComplete} userId={userId} />
199+
<form className="mb-4" onSubmit={this.handleSubmit} method="post">
200+
<Inputs
201+
onChange={this.onChange}
202+
telOnChange={this.telOnChange}
203+
onChangeCheckList={this.onChangeCheckList}
204+
{...this.props}
205+
{...this.state}
206+
/>
207+
<Acknowledgement onChange={this.onChange} {...this.state} />
208+
<button
209+
disabled={disabled || !agreeToTOU || !agreeToReceiveCommunication}
210+
className="btn volunteer-submit-btn"
211+
type="submit"
212+
>
213+
Submit
214+
</button>
215+
</form>
212216
</div>
213217
)
214218
}
@@ -222,7 +226,6 @@ export function mapStateToProps(store) {
222226
err: volunteer && volunteer.err
223227
}
224228
}
225-
export default connect(
226-
mapStateToProps,
227-
{ loadCities, createVolunteerHandler }
228-
)(Forms)
229+
export default connect(mapStateToProps, { loadCities, createVolunteerHandler })(
230+
Forms
231+
)

src/Components/forms/inputs/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export default class VolunteerForm extends Component {
4848
isEmpty={errors.lastName}
4949
label="Last Name *"
5050
name="lastName"
51-
placeholder="Your first name..."
51+
placeholder="Your last name..."
5252
type="text"
5353
/>
5454
<TextInput

0 commit comments

Comments
 (0)