Skip to content

Commit

Permalink
Update CodeDay Labs mentor application
Browse files Browse the repository at this point in the history
  • Loading branch information
tylermenezes committed Jan 27, 2022
1 parent 5c80398 commit 968212e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 76 deletions.
4 changes: 0 additions & 4 deletions src/pages/mentor/apply.gql

This file was deleted.

76 changes: 5 additions & 71 deletions src/pages/mentor/apply.js
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,
};
}

3 changes: 2 additions & 1 deletion src/pages/mentor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export default function Mentor() {
const { query } = useRouter();
const f = { day: 'numeric', month: 'long' };
useEffect(() => typeof window !== 'undefined' && LinkedInTag.init('1831116', null, false), typeof window);
const qs = (new URLSearchParams(query || {})).toString() || '';

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

1 comment on commit 968212e

@vercel
Copy link

@vercel vercel bot commented on 968212e Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.