Skip to content

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

reorganize footer, add newsletter form (#43769)

Alan Danielf3efb14e6f6d
diff --git a/apps/www/app/api-v2/submit-form-newsletter/route.tsx b/apps/www/app/api-v2/submit-form-newsletter/route.tsx
new file mode 100644
index 00000000000..c005092dec6
--- /dev/null
+++ b/apps/www/app/api-v2/submit-form-newsletter/route.tsx
@@ -0,0 +1,95 @@
+import * as Sentry from '@sentry/nextjs'
+
+import { CustomerioTrackClient } from '~/lib/customerio'
+
+const corsHeaders = {
+ 'Access-Control-Allow-Origin': '*',
+ 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
+ 'Access-Control-Allow-Methods': 'POST, OPTIONS',
+}
+
+const isValidEmail = (email: string): boolean => {
+ const emailPattern = /^[\w-\.+]+@([\w-]+\.)+[\w-]{2,8}$/
+ return emailPattern.test(email)
+}
+
+const RATE_LIMIT_WINDOW = 60 * 1000 // 1 minute
+const RATE_LIMIT_MAX = 5
+const ipRequestMap = new Map<string, { count: number; resetAt: number }>()
+
+export async function OPTIONS() {
+ return new Response(null, {
+ headers: corsHeaders,
+ status: 204,
+ })
+}
+
+export async function POST(req: Request) {
+ const ip = req.headers.get('x-forwarded-for')?.split(',')[0]?.trim() ?? 'unknown'
+ const now = Date.now()
+ const entry = ipRequestMap.get(ip)
+
+ if (entry && now < entry.resetAt) {
+ if (entry.count >= RATE_LIMIT_MAX) {
+ return new Response(JSON.stringify({ message: 'Too many requests. Try again later.' }), {
+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },
+ status: 429,
+ })
+ }
+ entry.count++
+ } else {
+ ipRequestMap.set(ip, { count: 1, resetAt: now + RATE_LIMIT_WINDOW })
+ }
+
+ let body: any
+ try {
+ body = await req.json()
+ } catch {
+ return new Response(JSON.stringify({ message: 'Invalid JSON body' }), {
+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },
+ status: 400,
+ })
+ }
+
+ const { email } = body
+
+ if (!email) {
+ return new Response(JSON.stringify({ message: 'Email is required' }), {
+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },
+ status: 422,
+ })
+ }
+
+ if (!isValidEmail(email)) {
+ return new Response(JSON.stringify({ message: 'Invalid email address' }), {
+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },
+ status: 422,
+ })
+ }
+
+ try {
+ const customerioSiteId = process.env.CUSTOMERIO_SITE_ID
+ const customerioApiKey = process.env.CUSTOMERIO_API_KEY
+
+ if (!customerioSiteId || !customerioApiKey) {
+ throw new Error('Customer.io credentials not configured')
+ }
+
+ const cio = new CustomerioTrackClient(customerioSiteId, customerioApiKey)
+
+ await cio.createOrUpdateProfile(email, {
+ 'cio_subscription_preferences.topics.topic_1': true,
+ })
+
+ return new Response(JSON.stringify({ message: 'Subscription successful' }), {
+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },
+ status: 200,
+ })
+ } catch (error: any) {
+ Sentry.captureException(error)
+ return new Response(JSON.stringify({ error: error.message }), {
+ headers: { ...corsHeaders, 'Content-Type': 'application/json' },
+ status: 500,
+ })
+ }
+}
diff --git a/apps/www/components/Footer/index.tsx b/apps/www/components/Footer/index.tsx
index eedb6b02ff0..75607341b1e 100644
--- a/apps/www/components/Footer/index.tsx
+++ b/apps/www/components/Footer/index.tsx
@@ -2,11 +2,22 @@
import { CheckIcon } from '@heroicons/react/outline'
import { REALTIME_CHANNEL_STATES } from '@supabase/supabase-js'
-import Link from 'next/link'
-import { useEffect } from 'react'
import footerData from 'data/Footer'
+import Link from 'next/link'
import { usePathname } from 'next/navigation'
-import { Badge, IconDiscord, IconGitHubSolid, IconTwitterX, IconYoutubeSolid, cn } from 'ui'
+import { FormEvent, useEffect, useState } from 'react'
+import {
+ Badge,
+ Button,
+ cn,
+ IconDiscord,
+ IconGitHubSolid,
+ IconInstagram,
+ IconTikTok,
+ IconTwitterX,
+ IconYoutubeSolid,
+ Input_Shadcn_,
+} from 'ui'
import { ThemeToggle } from 'ui-patterns/ThemeToggle'
import SupabaseWordmark from '~/components/Nav/SupabaseWordmark'
import supabase from '~/lib/supabase'
@@ -21,6 +32,28 @@ interface Props {
const Footer = (props: Props) => {
const pathname = usePathname()
+ const [newsletterEmail, setNewsletterEmail] = useState('')
+ const [newsletterStatus, setNewsletterStatus] = useState<
+ 'idle' | 'loading' | 'success' | 'error'
+ >('idle')
+
+ const handleNewsletterSubmit = async (e: FormEvent) => {
+ e.preventDefault()
+ if (!newsletterEmail) return
+ setNewsletterStatus('loading')
+ try {
+ const res = await fetch('/api-v2/submit-form-newsletter', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify({ email: newsletterEmail }),
+ })
+ if (!res.ok) throw new Error()
+ setNewsletterStatus('success')
+ } catch {
+ setNewsletterStatus('error')
+ }
+ }
+
const isDarkLaunchWeek = useDarkLaunchWeeks()
const isGAWeek = pathname?.includes('/ga-week')
const forceDark = isDarkLaunchWeek
@@ -110,10 +143,58 @@ const Footer = (props: Props) => {
<span className="sr-only">Youtube</span>
<IconYoutubeSolid size={22} />
</a>
+
+ <a
+ href="https://www.tiktok.com/@supabase.com"
+ className="text-foreground-lighter hover:text-foreground transition"
+ >
+ <span className="sr-only">TikTok</span>
+ <IconTikTok size={22} />
+ </a>
+
+ <a
+ href="https://www.instagram.com/supabasecom"
+ className="text-foreground-lighter hover:text-foreground transition"
+ >
+ <span className="sr-only">Instagram</span>
+ <IconInstagram size={22} />
+ </a>
+ </div>
+ <div className="mt-8">
+ {newsletterStatus === 'success' ? (
+ <p className="text-brand-link text-sm">Thanks for subscribing!</p>
+ ) : (
+ <form onSubmit={handleNewsletterSubmit} className="flex flex-col gap-2">
+ <p className="text-foreground-lighter text-sm">
+ Get product updates and news from Supabase.
+ </p>
+ <Input_Shadcn_
+ type="email"
+ placeholder="Your email"
+ aria-label="Email for newsletter"
+ value={newsletterEmail}
+ onChange={(e) => setNewsletterEmail(e.target.value)}
+ required
+ className="flex-1 md:max-w-72 xl:max-w-[80%] !h-6 text-xs px-2"
+ />
+ <Button
+ type="primary"
+ size="tiny"
+ htmlType="submit"
+ loading={newsletterStatus === 'loading'}
+ className="w-fit"
+ >
+ Subscribe
+ </Button>
+ </form>
+ )}
+ {newsletterStatus === 'error' && (
+ <p className="text-destructive text-sm mt-2">Something went wrong. Try again.</p>
+ )}
</div>
</div>
<div className="mt-12 grid grid-cols-1 gap-8 xl:col-span-5 xl:mt-0">
- <div className="grid grid-cols-2 gap-4 md:grid-cols-5">
+ <div className="grid grid-cols-2 gap-x-4 gap-y-12 md:grid-cols-3 xl:grid-cols-6">
{footerData.map((segment) => {
return (
<div key={`footer_${segment.title}`}>
diff --git a/apps/www/data/Footer.ts b/apps/www/data/Footer.ts
index acc1a8b925b..5fa08c94530 100644
--- a/apps/www/data/Footer.ts
+++ b/apps/www/data/Footer.ts
@@ -5,6 +5,10 @@ const footerData = [
{
title: 'Product',
links: [
+ {
+ text: 'Pricing',
+ url: '/pricing',
+ },
{
text: 'Database',
url: '/database',
@@ -34,8 +38,8 @@ const footerData = [
url: '/modules/cron',
},
{
- text: 'Pricing',
- url: '/pricing',
+ text: 'Feature Catalog',
+ url: '/features',
},
{
text: 'Launch Week',
@@ -117,8 +121,21 @@ const footerData = [
url: '/changelog',
},
{
- text: 'Careers',
- url: '/careers',
+ text: 'RSS',
+ url: '/rss.xml',
+ },
+ ],
+ },
+ {
+ title: 'Community',
+ links: [
+ {
+ text: 'Events & Webinars',
+ url: '/events',
+ },
+ {
+ text: 'SupaSquad',
+ url: '/supasquad',
},
{
text: 'Contributing',
@@ -128,18 +145,10 @@ const footerData = [
text: 'Open Source',
url: '/open-source',
},
- {
- text: 'SupaSquad',
- url: '/supasquad',
- },
{
text: 'DevTo',
url: 'https://dev.to/supabase',
},
- {
- text: 'RSS',
- url: '/rss.xml',
- },
],
},
{
@@ -149,6 +158,10 @@ const footerData = [
text: 'Company',
url: '/company',
},
+ {
+ text: 'Careers',
+ url: '/careers',
+ },
{
text: 'General Availability',
url: '/ga',
diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx
index 3207955f943..25bc69cd3e1 100644
--- a/packages/ui/index.tsx
+++ b/packages/ui/index.tsx
@@ -272,6 +272,7 @@ export * from './src/components/Icon/icons/IconDiscord'
export * from './src/components/Icon/icons/IconDiscussions'
export * from './src/components/Icon/icons/IconDocumentation'
export * from './src/components/Icon/icons/IconGitHubSolid'
+export * from './src/components/Icon/icons/IconInstagram'
export * from './src/components/Icon/icons/IconIntegrations'
export * from './src/components/Icon/icons/IconLifeBuoy2'
export * from './src/components/Icon/icons/IconLinkedinSolid'
@@ -279,6 +280,7 @@ export * from './src/components/Icon/icons/IconMicSolid'
export * from './src/components/Icon/icons/IconPartners'
export * from './src/components/Icon/icons/IconPresence'
export * from './src/components/Icon/icons/IconProductHunt'
+export * from './src/components/Icon/icons/IconTikTok'
export * from './src/components/Icon/icons/IconTwitterX'
export * from './src/components/Icon/icons/IconYCombinator'
export * from './src/components/Icon/icons/IconYoutubeSolid'
diff --git a/packages/ui/src/components/Icon/icons/IconInstagram/IconInstagram.tsx b/packages/ui/src/components/Icon/icons/IconInstagram/IconInstagram.tsx
new file mode 100644
index 00000000000..8aed996b51c
--- /dev/null
+++ b/packages/ui/src/components/Icon/icons/IconInstagram/IconInstagram.tsx
@@ -0,0 +1,21 @@
+// @ts-ignore
+import IconBase from '../../IconBase'
+
+const src = (
+ <>
+ <path
+ fill="currentColor"
+ d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069ZM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0Z"
+ />
+ <path
+ fill="currentColor"
+ d="M12 5.838a6.162 6.162 0 1 0 0 12.324 6.162 6.162 0 0 0 0-12.324ZM12 16a4 4 0 1 1 0-8 4 4 0 0 1 0 8ZM18.406 4.155a1.44 1.44 0 1 0 0 2.88 1.44 1.44 0 0 0 0-2.88Z"
+ />
+ </>
+)
+
+function IconInstagram(props: any) {
+ return <IconBase src={src} stroke="none" viewBox="0 0 24 24" {...props} />
+}
+
+export default IconInstagram
diff --git a/packages/ui/src/components/Icon/icons/IconInstagram/index.tsx b/packages/ui/src/components/Icon/icons/IconInstagram/index.tsx
new file mode 100644
index 00000000000..d16c8379882
--- /dev/null
+++ b/packages/ui/src/components/Icon/icons/IconInstagram/index.tsx
@@ -0,0 +1 @@
+export { default as IconInstagram } from './IconInstagram'
diff --git a/packages/ui/src/components/Icon/icons/IconTikTok/IconTikTok.tsx b/packages/ui/src/components/Icon/icons/IconTikTok/IconTikTok.tsx
new file mode 100644
index 00000000000..57b5ce78e65
--- /dev/null
+++ b/packages/ui/src/components/Icon/icons/IconTikTok/IconTikTok.tsx
@@ -0,0 +1,15 @@
+// @ts-ignore
+import IconBase from '../../IconBase'
+
+const src = (
+ <path
+ fill="currentColor"
+ d="M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07Z"
+ />
+)
+
+function IconTikTok(props: any) {
+ return <IconBase src={src} stroke="none" viewBox="0 0 24 24" {...props} />
+}
+
+export default IconTikTok
diff --git a/packages/ui/src/components/Icon/icons/IconTikTok/index.tsx b/packages/ui/src/components/Icon/icons/IconTikTok/index.tsx
new file mode 100644
index 00000000000..bc8afab9cdd
--- /dev/null
+++ b/packages/ui/src/components/Icon/icons/IconTikTok/index.tsx
@@ -0,0 +1 @@
+export { default as IconTikTok } from './IconTikTok'