import staticContent from '.generated/staticContent/_index.json' import { GlobeAltIcon } from '@heroicons/react/outline' import Globe from '~/components/Globe' import DefaultLayout from '~/components/Layouts/Default' import SectionContainer from '~/components/Layouts/SectionContainer' import career from '~/data/career.json' import { breadcrumbs } from '~/lib/breadcrumbs' import { filterGenericJob, groupJobsByDepartment, JobItemProps, PLACEHOLDER_JOB_ID, } from '~/lib/careers' import { breadcrumbListSchema, serializeJsonLd } from '~/lib/json-ld' import Styles from '~/styles/career.module.css' import { GetServerSideProps } from 'next' import { NextSeo } from 'next-seo' import Head from 'next/head' import Image from 'next/image' import Link from 'next/link' import { useRouter } from 'next/router' import ReactMarkdown from 'react-markdown' import { Badge, Button, buttonVariants, cn, Separator } from 'ui' import { z } from 'zod' const ContributorSchema = z.object({ login: z.string(), avatar_url: z.string(), html_url: z.string(), }) type Contributor = z.infer export const getServerSideProps: GetServerSideProps = (async ({ res }) => { // refresh every 5 minutes res.setHeader('Cache-Control', 'public, max-age=300, stale-while-revalidate=300') const job_res = await fetch('https://api.ashbyhq.com/posting-api/job-board/supabase') const job_data = (await job_res.json()) as { jobs: JobItemProps[] } const jobs = groupJobsByDepartment(job_data.jobs.filter((job) => !filterGenericJob(job))) const placeholderJob = job_data.jobs.find(filterGenericJob) const contributorResponse = await fetch( 'https://api.github.com/repos/supabase/supabase/contributors?per_page=100' ) let contributorArray: Contributor[] = [] try { const contributorResponseData = await contributorResponse.json() // if the response is not in the expected format, throw an error and return an empty array contributorArray = ContributorSchema.array().parse(contributorResponseData) } catch {} const contributor_data = contributorArray.map((contributor) => { return { login: contributor.login, avatar_url: contributor.avatar_url, html_url: contributor.html_url, } }) const contributors = await contributor_data.filter((contributor) => career.contributors.includes(contributor.login) ) contributors.push( { login: 'XquisiteDreamer', avatar_url: 'https://pbs.twimg.com/profile_images/1475874191249399808/H6TPHpq7_400x400.png', html_url: 'https://twitter.com/XquisiteDreamer', }, { login: 'marijanapav', avatar_url: 'https://avatars.githubusercontent.com/u/46031252?v=4', html_url: 'https://github.com/marijanapav', }, { login: 'lyqht', avatar_url: 'https://pbs.twimg.com/profile_images/1665778877837504514/4SWgLpjA_400x400.png', html_url: 'https://twitter.com/estee_tey', }, { login: 'ghostdevv', avatar_url: 'https://avatars.githubusercontent.com/u/47755378?v=4', html_url: 'https://github.com/ghostdevv', } ) // Pass data to the page via props return { props: { jobs, placeholderJob: placeholderJob ?? null, contributors } } }) satisfies GetServerSideProps interface CareersPageProps { jobs: Record placeholderJob: JobItemProps | null contributors: { login: string; avatar_url: string; html_url: string }[] } const CareerPage = ({ jobs = {}, placeholderJob = null, contributors = [], }: Partial) => { const { basePath } = useRouter() const { jobsCount } = staticContent const meta_title = 'Careers | Supabase' const meta_description = 'Help build software developers love' return ( <>