-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CodeDay Labs mentor application
- Loading branch information
1 parent
5c80398
commit 968212e
Showing
3 changed files
with
7 additions
and
76 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,14 @@ | ||
import { print } from 'graphql'; | ||
import { apiFetch } from '@codeday/topo/utils'; | ||
import { useState, useEffect } from 'react'; | ||
import { useRouter } from 'next/router'; | ||
import LinkedInTag from 'react-linkedin-insight'; | ||
import Box from '@codeday/topo/Atom/Box'; | ||
import Content from '@codeday/topo/Molecule/Content'; | ||
import Image from '@codeday/topo/Atom/Image'; | ||
import CognitoForm from '@codeday/topo/Molecule/CognitoForm'; | ||
import Text, { Heading } from '@codeday/topo/Atom/Text'; | ||
import { useAnalytics } from '@codeday/topo/utils'; | ||
import { useEffect } from 'react'; | ||
import Page from '../../components/Page'; | ||
import { useProgramDates } from '../../providers'; | ||
import { ApplyQuery } from './apply.gql'; | ||
import { DateTime } from 'luxon'; | ||
|
||
export default function MentorApplyPage () { | ||
const { goal } = useAnalytics(); | ||
const [hasStarted, setHasStarted] = useState(false); | ||
const { query, isReady } = useRouter(); | ||
const { mentorApplicationWarningAt, mentorApplicationEndsAt } = useProgramDates(); | ||
useEffect(() => typeof window !== 'undefined' && LinkedInTag.init('1831116', null, false), typeof window); | ||
useEffect(() => { | ||
if (typeof window === 'undefined') return; | ||
window.location = 'https://www.codeday.org/volunteer/labs/mentor/go?return=labs&returnto=mentor%2Fshare%3Fapplied'; | ||
}, [typeof window]); | ||
|
||
return ( | ||
<Page slug="/mentor/apply" title="Sign Up to Mentor"> | ||
<Content> | ||
<Image | ||
width="100%" | ||
maxHeight="300px" | ||
borderRadius="md" | ||
marginBottom={4} | ||
src="https://img.codeday.org/w=1024;h=300;fit=crop;crop=faces,edges/w/v/wvs5jzy36vt5hw1y71pnn7hsfupbh2v9ew3v7fc4z9otg265zzejg9iq97an9aszfa.jpg" | ||
/> | ||
<Heading as="h2" size="xl" marginBottom={3}>Sign Up to Mentor</Heading> | ||
{mentorApplicationEndsAt < DateTime.local() ? ( | ||
<> | ||
<Text>The mentor application is now closed. Check back for a future cycle of CodeDay Labs.</Text> | ||
</> | ||
) : ( | ||
<> | ||
{mentorApplicationWarningAt < DateTime.local() && ( | ||
<Box bg="orange.50" borderColor="orange.200" borderWidth={2} borderRadius={2} p={4} mb={4} color="orange.800"> | ||
<Heading as="h3" fontSize="lg" mb={4}>CodeDay Labs starts soon!</Heading> | ||
<Text> | ||
It's not too late to become a mentor, but we'll need to complete an onboarding call to discuss your project | ||
quickly. Please keep a close eye on your email after submitting. | ||
</Text> | ||
</Box> | ||
)} | ||
{isReady && ( | ||
<CognitoForm | ||
formId="57" | ||
prefill={{ Referrer: query.r || '' }} | ||
onFirstPageChange={() => { goal('VA6TNIKN'); setHasStarted(true); }} | ||
onSubmit={() => { | ||
goal('FQKVLN2E'); | ||
LinkedInTag.track('4864865'); | ||
window.location = '/mentor/share?applied'; | ||
}} | ||
/> | ||
)} | ||
</> | ||
)} | ||
</Content> | ||
</Page> | ||
); | ||
}; | ||
|
||
export async function getStaticProps() { | ||
const data = await apiFetch(print(ApplyQuery)); | ||
|
||
return { | ||
props: { | ||
query: data || {}, | ||
random: Math.random(), | ||
}, | ||
revalidate: 240, | ||
}; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
968212e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: