Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat(www): group careers page jobs by department (#48358)

claude[bot]a72259b3f05e
diff --git a/apps/www/lib/careers.ts b/apps/www/lib/careers.ts
index 51b022ea1de..9939bd784bb 100644
--- a/apps/www/lib/careers.ts
+++ b/apps/www/lib/careers.ts
@@ -2,6 +2,7 @@ export interface JobItemProps {
id: string
title: string
location: any
+ department: string
team: string
employment: string
descriptionHtml: string
@@ -10,13 +11,14 @@ export interface JobItemProps {
export const PLACEHOLDER_JOB_ID = '64d76968-1fe1-458c-8c6d-8859168c3fb7'
export const filterGenericJob = (job: JobItemProps) => job.id === PLACEHOLDER_JOB_ID
-export const groupJobsByTeam = (jobs: JobItemProps[]) => {
+export const groupJobsByDepartment = (jobs: JobItemProps[]) => {
return jobs.reduce(
(acc, job) => {
- if (!acc[job.team]) {
- acc[job.team] = []
+ const department = job.department || 'Other'
+ if (!acc[department]) {
+ acc[department] = []
}
- acc[job.team].push(job)
+ acc[department].push(job)
return acc
},
{} as Record<string, JobItemProps[]>
diff --git a/apps/www/pages/careers.tsx b/apps/www/pages/careers.tsx
index a5b3cc73f8d..d46651d9bfb 100644
--- a/apps/www/pages/careers.tsx
+++ b/apps/www/pages/careers.tsx
@@ -4,7 +4,12 @@ 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, groupJobsByTeam, JobItemProps, PLACEHOLDER_JOB_ID } from '~/lib/careers'
+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'
@@ -32,7 +37,7 @@ export const getServerSideProps: GetServerSideProps = (async ({ res }) => {
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 = groupJobsByTeam(job_data.jobs.filter((job) => !filterGenericJob(job)))
+ const jobs = groupJobsByDepartment(job_data.jobs.filter((job) => !filterGenericJob(job)))
const placeholderJob = job_data.jobs.find(filterGenericJob)
const contributorResponse = await fetch(
@@ -420,11 +425,11 @@ const CareerPage = ({ jobs, placeholderJob, contributors }: CareersPageProps) =>
<br /> We’d love to talk to you.
</p>
<div className="mt-10 flex flex-col gap-4">
- {Object.entries(jobs).map(([team, teamJobs]) => (
- <div key={team}>
- <h3 className="text-foreground-lighter text-sm">{team}</h3>
+ {Object.entries(jobs).map(([department, departmentJobs]) => (
+ <div key={department}>
+ <h3 className="text-foreground-lighter text-sm">{department}</h3>
<div className="mt-2 -space-y-px">
- {teamJobs
+ {departmentJobs
.filter((job) => !filterGenericJob(job))
.map((job) => (
<JobItem job={job} key={job.id} />