mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## Problem Closes #31221. The applications and shared UI packages still import the former `framer-motion` package instead of Motion's React entry point. ## Solution Replace runtime imports, type imports, and three test mocks with `motion/react` across the consuming workspaces. Replace the seven direct dependency declarations with `motion: ^11.18.2`. Preserve the existing animation engine version and all other dependency resolutions, including the asynchronous `domMax` feature loader. Historical blog examples remain as published; `framer-motion` remains a transitive implementation dependency of Motion. ## Review instructions 1. Run `pnpm install --frozen-lockfile` and check the seven dependency replacements in the lockfile. 2. Open the WWW Auth page and Docs homepage at desktop and mobile widths, with normal and reduced motion preferences. 3. Open the mobile navigation, expand Product on WWW, and close the menu using Escape and the close button. 4. Check the existing animation components, shared form validation, and Studio tests for unchanged behavior. Validation: - Studio: 731 test files, 8,334 passing tests and one expected failure, with `--maxWorkers=4`. - Shared UI, UI patterns, WWW, and UI library: 615 passing tests. - `pnpm run typecheck --concurrency=1`: all 16 repository tasks pass. - All six application source lint scripts and lint ratchets pass; generated Docs example copies are excluded from local lint. - Repository Prettier source check, lockfile formatting, and case hazard check pass. - WWW: 10 existing end-to-end checks across nine pages. - Docs: 5 existing guide link and accessibility checks across Database and Auth. - WWW and Docs mobile navigation pass at desktop/mobile sizes with normal/reduced motion; SQL-to-REST translation tabs exercise the asynchronous feature loader without browser errors. - Frozen-lockfile installation passes; all existing package and snapshot resolutions are unchanged. - Learn and UI library command palettes open, filter results, and close with Escape without browser errors. - Independent code review finds no actionable defects. - `npm run build -- --filter=www --filter=docs --filter=studio --filter=learn --filter=library --concurrency=1 --continue=always`: all five affected applications build successfully (9 tasks including prerequisites); asset uploads disabled for local validation. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) (no docs topics changed) --------- Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>
114 lines
4.1 KiB
TypeScript
114 lines
4.1 KiB
TypeScript
'use client'
|
|
|
|
import { AnimatePresence, motion } from 'motion/react'
|
|
import Link from 'next/link'
|
|
import { useEffect, useState } from 'react'
|
|
import { topTweets } from 'shared-data/tweets'
|
|
import { Button } from 'ui'
|
|
import { TweetCard } from 'ui-patterns/TweetCard'
|
|
|
|
const COLS = 5
|
|
const TWEETS_PER_PAGE = 15
|
|
|
|
// V-shape offsets: outer columns high, center lowest
|
|
const COL_OFFSETS = [0, 60, 100, 60, 0]
|
|
|
|
function distributeToColumns(tweets: typeof topTweets, cols: number) {
|
|
const columns: (typeof topTweets)[] = Array.from({ length: cols }, () => [])
|
|
tweets.forEach((tweet, i) => columns[i % cols].push(tweet))
|
|
return columns
|
|
}
|
|
|
|
export function CommunitySectionV2() {
|
|
const [page, setPage] = useState(0)
|
|
|
|
useEffect(() => {
|
|
if (topTweets.length === 0) return
|
|
const interval = setInterval(() => {
|
|
setPage((p) => p + 1)
|
|
}, 10000)
|
|
return () => clearInterval(interval)
|
|
}, [])
|
|
|
|
if (topTweets.length === 0) return null
|
|
|
|
const currentTweets = Array.from({ length: TWEETS_PER_PAGE }, (_, i) => {
|
|
const idx = (page * TWEETS_PER_PAGE + i) % topTweets.length
|
|
return topTweets[idx]
|
|
})
|
|
|
|
const columns = distributeToColumns(currentTweets, COLS)
|
|
|
|
return (
|
|
<div className="border-b border-border">
|
|
<div className="mx-auto">
|
|
<div className="flex flex-col items-center gap-3 px-6 py-20">
|
|
<h3 className="text-2xl md:text-4xl text-center">Join the community</h3>
|
|
<p className="text-foreground-lighter text-center">
|
|
Discover what our community has to say about their Supabase experience.
|
|
</p>
|
|
<Button asChild size="small" className="mt-2">
|
|
<Link href="https://discord.supabase.com/" target="_blank" rel="noopener noreferrer">
|
|
Join us on Discord
|
|
</Link>
|
|
</Button>
|
|
</div>
|
|
|
|
{/* Decorative social proof — hidden from a11y tree, links not keyboard-reachable to prevent focus trap */}
|
|
<div
|
|
aria-hidden="true"
|
|
className="relative overflow-hidden h-[620px]"
|
|
style={{
|
|
maskImage:
|
|
'linear-gradient(to bottom, black 50%, transparent 100%), linear-gradient(to right, transparent, black 10%, black 90%, transparent)',
|
|
WebkitMaskImage:
|
|
'linear-gradient(to bottom, black 50%, transparent 100%), linear-gradient(to right, transparent, black 10%, black 90%, transparent)',
|
|
maskComposite: 'intersect',
|
|
WebkitMaskComposite: 'destination-in',
|
|
}}
|
|
>
|
|
<AnimatePresence mode="popLayout" initial={false}>
|
|
<motion.div key={page} className="grid grid-cols-2 md:grid-cols-5 gap-2 -mx-4">
|
|
{columns.map((col, colIdx) => (
|
|
<div
|
|
key={colIdx}
|
|
className="flex flex-col gap-2"
|
|
style={{ transform: `translateY(${COL_OFFSETS[colIdx]}px)` }}
|
|
>
|
|
{col.map((tweet, i) => (
|
|
<motion.div
|
|
key={tweet.url}
|
|
initial={{ opacity: 0, scale: 0.98 }}
|
|
animate={{ opacity: 1, scale: 1 }}
|
|
exit={{ opacity: 0, scale: 0.98 }}
|
|
transition={{
|
|
duration: 0.45,
|
|
delay: (colIdx + i * COLS) * 0.03,
|
|
ease: [0.25, 0.46, 0.45, 0.94],
|
|
}}
|
|
>
|
|
<Link
|
|
href={tweet.url}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
tabIndex={-1}
|
|
className="block group/tweet-card"
|
|
>
|
|
<TweetCard
|
|
handle={`@${tweet.handle}`}
|
|
quote={tweet.text}
|
|
img_url={tweet.img_url}
|
|
/>
|
|
</Link>
|
|
</motion.div>
|
|
))}
|
|
</div>
|
|
))}
|
|
</motion.div>
|
|
</AnimatePresence>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|