Skip to content

Commit 968212e

Browse files
committed
Update CodeDay Labs mentor application
1 parent 5c80398 commit 968212e

File tree

3 files changed

+7
-76
lines changed

3 files changed

+7
-76
lines changed

src/pages/mentor/apply.gql

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

src/pages/mentor/apply.js

Lines changed: 5 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,14 @@
1-
import { print } from 'graphql';
2-
import { apiFetch } from '@codeday/topo/utils';
3-
import { useState, useEffect } from 'react';
4-
import { useRouter } from 'next/router';
5-
import LinkedInTag from 'react-linkedin-insight';
6-
import Box from '@codeday/topo/Atom/Box';
7-
import Content from '@codeday/topo/Molecule/Content';
8-
import Image from '@codeday/topo/Atom/Image';
9-
import CognitoForm from '@codeday/topo/Molecule/CognitoForm';
10-
import Text, { Heading } from '@codeday/topo/Atom/Text';
11-
import { useAnalytics } from '@codeday/topo/utils';
1+
import { useEffect } from 'react';
122
import Page from '../../components/Page';
13-
import { useProgramDates } from '../../providers';
14-
import { ApplyQuery } from './apply.gql';
15-
import { DateTime } from 'luxon';
163

174
export default function MentorApplyPage () {
18-
const { goal } = useAnalytics();
19-
const [hasStarted, setHasStarted] = useState(false);
20-
const { query, isReady } = useRouter();
21-
const { mentorApplicationWarningAt, mentorApplicationEndsAt } = useProgramDates();
22-
useEffect(() => typeof window !== 'undefined' && LinkedInTag.init('1831116', null, false), typeof window);
5+
useEffect(() => {
6+
if (typeof window === 'undefined') return;
7+
window.location = 'https://www.codeday.org/volunteer/labs/mentor/go?return=labs&returnto=mentor%2Fshare%3Fapplied';
8+
}, [typeof window]);
239

2410
return (
2511
<Page slug="/mentor/apply" title="Sign Up to Mentor">
26-
<Content>
27-
<Image
28-
width="100%"
29-
maxHeight="300px"
30-
borderRadius="md"
31-
marginBottom={4}
32-
src="https://img.codeday.org/w=1024;h=300;fit=crop;crop=faces,edges/w/v/wvs5jzy36vt5hw1y71pnn7hsfupbh2v9ew3v7fc4z9otg265zzejg9iq97an9aszfa.jpg"
33-
/>
34-
<Heading as="h2" size="xl" marginBottom={3}>Sign Up to Mentor</Heading>
35-
{mentorApplicationEndsAt < DateTime.local() ? (
36-
<>
37-
<Text>The mentor application is now closed. Check back for a future cycle of CodeDay Labs.</Text>
38-
</>
39-
) : (
40-
<>
41-
{mentorApplicationWarningAt < DateTime.local() && (
42-
<Box bg="orange.50" borderColor="orange.200" borderWidth={2} borderRadius={2} p={4} mb={4} color="orange.800">
43-
<Heading as="h3" fontSize="lg" mb={4}>CodeDay Labs starts soon!</Heading>
44-
<Text>
45-
It's not too late to become a mentor, but we'll need to complete an onboarding call to discuss your project
46-
quickly. Please keep a close eye on your email after submitting.
47-
</Text>
48-
</Box>
49-
)}
50-
{isReady && (
51-
<CognitoForm
52-
formId="57"
53-
prefill={{ Referrer: query.r || '' }}
54-
onFirstPageChange={() => { goal('VA6TNIKN'); setHasStarted(true); }}
55-
onSubmit={() => {
56-
goal('FQKVLN2E');
57-
LinkedInTag.track('4864865');
58-
window.location = '/mentor/share?applied';
59-
}}
60-
/>
61-
)}
62-
</>
63-
)}
64-
</Content>
6512
</Page>
6613
);
6714
};
68-
69-
export async function getStaticProps() {
70-
const data = await apiFetch(print(ApplyQuery));
71-
72-
return {
73-
props: {
74-
query: data || {},
75-
random: Math.random(),
76-
},
77-
revalidate: 240,
78-
};
79-
}
80-

src/pages/mentor/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default function Mentor() {
3131
const { query } = useRouter();
3232
const f = { day: 'numeric', month: 'long' };
3333
useEffect(() => typeof window !== 'undefined' && LinkedInTag.init('1831116', null, false), typeof window);
34+
const qs = (new URLSearchParams(query || {})).toString() || '';
3435

3536
return (
3637
<Page slug="/mentor" title="Tech Industry Mentor Volunteering">
@@ -79,7 +80,7 @@ export default function Mentor() {
7980
</Text>
8081
<Button
8182
as="a"
82-
href={`/mentor/apply${query.r ? `?r=${query.r}` : ''}`}
83+
href={`https://www.codeday.org/volunteer/labs/mentor/go?return=labs&returnto=mentor%2Fshare%3Fapplied&${qs}`}
8384
variantColor="green"
8485
size="lg"
8586
>

0 commit comments

Comments
 (0)