The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: improvements to SupaSquad page (#38648)
Tomás Pozocb1d6d364520
diff --git a/apps/www/app/api-v2/submit-form-apply-to-supasquad/route.tsx b/apps/www/app/api-v2/submit-form-apply-to-supasquad/route.tsxindex 9de5a34550f..b01ead2ec25 100644--- a/apps/www/app/api-v2/submit-form-apply-to-supasquad/route.tsx+++ b/apps/www/app/api-v2/submit-form-apply-to-supasquad/route.tsx@@ -1,9 +1,13 @@import * as Sentry from '@sentry/nextjs'-import z from 'zod'import { CustomerioAppClient, CustomerioTrackClient } from '~/lib/customerio'import { insertPageInDatabase } from '~/lib/notion'+import {+ SupaSquadApplication,+ supaSquadApplicationSchema,+} from '~/data/open-source/contributing/supasquad.utils'+// Using a separate Sentry client for community following this guide:// https://docs.sentry.io/platforms/javascript/best-practices/multiple-sentry-instances/const integrations = Sentry.getDefaultIntegrations({}).filter((defaultIntegration) => {@@ -29,29 +33,6 @@ const captureSentryCommunityException = (error: any) => {const NOTION_API_KEY = process.env.NOTION_SUPASQUAD_API_KEYconst NOTION_DB_ID = process.env.NOTION_SUPASQUAD_APPLICATIONS_DB_ID-const applicationSchema = z.object({- first_name: z.string().min(1, 'First name is required'),- last_name: z.string().min(1, 'Last name is required'),- email: z.string().email('Please enter a valid email address'),- tracks: z- .array(- z.object({- heading: z.string(),- description: z.string(),- })- )- .min(1, 'Select at least 1 track'),- areas_of_interest: z.array(z.string()).min(1, 'Select at least 1 area of interest'),- why_you_want_to_join: z.string().min(1, 'This is required'),- monthly_commitment: z.string().optional(),- languages_spoken: z.array(z.string()).min(1, 'Select at least 1 language'),- skills: z.string().optional(),- city: z.string().min(1, 'Specify your city'),- country: z.string().min(1, 'Specify your country'),- github: z.string().optional(),- twitter: z.string().optional(),-})-const corsHeaders = {'Access-Control-Allow-Origin': '*','Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',@@ -101,7 +82,7 @@ export async function POST(req: Request) {})}- const parsed = applicationSchema.safeParse(body)+ const parsed = supaSquadApplicationSchema.safeParse(body)if (!parsed.success) {return new Response(JSON.stringify({ message: parsed.error.flatten() }), {headers: { ...corsHeaders, 'Content-Type': 'application/json' },@@ -158,6 +139,7 @@ const savePersonAndEventInCustomerIO = async (data: any) => {country: data.country,github: data.github,twitter: data.twitter,+ discord: data.discord,})// Track the supasquad_application_form_submitted event@@ -223,7 +205,7 @@ const sendConfirmationEmail = async (emailData: {}}-const getNotionPageProps = (data: any) => {+const getNotionPageProps = (data: SupaSquadApplication) => {const fullName =`${data.first_name?.trim() || ''} ${data.last_name?.trim() || ''}`.trim() || 'Unnamed'@@ -262,6 +244,11 @@ const getNotionPageProps = (data: any) => {],},}+ if (data.contributions) {+ props['Recent Contributions'] = {+ rich_text: [{ type: 'text', text: { content: truncateRichText(data.contributions, 1900) } }],+ }+ }if (data.monthly_commitment) {props['Monthly commitment'] = {rich_text: [{ type: 'text', text: { content: truncateRichText(data.monthly_commitment) } }],@@ -279,6 +266,11 @@ const getNotionPageProps = (data: any) => {],}}+ if (data.discord) {+ props['Discord username'] = {+ rich_text: [{ type: 'text', text: { content: data.discord } }],+ }+ }if (data.github) {props['GitHub Profile'] = {rich_text: [{ type: 'text', text: { content: data.github } }],diff --git a/apps/www/components/Forms/ApplyToSupaSquadForm.tsx b/apps/www/components/Forms/ApplyToSupaSquadForm.tsxindex 017d247283e..498418badc9 100644--- a/apps/www/components/Forms/ApplyToSupaSquadForm.tsx+++ b/apps/www/components/Forms/ApplyToSupaSquadForm.tsx@@ -1,6 +1,5 @@import { FC, useEffect, useState, memo } from 'react'import { AlertCircle, CheckCircle2 } from 'lucide-react'-import * as z from 'zod'import { useForm } from 'react-hook-form'import { zodResolver } from '@hookform/resolvers/zod'import {@@ -16,7 +15,7 @@ import {TextArea_Shadcn_,FormDescription_Shadcn_,} from 'ui'-import { Alert, AlertTitle, AlertDescription } from 'ui/src/components/shadcn/ui/alert'+import { Alert, AlertDescription } from 'ui/src/components/shadcn/ui/alert'import {AlertDialog,AlertDialogAction,@@ -32,6 +31,10 @@ import {MultiSelectorItem,} from 'ui-patterns/multi-select'import { CountrySelector } from '../Supasquad/CountrySelector'+import {+ supaSquadApplicationSchema,+ SupaSquadApplication,+} from '~/data/open-source/contributing/supasquad.utils'interface FormItem_Shadcn_ {type: 'text' | 'textarea'@@ -108,31 +111,6 @@ const languagesSpoken: string[] = ['Other',]-const applicationSchema = z.object({- first_name: z.string().min(1, 'First name is required'),- last_name: z.string().min(1, 'Last name is required'),- email: z.string().email('Please enter a valid email address'),- tracks: z- .array(- z.object({- heading: z.string(),- description: z.string(),- })- )- .min(1, 'Select at least 1 track'),- areas_of_interest: z.array(z.string()).min(1, 'Select at least 1 area of interest'),- why_you_want_to_join: z.string().min(1, 'This is required'),- monthly_commitment: z.string().optional(),- languages_spoken: z.array(z.string()).min(1, 'Select at least 1 language'),- skills: z.string().optional(),- city: z.string().min(1, 'Specify your city'),- country: z.string().min(1, 'Specify your country'),- github: z.string().optional(),- twitter: z.string().optional(),-})--type ApplicationFormData = z.infer<typeof applicationSchema>-const headerContent = {title: 'Apply to join SupaSquad',description:@@ -150,9 +128,9 @@ const FormContent = memo(function FormContent({handleCancel,isSubmitting,}: {- form: ReturnType<typeof useForm<ApplicationFormData>>+ form: ReturnType<typeof useForm<SupaSquadApplication>>errors: { [key: string]: string }- onSubmit: (data: ApplicationFormData) => Promise<void>+ onSubmit: (data: SupaSquadApplication) => Promise<void>honeypot: stringsetHoneypot: React.Dispatch<React.SetStateAction<string>>isMobile: boolean@@ -236,26 +214,6 @@ const FormContent = memo(function FormContent({<div className="space-y-8"><h3 className="h3 text-foreground">Interests and skills</h3>- <FormField_Shadcn_- control={form.control}- name="why_you_want_to_join"- render={({ field }) => (- <FormItem_Shadcn_ className="space-y-1">- <FormLabel_Shadcn_ className="text-foreground">- Why do you want to join the program? *- </FormLabel_Shadcn_>- <FormDescription_Shadcn_ className="text-foreground-lighter">- What do you have to contribute? What would you like to get out of it?- </FormDescription_Shadcn_>- <FormControl_Shadcn_>- <div className="relative">- <TextArea_Shadcn_ autoComplete="off" {...field} />- </div>- </FormControl_Shadcn_>- <FormMessage_Shadcn_ />- </FormItem_Shadcn_>- )}- /><FormField_Shadcn_control={form.control}@@ -310,6 +268,60 @@ const FormContent = memo(function FormContent({</FormItem_Shadcn_>)}/>++ <FormField_Shadcn_+ control={form.control}+ name="why_you_want_to_join"+ render={({ field }) => (+ <FormItem_Shadcn_ className="space-y-1">+ <FormLabel_Shadcn_ className="text-foreground">+ Why do you want to join the program? *+ </FormLabel_Shadcn_>+ <FormDescription_Shadcn_ className="text-foreground-lighter">+ What do you have to contribute? What would you like to get out of it?+ </FormDescription_Shadcn_>+ <FormControl_Shadcn_>+ <div className="relative">+ <TextArea_Shadcn_+ autoComplete="off"+ rows={3}+ className="bg-foreground/[.026]"+ {...field}+ />+ </div>+ </FormControl_Shadcn_>+ <FormMessage_Shadcn_ />+ </FormItem_Shadcn_>+ )}+ />++ <FormField_Shadcn_+ control={form.control}+ name="contributions"+ render={({ field }) => (+ <FormItem_Shadcn_ className="space-y-1">+ <FormLabel_Shadcn_ className="text-foreground">+ Share some of your recent contributions+ </FormLabel_Shadcn_>+ <FormDescription_Shadcn_ className="text-foreground-lighter">+ Any relevant links to show your current engagement with the Supabase community.+ </FormDescription_Shadcn_>+ <FormControl_Shadcn_>+ <div className="relative">+ <TextArea_Shadcn_+ autoComplete="off"+ rows={3}+ className="bg-foreground/[.026]"+ placeholder="PR links, posts/replies on Discord/Reddit/X, Luma links of meetups+ you have organized, etc."+ {...field}+ />+ </div>+ </FormControl_Shadcn_>+ <FormMessage_Shadcn_ />+ </FormItem_Shadcn_>+ )}+ /><Separator /><FormField_Shadcn_control={form.control}@@ -389,7 +401,6 @@ const FormContent = memo(function FormContent({<FormLabel_Shadcn_ className="text-foreground">Country *</FormLabel_Shadcn_><FormControl_Shadcn_><div className="relative mt-1">- {/* <Input_Shadcn_ type="text" placeholder="Country" {...field} /> */}<CountrySelector value={field.value || ''} onValueChange={field.onChange} /></div></FormControl_Shadcn_>@@ -485,6 +496,22 @@ const FormContent = memo(function FormContent({<h3 className="h4 text-foreground">Social Links</h3><div className="space-y-3">+ <FormField_Shadcn_+ control={form.control}+ name="discord"+ render={({ field }) => (+ <FormItem_Shadcn_>+ <FormLabel_Shadcn_ className="text-foreground">Discord</FormLabel_Shadcn_>+ <FormControl_Shadcn_>+ <div className="relative mt-1">+ <Input_Shadcn_ type="text" placeholder="#username" {...field} />+ </div>+ </FormControl_Shadcn_>+ <FormMessage_Shadcn_ />+ </FormItem_Shadcn_>+ )}+ />+<FormField_Shadcn_control={form.control}name="github"@@ -570,14 +597,15 @@ const ApplyToSupaSquadForm: FC<Props> = ({ className }) => {const [showConfirmation, setShowConfirmation] = useState(false)const [startTime, setStartTime] = useState<number>(0)- const form = useForm<ApplicationFormData>({- resolver: zodResolver(applicationSchema),+ const form = useForm<SupaSquadApplication>({+ resolver: zodResolver(supaSquadApplicationSchema),defaultValues: {first_name: '',last_name: '',email: '',tracks: [],areas_of_interest: [],+ contributions: '',skills: '',why_you_want_to_join: '',city: '',@@ -586,6 +614,7 @@ const ApplyToSupaSquadForm: FC<Props> = ({ className }) => {languages_spoken: [],github: '',twitter: '',+ discord: '',},mode: 'onBlur',reValidateMode: 'onBlur',@@ -603,7 +632,7 @@ const ApplyToSupaSquadForm: FC<Props> = ({ className }) => {setErrors({})}- const onSubmit = async (data: ApplicationFormData) => {+ const onSubmit = async (data: SupaSquadApplication) => {const currentTime = Date.now()const timeElapsed = (currentTime - startTime) / 1000diff --git a/apps/www/components/Supasquad/CountrySelector.tsx b/apps/www/components/Supasquad/CountrySelector.tsxindex b415cfd4615..47f0221f14e 100644--- a/apps/www/components/Supasquad/CountrySelector.tsx+++ b/apps/www/components/Supasquad/CountrySelector.tsx@@ -1,10 +1,10 @@import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue,-} from 'ui/src/components/shadcn/ui/select'+ Select_Shadcn_ as Select,+ SelectContent_Shadcn_ as SelectContent,+ SelectItem_Shadcn_ as SelectItem,+ SelectTrigger_Shadcn_ as SelectTrigger,+ SelectValue_Shadcn_ as SelectValue,+} from 'ui'// Country data with flags and names (alphabetically sorted)const countries = [@@ -170,7 +170,7 @@ export function CountrySelector({}: CountrySelectorProps) {return (<Select value={value} onValueChange={onValueChange}>- <SelectTrigger className="w-full">+ <SelectTrigger className="w-full !bg-foreground/[.026]"><SelectValue placeholder={placeholder}>{value && (<span className="flex items-center gap-2">diff --git a/apps/www/components/Supasquad/PerfectTiming.tsx b/apps/www/components/Supasquad/PerfectTiming.tsxindex beea6adf4da..644f2af6e20 100644--- a/apps/www/components/Supasquad/PerfectTiming.tsx+++ b/apps/www/components/Supasquad/PerfectTiming.tsx@@ -1,6 +1,7 @@import React, { FC } from 'react'import { cn, Badge } from 'ui'import SectionContainer from '~/components/Layouts/SectionContainer'+import { companyStats } from '~/data/company-stats'export interface PerfectTimingProps {id: string@@ -76,11 +77,11 @@ const GraphLabel: FC<{ className?: string }> = ({ className }) => ()}><div className="w-fit text-foreground bg-alternative p-4 rounded-lg border flex flex-col gap-1">- <span className="label !text-[10px] !leading-3">Users</span>+ <span className="label !text-[10px] !leading-3">Developers</span><div className="flex items-center gap-2">- <span className="text-foreground-light text-2xl">230,550</span>+ <span className="text-foreground-light text-2xl">{companyStats.developersRegistered}</span><Badge variant="success" size="small" className="h-[24px] px-2">- +13.4%+ {companyStats.developersRegisteredChange}</Badge></div></div>diff --git a/apps/www/data/company-stats.ts b/apps/www/data/company-stats.tsindex 38d0b852dc5..9c733787346 100644--- a/apps/www/data/company-stats.ts+++ b/apps/www/data/company-stats.ts@@ -1,4 +1,6 @@export const companyStats = {databasesManaged: '6,500,000+',databasesLaunchedDaily: '35,000+',+ developersRegistered: '2,500,000+',+ developersRegisteredChange: '+13.4%',}diff --git a/apps/www/data/open-source/contributing/supasquad.tsx b/apps/www/data/open-source/contributing/supasquad.tsxindex 78e26cf3e59..89c0f669637 100644--- a/apps/www/data/open-source/contributing/supasquad.tsx+++ b/apps/www/data/open-source/contributing/supasquad.tsx@@ -10,10 +10,10 @@ export const data = {heroSection: {id: 'hero',title: 'Join the squad',- h1: <>Be a Cornerstone of the Supabase Community</>,+ h1: <>Become a Cornerstone of the Supabase Community</>,subheader: [<>- Join passionate contributors who shape the entire Supabase experience. From helping+ Join passionate contributors to shape the entire Supabase experience. From helpingdevelopers solve problems to creating guides, advocating on social channels, and maintainingcode repositories, find your way to make a meaningful impact.</>,diff --git a/apps/www/data/open-source/contributing/supasquad.utils.tsx b/apps/www/data/open-source/contributing/supasquad.utils.tsxindex a895fb03f9e..1ffd7f2b5e9 100644--- a/apps/www/data/open-source/contributing/supasquad.utils.tsx+++ b/apps/www/data/open-source/contributing/supasquad.utils.tsx@@ -3,6 +3,34 @@ import { LucideIcon } from 'lucide-react'import Link from 'next/link'import type { ComponentType, SVGProps } from 'react'import { cn } from 'ui'+import z from 'zod'++export const supaSquadApplicationSchema = z.object({+ first_name: z.string().min(1, 'First name is required'),+ last_name: z.string().min(1, 'Last name is required'),+ email: z.string().email('Please enter a valid email address'),+ tracks: z+ .array(+ z.object({+ heading: z.string(),+ description: z.string(),+ })+ )+ .min(1, 'Select at least 1 track'),+ areas_of_interest: z.array(z.string()).min(1, 'Select at least 1 area of interest'),+ why_you_want_to_join: z.string().min(1, 'This is required'),+ monthly_commitment: z.string().optional(),+ languages_spoken: z.array(z.string()).min(1, 'Select at least 1 language'),+ skills: z.string().optional(),+ city: z.string().min(1, 'Specify your city'),+ country: z.string().min(1, 'Specify your country'),+ github: z.string().optional(),+ twitter: z.string().optional(),+ discord: z.string().optional(),+ contributions: z.string().optional(),+})++export type SupaSquadApplication = z.infer<typeof supaSquadApplicationSchema>export type HeroIcon = ComponentType<SVGProps<SVGSVGElement>>export type IconType = LucideIcon | HeroIcondiff --git a/apps/www/next-env.d.ts b/apps/www/next-env.d.tsindex 3cd7048ed94..36a4fe488ad 100644--- a/apps/www/next-env.d.ts+++ b/apps/www/next-env.d.ts@@ -1,6 +1,7 @@/// <reference types="next" />/// <reference types="next/image-types/global" />/// <reference types="next/navigation-types/compat/navigation" />+/// <reference path="./.next/types/routes.d.ts" />// NOTE: This file should not be edited// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.