Skip to content

Commit d7d35b4

Browse files
authored
imp(applying mentorship modal): encourage mentee for detailed request (#845)
1 parent aa65f5f commit d7d35b4

File tree

10 files changed

+93
-54
lines changed

10 files changed

+93
-54
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Pre-release version of Coding Coach.
1717

1818
## Looking for a mentor?
1919

20-
**Please read our [Mentorships Guideline](https://docs.google.com/document/d/1zKCxmIh0Sd4aWLiQncICOGm6uf38S0kJ0xb0qErNFVA/edit?ts=5dc96ff1)**
20+
**Please read our [Mentorships Guideline](https://codingcoach.io/guidelines/mentorship-guidelines)**
2121

2222
1. Go to https://mentors.codingcoach.io/
2323
2. Register (or Login)
@@ -33,7 +33,7 @@ If you didn't receive any response, you can apply to more mentors.
3333

3434
## Want to be a mentor?
3535

36-
**Please read our [Mentorships Guideline](https://docs.google.com/document/d/1zKCxmIh0Sd4aWLiQncICOGm6uf38S0kJ0xb0qErNFVA/edit?ts=5dc96ff1)**
36+
**Please read our [Mentorships Guideline](https://codingcoach.io/guidelines/mentorship-guidelines)**
3737

3838
1. Go to https://mentors.codingcoach.io/.
3939
1. Register

src/Me/Modals/MentorshipRequestModals/AcceptModal.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Body from './style';
22
import { Modal } from '../Modal';
33
import { ReactComponent as MentorshipSvg } from '../../../assets/me/mentorship.svg';
4+
import { links } from '../../../config/constants';
45

56
type AcceptModalProps = {
67
username: string;
@@ -16,9 +17,9 @@ const AcceptModal = ({ username, onClose }: AcceptModalProps) => {
1617
Awesome! You are now Mentoring <b>{username}!</b> Please make sure to
1718
follow our{' '}
1819
<a
19-
href="https://docs.google.com/document/d/1zKCxmIh0Sd4aWLiQncICOGm6uf38S0kJ0xb0qErNFVA/edit"
20+
href={links.MENTORSHIP_GUIDELINES}
21+
// eslint-disable-next-line react/jsx-no-target-blank
2022
target="_blank"
21-
rel="noreferrer"
2223
>
2324
Guidelines
2425
</a>{' '}

src/Me/Modals/MentorshipRequestModals/MentorshipRequest.js

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Textarea from '../../components/Textarea';
66
import { applyForMentorship, getMyMentorshipApplication } from '../../../api';
77
import ImageSrc from '../../../assets/mentorshipRequestSuccess.svg';
88
import Body from './style';
9+
import { links } from '../../../config/constants';
910

1011
const FormFields = styled.div`
1112
display: flex;
@@ -28,8 +29,6 @@ const ExtendedFormField = styled(FormField)`
2829
2930
& label {
3031
margin-top: 32px;
31-
color: ${props =>
32-
props.invalid ? 'var(--form-text-invalid)' : 'var(--form-text-default)'};
3332
}
3433
`;
3534

@@ -55,35 +54,35 @@ const MentorshipRequest = ({ mentor }) => {
5554
});
5655
};
5756

57+
const commonProps = {
58+
type: 'longtext',
59+
required: true,
60+
minLength: 30,
61+
validate: value => value.length >= 30,
62+
helpText: 'Minimum 30 characters',
63+
style: {
64+
height: '121px',
65+
},
66+
};
67+
5868
const model = {
5969
background: {
70+
...commonProps,
6071
label: 'My Background',
61-
type: 'longtext',
6272
defaultValue: mentorshipRequestDetails.background,
6373
placeholder: 'Tell the mentor about yourself.',
64-
style: {
65-
height: '121px',
66-
},
6774
},
6875
expectation: {
76+
...commonProps,
6977
label: 'My Expectations',
70-
type: 'longtext',
7178
defaultValue: mentorshipRequestDetails.expectation,
7279
placeholder: 'What do you expect from this mentorship?',
73-
style: {
74-
height: '121px',
75-
},
7680
},
7781
message: {
82+
...commonProps,
7883
label: 'Message',
79-
type: 'longtext',
8084
defaultValue: mentorshipRequestDetails.message,
81-
validate: value => !!value,
82-
required: true,
8385
placeholder: 'Anything else you want to say?',
84-
style: {
85-
height: '121px',
86-
},
8786
},
8887
};
8988

@@ -104,11 +103,9 @@ const MentorshipRequest = ({ mentor }) => {
104103
required={config.required}
105104
placeholder={config.placeholder}
106105
value={config.defaultValue}
107-
style={{
108-
...config.style,
109-
borderColor: errors[fieldName] && 'var(--form-text-invalid)',
110-
}}
106+
style={config.style}
111107
invalid={errors[fieldName]}
108+
minLength={config.minLength}
112109
/>
113110
{errors[fieldName] && (
114111
<ErrorMessage>{errors[fieldName]}</ErrorMessage>
@@ -120,27 +117,21 @@ const MentorshipRequest = ({ mentor }) => {
120117
}
121118
};
122119

123-
// validate form details
124120
const validate = () => {
125-
let isValid = true;
126121
const _errors = {};
127122
Object.entries(model).forEach(([field, config]) => {
128123
if (
129124
config.validate &&
130125
!config.validate(mentorshipRequestDetails[field])
131126
) {
132-
_errors[field] = `The ${config.label.toLowerCase()} is required.`;
133-
isValid = false;
127+
_errors[
128+
field
129+
] = `"${config.label}" should be longer than 30 characters`;
134130
}
135131
});
136132

137-
setErrors(pervState => ({
138-
...pervState,
139-
..._errors,
140-
isValid,
141-
}));
142-
143-
return isValid;
133+
setErrors(_errors);
134+
return Object.keys(_errors).length === 0;
144135
};
145136

146137
const onSubmit = async e => {
@@ -176,6 +167,23 @@ const MentorshipRequest = ({ mentor }) => {
176167
formField(fieldName, field, i === 0)
177168
)}
178169
</FormFields>
170+
<ul>
171+
<li>
172+
It's important to include all the relevant details so the mentor
173+
will understand who you are, where you stand and what you're
174+
looking for. Once you finish, please read it to make sure you
175+
havn't miss anything.
176+
</li>
177+
<li>
178+
<span>
179+
If you haven't read our {/* eslint-disable-next-line */}
180+
<a target="_blank" href={links.MENTORSHIP_GUIDELINES}>
181+
Mentorship Guidelines
182+
</a>
183+
, now is the a good time
184+
</span>
185+
</li>
186+
</ul>
179187
</Body>
180188
)}
181189
</Modal>

src/Me/Modals/MentorshipRequestModals/style.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,28 @@ export default styled.div`
1212
overflow-y: auto;
1313
1414
@media ${desktop} {
15-
max-width: 285px;
15+
max-width: 500px;
1616
}
1717
1818
p {
1919
text-align: center;
2020
}
21+
22+
ul {
23+
margin: 0;
24+
padding: 0;
25+
list-style: none;
26+
display: grid;
27+
28+
li {
29+
display: grid;
30+
grid-template-columns: 0 1fr;
31+
grid-gap: 1.75em;
32+
align-items: baseline;
33+
34+
&:before {
35+
content: '👉';
36+
}
37+
}
38+
}
2139
`;

src/Me/components/Textarea/Textarea.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ const StyledTextarea = styled.textarea<{ invalid?: boolean }>`
88
line-height: 17px;
99
border-radius: 3px;
1010
background-color: #fff;
11-
border: 1px solid #bfbfbf;
11+
border: 1px solid
12+
${props => (props.invalid ? 'var(--form-text-invalid)' : '#bfbfbf')};
1213
padding: 7px 12px 6px 8px;
1314
color: #4f4f4f;
1415
min-height: 75px;

src/components/MemberArea/EditProfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { providers } from '../../channelProvider';
1717
import messages from '../../messages';
1818
import { report, reportError } from '../../ga';
1919
import UserContext from '../../context/userContext/UserContext';
20+
import { links } from '../../config/constants';
2021

2122
export default class EditProfile extends Component {
2223
static contextType = UserContext;
@@ -352,9 +353,9 @@ export default class EditProfile extends Component {
352353
<label htmlFor="switch-input-read-guidelines-switch">
353354
I have read the{' '}
354355
<a
355-
href="https://docs.google.com/document/d/1zKCxmIh0Sd4aWLiQncICOGm6uf38S0kJ0xb0qErNFVA/edit"
356+
href={links.MENTORSHIP_GUIDELINES}
357+
// eslint-disable-next-line react/jsx-no-target-blank
356358
target="_blank"
357-
rel="noreferrer"
358359
>
359360
Mentorship guidelines
360361
</a>{' '}

src/components/Navigation/Navigation.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { isMentor } from '../../helpers/user';
44
import auth from '../../utils/auth';
55
import EditProfile from '../MemberArea/EditProfile';
66
import UserContext from '../../context/userContext/UserContext';
7+
import { links } from '../../config/constants';
78

89
function Navigation({ isAuthenticated, onOpenModal }) {
910
const { currentUser } = useContext(UserContext);
@@ -35,11 +36,17 @@ function Navigation({ isAuthenticated, onOpenModal }) {
3536
<Nav id="menu">
3637
<List>
3738
<Link href="https://codingcoach.io/">About</Link>
38-
<Link href="https://docs.google.com/document/d/1zKCxmIh0Sd4aWLiQncICOGm6uf38S0kJ0xb0qErNFVA/edit">
39+
<Link href={links.MENTORSHIP_GUIDELINES} target="_blank">
3940
Mentorship Guidelines
4041
</Link>
4142
{renderBecomeAMentor()}
42-
<Link href="https://calendar.google.com/calendar/u/0?cid=Y18xdmhxMWlzOTRqdHVwdHZnNTJrbzM0cW42a0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t" target="_blank">Sessions Calender</Link>
43+
<Link
44+
href="https://calendar.google.com/calendar/u/0?cid=Y18xdmhxMWlzOTRqdHVwdHZnNTJrbzM0cW42a0Bncm91cC5jYWxlbmRhci5nb29nbGUuY29t"
45+
target="_blank"
46+
rel="noopener noreferrer"
47+
>
48+
Sessions Calender
49+
</Link>
4350
</List>
4451
</Nav>
4552
);

src/config/constants.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

src/config/constants.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const auth = {
2+
DOMAIN: process.env.REACT_APP_AUTH_DOMAIN,
3+
CLIENT_ID: process.env.REACT_APP_AUTH_CLIENT_ID,
4+
CALLBACK_URL: process.env.REACT_APP_AUTH_CALLBACK,
5+
};
6+
7+
export const links = {
8+
MENTORSHIP_GUIDELINES:
9+
'https://codingcoach.io/guidelines/mentorship-guidelines',
10+
};

src/utils/auth.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import auth0 from 'auth0-js';
2-
import Constants from '../config/constants';
2+
import { auth } from '../config/constants';
33
import { clearCurrentUser, getCurrentUser } from '../api';
44
import { isMentor } from '../helpers/user';
55

@@ -13,9 +13,9 @@ class Auth {
1313
expiresAt;
1414

1515
auth0 = new auth0.WebAuth({
16-
domain: Constants.auth.DOMAIN,
17-
clientID: Constants.auth.CLIENT_ID,
18-
redirectUri: Constants.auth.CALLBACK_URL,
16+
domain: auth.DOMAIN,
17+
clientID: auth.CLIENT_ID,
18+
redirectUri: auth.CALLBACK_URL,
1919
responseType: 'token id_token',
2020
scope: 'openid',
2121
});
@@ -26,7 +26,7 @@ class Auth {
2626
origin: isMentorIntent ? 'mentor' : 'user',
2727
},
2828
redirectUri: redirectTo
29-
? `${Constants.auth.CALLBACK_URL}?redirectTo=${redirectTo}`
29+
? `${auth.CALLBACK_URL}?redirectTo=${redirectTo}`
3030
: window.location.href,
3131
});
3232
};
@@ -137,7 +137,7 @@ class Auth {
137137
this.#logout();
138138
clearCurrentUser();
139139
this.auth0.logout({
140-
returnTo: Constants.auth.CALLBACK_URL,
140+
returnTo: auth.CALLBACK_URL,
141141
});
142142
};
143143

0 commit comments

Comments
 (0)