Skip to content

Commit a46c9bc

Browse files
committed
update messages
1 parent 426b9bb commit a46c9bc

File tree

5 files changed

+81
-61
lines changed

5 files changed

+81
-61
lines changed

src/App.css

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ body {
2323
-webkit-animation: spin 2s linear infinite;
2424
animation: spin 2s linear infinite;
2525
}
26+
27+
@-webkit-keyframes spin {
28+
0% {
29+
-webkit-transform: rotate(0deg);
30+
}
31+
100% {
32+
-webkit-transform: rotate(360deg);
33+
}
34+
}
35+
36+
@keyframes spin {
37+
0% {
38+
transform: rotate(0deg);
39+
}
40+
100% {
41+
transform: rotate(360deg);
42+
}
43+
}
44+
2645
button:disabled {
2746
background: gray;
2847
}

src/Components/forms/header.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
import React from 'react'
22

3-
export default ({ err, formInComplete, userId }) => {
3+
export default ({ formInComplete, userId }) => {
44
return (
55
<div>
66
<div className="mb-2">
7-
{err && (
8-
<p className="errors">
9-
{err}
10-
{window.scrollTo(0, 0)}
11-
</p>
12-
)}
137
{formInComplete ? (
148
<p className="errors">
159
Form is incomplete, please check all your details.

src/Components/forms/helper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const initialState = {
2323
dashboardUrl: '',
2424
agreeToTOU: false,
2525
agreeToReceiveCommunication: false,
26-
showEmailBox: false,
26+
showFindAccountBox: false,
2727
loading: false,
2828
errors: {
2929
firstName: false,

src/Components/forms/index.js

Lines changed: 59 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,15 @@ class Forms extends Component {
222222
this.setState({ selectedModal: e.target.id })
223223
}
224224
}
225+
UNSAFE_componentWillReceiveProps(newProps) {
226+
const { volunteer, err } = newProps
227+
this.setState({ err, volunteer })
228+
const { userId } = this.props.match.params
229+
if (userId && err === 'An account with this email address already exists') {
230+
this.setState({ showEmailBox: true })
231+
}
232+
}
225233
render() {
226-
const { err, volunteer } = this.props
227234
const {
228235
disabled,
229236
agreeToTOU,
@@ -233,7 +240,9 @@ class Forms extends Component {
233240
agreeToReceiveCommunication,
234241
showEmailBox,
235242
msg,
236-
loading
243+
loading,
244+
err,
245+
volunteer
237246
} = this.state
238247
if (loading) {
239248
return (
@@ -275,21 +284,24 @@ class Forms extends Component {
275284
</div>
276285
)
277286
}
278-
if (userId && showEmailBox) {
279-
return (
280-
<div className="form-container container">
281-
{this.state.err && <p className="errors">{this.state.err}</p>}
287+
return (
288+
<div className="form-container container">
289+
{err && (
290+
<p className="errors">
291+
{err}
292+
{window.scrollTo(0, 0)}
293+
</p>
294+
)}
295+
{showEmailBox ? (
282296
<div className="forms-important-box">
283297
<div>
284298
<p>
285-
<strong>Important: </strong>This form will send you an email
286-
with a link to update your existing profile to alow us to see
287-
your request to access admin dashboard.
299+
<strong>Important: </strong>this form will send you a
300+
verification email before getting access to our dashboard
288301
</p>
289302
<p>
290303
<strong>
291-
Please entre the email you used for volunteer application form
292-
and click submit.
304+
Please enter your email you used and click submit
293305
</strong>
294306
</p>
295307
<form
@@ -315,50 +327,45 @@ class Forms extends Component {
315327
</span>
316328
</div>
317329
</div>
318-
</div>
319-
)
320-
}
321-
return (
322-
<div className="form-container container">
323-
<Header
324-
err={err || this.state.err}
325-
formInComplete={formInComplete}
326-
userId={userId}
327-
/>
328-
{userId && (
329-
<div className="forms-important-box">
330-
<span>
331-
<strong>Important:</strong> If you already completed this form in
332-
some point please click{' '}
333-
<span
334-
style={{ cursor: 'pointer', color: '#0053ff' }}
335-
onMouseDown={() => this.setState({ showEmailBox: true })}
330+
) : (
331+
<div>
332+
<Header formInComplete={formInComplete} userId={userId} />
333+
{userId && (
334+
<div className="forms-important-box">
335+
<span>
336+
<strong>Important:</strong> If you already completed this form
337+
in some point please click{' '}
338+
<span
339+
style={{ cursor: 'pointer', color: '#0053ff' }}
340+
onMouseDown={() => this.setState({ showEmailBox: true })}
341+
>
342+
here
343+
</span>
344+
.
345+
</span>
346+
</div>
347+
)}
348+
<form className="mb-4" onSubmit={this.handleSubmit} method="post">
349+
<Inputs
350+
onChange={this.onChange}
351+
telOnChange={this.telOnChange}
352+
onChangeCheckList={this.onChangeCheckList}
353+
{...this.props}
354+
{...this.state}
355+
/>
356+
<Acknowledgement onChange={this.onChange} {...this.state} />
357+
<button
358+
disabled={
359+
disabled || !agreeToTOU || !agreeToReceiveCommunication
360+
}
361+
className="btn volunteer-submit-btn"
362+
type="submit"
336363
>
337-
here
338-
</span>
339-
.
340-
</span>
364+
Submit
365+
</button>
366+
</form>
341367
</div>
342368
)}
343-
{!showEmailBox && (
344-
<form className="mb-4" onSubmit={this.handleSubmit} method="post">
345-
<Inputs
346-
onChange={this.onChange}
347-
telOnChange={this.telOnChange}
348-
onChangeCheckList={this.onChangeCheckList}
349-
{...this.props}
350-
{...this.state}
351-
/>
352-
<Acknowledgement onChange={this.onChange} {...this.state} />
353-
<button
354-
disabled={disabled || !agreeToTOU || !agreeToReceiveCommunication}
355-
className="btn volunteer-submit-btn"
356-
type="submit"
357-
>
358-
Submit
359-
</button>
360-
</form>
361-
)}
362369
</div>
363370
)
364371
}

src/Redux/action/volunteersActions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const createVolunteer = async volunteer => {
1414
err.response.data.error === 'EMAIL_EXIST'
1515
) {
1616
return {
17-
err: 'Volunteer account with this email address already exist.'
17+
err: 'An account with this email address already exists'
1818
}
1919
}
2020
return {

0 commit comments

Comments
 (0)