mirror of
https://github.com/supabase/supabase.git
synced 2026-10-10 03:45:06 +03:00
## What kind of change does this PR introduce? Bug fix and design-system update. Resolves DEPR-316. Follow-up rename (`text-brand` → `text-primary`) is in a dedicated PR (https://github.com/supabase/supabase/pull/50564) stacked on this one. ## What is the current behavior? `text-brand` resolves to the canonical bright brand green in places that need readable text, which fails WCAG AA on light surfaces. A separate `text-brand-display` token adds another green for large type. ## What is the new behavior? - `text-brand` maps to accessible `--primary` (light mode darkened to meet ~4.5:1 AA) - `--hue` / `--primary-hue` aligned to 157.5 - `text-brand-display` removed; former display callsites use `text-brand` - Bright fills/borders stay on `brand-default` - Design-system colour and typography docs updated | Before | After | | --- | --- | | <img width="514" height="112" alt="CleanShot 2026-09-02 at 11 13 09@2x" src="https://github.com/user-attachments/assets/4e0138a9-a32d-4e4c-a426-90736706e1e7" /> | <img width="512" height="138" alt="CleanShot 2026-09-21 at 11 42 05@2x" src="https://github.com/user-attachments/assets/164cc5b1-a0c5-4e93-95f1-80016641a114" /> | | <img width="864" height="266" alt="CleanShot 2026-09-02 at 11 13 53@2x" src="https://github.com/user-attachments/assets/3c1ca53f-bf9e-431e-bc15-816b4a275b8e" /> | <img width="882" height="248" alt="CleanShot 2026-09-21 at 11 41 37@2x" src="https://github.com/user-attachments/assets/24828e7b-ed6b-44cb-b9dc-becc3398bdfc" /> | | <img width="782" height="692" alt="CleanShot 2026-09-02 at 11 16 30@2x" src="https://github.com/user-attachments/assets/fc871977-77bc-47fb-9e0e-9284e0ecd5cc" /> | <img width="730" height="690" alt="CleanShot 2026-09-21 at 11 42 52@2x" src="https://github.com/user-attachments/assets/bf479515-d5f9-471e-b82d-f097c0f4b56c" /> | | <img width="480" height="306" alt="CleanShot 2026-09-02 at 11 18 53@2x" src="https://github.com/user-attachments/assets/03f341f4-f02e-44f8-a2b2-8c31670d0427" /> | <img width="470" height="300" alt="CleanShot 2026-09-21 at 11 43 19@2x" src="https://github.com/user-attachments/assets/9df18217-d5e6-48b8-ba0b-579d2664b94b" /> | | <img width="960" height="300" alt="CleanShot 2026-09-02 at 11 32 04@2x" src="https://github.com/user-attachments/assets/6b1d9373-7a71-4247-81ff-26441604b09d" /> | <img width="980" height="306" alt="CleanShot 2026-09-21 at 11 44 13@2x" src="https://github.com/user-attachments/assets/41ad4784-02ec-4b29-b860-32af9fa79aa8" /> | | <img width="924" height="214" alt="CleanShot 2026-09-02 at 11 34 44@2x" src="https://github.com/user-attachments/assets/1de661fe-c7b6-499b-a94f-e4737436ec79" /> | <img width="752" height="162" alt="CleanShot 2026-09-21 at 11 44 56@2x" src="https://github.com/user-attachments/assets/1811890f-0660-4445-84e9-447720954fa1" /> | ## To test Test each callsite **in light mode** (dark mode is largely unchanged). ### WWW - [Homepage](https://zone-www-dot-com-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/): “Scale to millions” uses readable brand text (display token is gone) - [Careers](https://zone-www-dot-com-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/careers): small “Careers” eyebrow readable; green dividers stay bright `brand-default` - [Contact](https://zone-www-dot-com-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/contact-us): email / policy links use readable brand text - [Regions](https://zone-www-dot-com-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/regions): “Ask about early access to BYOC” readable ### Docs - [Docs homepage](https://docs-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/docs): “DOCS” wordmark and resource links readable - [Database overview](https://docs-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/docs/guides/database/overview): nav / footer brand links readable - [JavaScript reference](https://docs-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/docs/reference/javascript/introduction): active sidebar treatment readable ### Design system - [Typography](https://design-system-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/docs/typography): documents `text-brand` only (no display) - [Colour usage](https://design-system-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/docs/color-usage): `text-brand` vs `bg-brand-default` - [Design-system homepage](https://design-system-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/): brand text examples across themes ### Studio - [Auth providers](https://studio-staging-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/dashboard/project/_/auth/providers): enabled provider badge text readable; status dot stays bright - [Database policies](https://studio-staging-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/dashboard/project/_/database/policies?new=true): template hover text more legible - [Database connections](https://studio-staging-git-dnywh-depr-316-brand-text-tokens-supabase.vercel.app/dashboard/project/_/observability/connections): “Live” status readable; animated dot stays bright green --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
205 lines
7.9 KiB
TypeScript
205 lines
7.9 KiB
TypeScript
'use client'
|
|
|
|
import { useEvents } from '~/app/events/context'
|
|
import { formatHosts } from '~/lib/eventsUtils'
|
|
import { MapPinIcon, Rows3Icon, VideoIcon } from 'lucide-react'
|
|
import Link from 'next/link'
|
|
import { Badge, Button, cn } from 'ui'
|
|
|
|
const CATEGORIES_FILTERS = [
|
|
{ name: 'All', value: 'all' },
|
|
{ name: 'Community Event', value: 'community' },
|
|
{ name: 'Meetup', value: 'meetup' },
|
|
{ name: 'Conference', value: 'conference' },
|
|
{ name: 'Workshop', value: 'workshop' },
|
|
{ name: 'Hackathon', value: 'hackathon' },
|
|
{ name: 'Webinar', value: 'webinar' },
|
|
]
|
|
|
|
export function EventList() {
|
|
const { isLoading, filteredEvents, selectedCategories } = useEvents()
|
|
const isOnDemandView = selectedCategories.includes('on-demand')
|
|
|
|
const getCategoryLabel = (value: string) => {
|
|
const category = CATEGORIES_FILTERS.find((cat) => cat.value === value)
|
|
return category?.name || value
|
|
}
|
|
|
|
if (isLoading) {
|
|
return <EventListSkeleton />
|
|
}
|
|
|
|
// Group events by date
|
|
const eventsByDate = filteredEvents.reduce(
|
|
(acc, event) => {
|
|
const isDateOnly = event.date.endsWith('T12:00:00Z')
|
|
const eventDate = new Date(event.date).toLocaleDateString('en-US', {
|
|
weekday: 'long',
|
|
year: 'numeric',
|
|
month: 'long',
|
|
day: 'numeric',
|
|
...(isDateOnly ? { timeZone: 'UTC' } : {}),
|
|
})
|
|
|
|
if (!acc[eventDate]) {
|
|
acc[eventDate] = []
|
|
}
|
|
acc[eventDate].push(event)
|
|
return acc
|
|
},
|
|
{} as Record<string, typeof filteredEvents>
|
|
)
|
|
|
|
const hasEvents = Object.keys(eventsByDate).length > 0
|
|
const sortedDateGroups = Object.entries(eventsByDate).sort(([, eventsA], [, eventsB]) => {
|
|
if (!isOnDemandView) return 0
|
|
return new Date(eventsB[0].date).getTime() - new Date(eventsA[0].date).getTime()
|
|
})
|
|
|
|
return (
|
|
<div className="flex flex-col gap-y-8 min-h-72">
|
|
{sortedDateGroups.map(([date, events], index) => (
|
|
<div key={`group-${date}`} className="flex flex-col gap-y-2 relative">
|
|
<div
|
|
className={cn(
|
|
'absolute top-2 left-[-59px] rounded-full size-1.5',
|
|
index === 0 ? 'bg-brand-default size-2 left-[-60px]' : 'bg-foreground-muted'
|
|
)}
|
|
/>
|
|
|
|
<h3 className="text-foreground-light font-normal">{date}</h3>
|
|
|
|
<div className="flex flex-col gap-y-4">
|
|
{events.map((event, idx) => (
|
|
<div
|
|
key={`${idx}-${event.url}`}
|
|
className="bg-surface-100 border rounded-md p-3 flex justify-between items-start relative"
|
|
>
|
|
{event.url && (
|
|
<Link
|
|
className="inset-0 absolute"
|
|
href={event.disable_page_build ? event.url : event.path || event.url}
|
|
target={event.link?.target ?? '_self'}
|
|
rel={event.link?.target === '_blank' ? 'noopener noreferrer' : undefined}
|
|
title="Go to event page"
|
|
aria-hidden
|
|
/>
|
|
)}
|
|
|
|
<div className="flex flex-col gap-4 min-w-0 flex-1">
|
|
<div className="flex flex-col gap-2">
|
|
<h3 className="leading-snug">{event.title}</h3>
|
|
|
|
{event.end_date && (
|
|
<p className="text-xs text-foreground-light">
|
|
{new Date(event.date).toLocaleDateString('en-US', {
|
|
month: 'short',
|
|
day: 'numeric',
|
|
})}
|
|
{' - '}
|
|
{new Date(event.end_date).toLocaleDateString('en-US', {
|
|
month: 'short',
|
|
day: 'numeric',
|
|
year: 'numeric',
|
|
})}
|
|
</p>
|
|
)}
|
|
</div>
|
|
|
|
{event.categories?.includes('webinar') ? (
|
|
<div className="flex gap-2 items-center text-sm text-foreground-light">
|
|
<VideoIcon className="size-4 shrink-0" strokeWidth={1.5} />
|
|
Supabase Live
|
|
</div>
|
|
) : event.hosts.length > 0 ? (
|
|
<div className="flex gap-2 items-center text-sm text-foreground-light">
|
|
<div className="size-5 rounded-full border bg-linear-to-br from-background-surface-100 to-background-surface-200 relative">
|
|
{event.hosts[0]?.avatar_url && (
|
|
<img
|
|
src={event.hosts[0].avatar_url}
|
|
alt={event.hosts[0].name || 'Host image'}
|
|
className="absolute inset-0 w-full h-full object-cover rounded-full"
|
|
/>
|
|
)}
|
|
</div>
|
|
Hosted by {formatHosts(event.hosts).displayText}
|
|
</div>
|
|
) : event.source === 'notion' && event.location ? (
|
|
<div className="flex gap-2 items-center text-sm text-foreground-light">
|
|
<MapPinIcon className="size-4 shrink-0" strokeWidth={1.5} />
|
|
{event.location}
|
|
</div>
|
|
) : null}
|
|
</div>
|
|
|
|
<div className="flex flex-wrap items-center justify-end gap-2 shrink-0 relative z-10">
|
|
{event.meetingLink && (
|
|
<Button size="tiny" variant="secondary" asChild>
|
|
<Link href={event.meetingLink} target="_blank" rel="noopener noreferrer">
|
|
Meet with us
|
|
</Link>
|
|
</Button>
|
|
)}
|
|
{event.onDemand && !isOnDemandView && <Badge variant="default">On-demand</Badge>}
|
|
{event.isSpeaking && <Badge variant="success">Speaking</Badge>}
|
|
{event.categories.slice(0, 3).map((tag, idx) => (
|
|
<Badge key={`tag-${idx}`}>{getCategoryLabel(tag)}</Badge>
|
|
))}
|
|
{event.categories.length > 3 && (
|
|
<Badge title={event.categories.slice(3).map(getCategoryLabel).join(', ')}>
|
|
+{event.categories.length - 3}
|
|
</Badge>
|
|
)}
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
))}
|
|
|
|
{!hasEvents && (
|
|
<div className="self-center text-muted my-auto flex flex-col items-center gap-y-4">
|
|
<Rows3Icon className="size-8" />
|
|
<p className="">
|
|
{isOnDemandView ? 'No on-demand events found.' : 'Oops! No events found.'}
|
|
</p>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
const EventListSkeleton = () => {
|
|
return (
|
|
<div className="flex flex-col gap-y-8">
|
|
{[1, 2, 3].map((groupIdx) => (
|
|
<div key={`skeleton-group-${groupIdx}`} className="flex flex-col gap-y-2 relative">
|
|
<div className="absolute top-2 left-[-59px] rounded-full size-1.5 bg-foreground-muted" />
|
|
|
|
<div className="h-6 bg-surface-200 rounded-sm animate-pulse w-64" />
|
|
|
|
<div className="flex flex-col gap-y-4">
|
|
{[1, 2, 3, 4].map((eventIdx) => (
|
|
<div
|
|
key={`skeleton-event-${groupIdx}-${eventIdx}`}
|
|
className="bg-surface-100 border rounded-md p-3 flex justify-between items-start"
|
|
>
|
|
<div className="flex flex-col gap-2 flex-1">
|
|
<div className="h-6 bg-surface-200 rounded-sm animate-pulse w-3/4" />
|
|
|
|
<div className="flex gap-2 items-center">
|
|
<div className="size-5 rounded-full bg-surface-200 animate-pulse" />
|
|
<div className="h-4 bg-surface-200 rounded-sm animate-pulse w-32" />
|
|
</div>
|
|
</div>
|
|
|
|
<div className="h-6 w-16 bg-surface-200 rounded-full animate-pulse" />
|
|
</div>
|
|
))}
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|