mirror of
https://github.com/supabase/supabase.git
synced 2026-10-05 17:35:10 +03:00
## What kind of change does this PR introduce? Refactor. Follow-up to #49871. ## What is the current behavior? Branded (green) text still uses the `text-brand` classname while the colour comes from `--primary`. ## What is the new behavior? **Rename-only:** `text-brand` → `text-primary` across callsites and docs. Leftover `bg-brand` / `border-brand` alias to `brand-default`. No intentional colour changes in this PR. This better matches how we treat our green in other components and props, like `variant="primary"` for green buttons. ## To test On light mode: smoke-test that branded text still looks like #49871 (readable green, not the bright fill). - [Homepage](https://zone-www-dot-com-git-dnywh-depr-316-text-brand-de2380-supabase.vercel.app/): “Scale to millions” uses `text-primary` - [Docs homepage](https://docs-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/docs): branded links like “More on self-hosting” are still readable - [Typography docs](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/typography): documents `text-primary` - [Colour usage](https://design-system-git-dnywh-depr-316-text-brand-to-primary-supabase.vercel.app/design-system/docs/color-usage): `text-primary` is visibly darker than `bg-brand-default` _on light mode_ - [Studio auth providers](https://studio-staging-git-dnywh-depr-316-text-brand-to-60fa6c-supabase.vercel.app/dashboard/project/_/auth/providers): enabled provider badge text readable; status dot stays bright green <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Style** * Updated branded text, link hover states, icons, badges, indicators, and highlighted content across the Design System, Docs, Studio, Learn, UI Library, and marketing experiences to use the primary theme color. * Updated syntax highlighting and table-of-contents styling for consistent primary-color presentation. * Refined brand color fallback behavior for bright fills and borders. * **Documentation** * Updated color-usage and typography guidance to recommend the primary text utility. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
130 lines
4.4 KiB
TypeScript
130 lines
4.4 KiB
TypeScript
import { useSendTelemetryEvent } from '~/lib/telemetry'
|
|
import Link from 'next/link'
|
|
import { useState } from 'react'
|
|
import { Button, Input, Label } from 'ui'
|
|
|
|
const isValidEmail = (email: string): boolean => {
|
|
const emailPattern = /^[\w-\.+]+@([\w-]+\.)+[\w-]{2,8}$/
|
|
return emailPattern.test(email)
|
|
}
|
|
|
|
/**
|
|
* Subscribe form for subprocessor update notifications.
|
|
* Mirrors components/SecurityNewsletterForm.tsx, posting to the
|
|
* /api-v2/submit-form-subprocessor-updates route (Customer.io "Subprocessor Alerts", topic_4).
|
|
*/
|
|
const SubprocessorUpdatesForm = () => {
|
|
const [firstName, setFirstName] = useState('')
|
|
const [lastName, setLastName] = useState('')
|
|
const [email, setEmail] = useState('')
|
|
const [status, setStatus] = useState<'idle' | 'loading' | 'success' | 'error'>('idle')
|
|
const [errorMessage, setErrorMessage] = useState('')
|
|
const sendTelemetryEvent = useSendTelemetryEvent()
|
|
|
|
const handleSubmit = async (e: React.FormEvent) => {
|
|
e.preventDefault()
|
|
setErrorMessage('')
|
|
|
|
if (!firstName || !lastName || !email) {
|
|
setErrorMessage('All fields are required.')
|
|
return
|
|
}
|
|
|
|
if (!isValidEmail(email)) {
|
|
setErrorMessage('Please enter a valid email address.')
|
|
return
|
|
}
|
|
|
|
setStatus('loading')
|
|
|
|
try {
|
|
const res = await fetch('/api-v2/submit-form-subprocessor-updates', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ firstName, lastName, email }),
|
|
})
|
|
|
|
if (!res.ok) {
|
|
const data = await res.json()
|
|
throw new Error(data.message || 'Something went wrong')
|
|
}
|
|
|
|
setStatus('success')
|
|
sendTelemetryEvent({ action: 'www_subprocessor_updates_subscribed' })
|
|
} catch (err: any) {
|
|
setStatus('error')
|
|
setErrorMessage(err.message || 'Something went wrong. Please try again.')
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="border rounded-xl bg-surface-75 p-4 md:p-6 w-full max-w-lg not-prose">
|
|
<p className="text-foreground-light text-sm text-pretty mb-6">
|
|
<strong className="text-foreground">Subscribe to updates</strong>. Receive an email
|
|
notification when Supabase updates its sub-processors. By submitting this form, you
|
|
acknowledge and agree that Supabase will process your personal information in accordance
|
|
with our{' '}
|
|
<Link
|
|
href="https://supabase.com/privacy"
|
|
className="text-primary hover:underline"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
>
|
|
Privacy Policy
|
|
</Link>
|
|
.
|
|
</p>
|
|
|
|
{status === 'success' ? (
|
|
<p className="text-foreground text-sm">
|
|
Thanks for subscribing! You'll receive an email when Supabase updates its sub-processors.
|
|
</p>
|
|
) : (
|
|
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
<div className="flex flex-col gap-2">
|
|
<Label htmlFor="subprocessor-first-name">First name</Label>
|
|
<Input
|
|
id="subprocessor-first-name"
|
|
type="text"
|
|
value={firstName}
|
|
onChange={(e) => setFirstName(e.target.value)}
|
|
placeholder="First name"
|
|
required
|
|
/>
|
|
</div>
|
|
<div className="flex flex-col gap-2">
|
|
<Label htmlFor="subprocessor-last-name">Last name</Label>
|
|
<Input
|
|
id="subprocessor-last-name"
|
|
type="text"
|
|
value={lastName}
|
|
onChange={(e) => setLastName(e.target.value)}
|
|
placeholder="Last name"
|
|
required
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div className="flex flex-col gap-2">
|
|
<Label htmlFor="subprocessor-email">Email</Label>
|
|
<Input
|
|
id="subprocessor-email"
|
|
type="email"
|
|
value={email}
|
|
onChange={(e) => setEmail(e.target.value)}
|
|
placeholder="Email"
|
|
required
|
|
/>
|
|
</div>
|
|
{errorMessage && <p className="text-destructive text-sm">{errorMessage}</p>}
|
|
<Button variant="primary" size="large" type="submit" loading={status === 'loading'}>
|
|
Subscribe
|
|
</Button>
|
|
</form>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default SubprocessorUpdatesForm
|