Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e4fb43a
Use responsive animated WebP for the homepage palm loop
manudeli Nov 21, 2026
f4c982e
Preserve photographic leaf detail in the homepage palm loop
manudeli Nov 21, 2026
4ff9395
Restore each original palm frame before encoding WebP
manudeli Nov 21, 2026
ff3a775
Layer a shared transparent palm over the homepage sky
manudeli Nov 21, 2026
2d6fa42
Add a subtle static grain to the homepage sky
manudeli Nov 21, 2026
5a3401b
Shrink the palm loop and preserve finer frond edges
manudeli Nov 21, 2026
054014d
Prefer a smaller animated AVIF for the homepage palm
manudeli Nov 21, 2026
ffa1259
Show the palm poster while the animation is loading
manudeli Nov 21, 2026
f3adff8
Prioritize the homepage palm poster and defer offscreen work
manudeli Nov 21, 2026
7941f48
Load live homepage stats on visibility and keep signup immediately in…
manudeli Nov 21, 2026
0a307fc
Make the homepage palm pausable from first paint
manudeli Nov 21, 2026
b3f17a5
Use WebP as the only homepage palm animation
manudeli Nov 21, 2026
1b48934
Load one palm WebP for the visitor’s motion preference
manudeli Nov 21, 2026
fae8c28
Avoid an extra palm request during streamed HTML parsing
manudeli Nov 21, 2026
05e5839
Show the first palm frame early and shrink its WebP loop
manudeli Nov 22, 2026
dbe5b06
Use a plain CSS gradient behind the homepage palm
manudeli Nov 22, 2026
ca63935
Reduce the homepage palm transfer while keeping early motion
manudeli Nov 22, 2026
08cf2ca
Preserve the full forward palm motion within the homepage media budget
manudeli Nov 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added public/images/hero-palm-cutout-still.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/hero-palm-cutout.webp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
142 changes: 46 additions & 96 deletions src/components/home/HeroPalmMedia.tsx
Original file line number Diff line number Diff line change
@@ -1,109 +1,59 @@
import * as React from 'react'
import { PauseIcon, PlayIcon } from '@phosphor-icons/react'
import { preload } from 'react-dom'
import { Squircle } from '~/components/Squircle'

export function HeroPalmMedia() {
const videoRef = React.useRef<HTMLVideoElement>(null)
const [isVideoReady, setIsVideoReady] = React.useState(false)
const [isPlaying, setIsPlaying] = React.useState(false)

const playVideo = React.useCallback((video: HTMLVideoElement) => {
if (video.networkState === HTMLMediaElement.NETWORK_NO_SOURCE) video.load()
const promise = video.play()
if (promise !== undefined) {
promise
.then(() => setIsVideoReady(true))
.catch((error: unknown) => {
if (error instanceof DOMException && error.name === 'AbortError')
return
console.error('Unable to play the homepage hero animation', error)
setIsPlaying(false)
setIsVideoReady(false)
})
}
}, [])

React.useEffect(() => {
const video = videoRef.current
if (!video) return
const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)')

const pauseForReducedMotion = () => {
if (reducedMotion.matches) video.pause()
}
const motion = '/images/hero-palm-cutout.webp'
const still = '/images/hero-palm-cutout-still.webp'
const allowMotion = '(prefers-reduced-motion: no-preference)'

pauseForReducedMotion()
setIsPlaying(!video.paused)
setIsVideoReady(video.readyState >= HTMLMediaElement.HAVE_FUTURE_DATA)
reducedMotion.addEventListener('change', pauseForReducedMotion)
return () =>
reducedMotion.removeEventListener('change', pauseForReducedMotion)
}, [])

const togglePlayback = () => {
const video = videoRef.current
if (!video) return
export function HeroPalmMedia() {
preload(still, { as: 'image', fetchPriority: 'high' })
preload(motion, { as: 'image', fetchPriority: 'high', media: allowMotion })

if (video.paused) {
playVideo(video)
} else {
video.pause()
}
}
const [motionFailed, setMotionFailed] = React.useState(false)

return (
<>
<Squircle
aria-hidden
className="absolute inset-0 -z-10 overflow-hidden rounded-xl [corner-shape:squircle]"
>
<picture className="contents">
<source
type="image/webp"
srcSet="/images/hero-palm-gradient-960.webp 960w, /images/hero-palm-gradient-1600.webp 1600w, /images/hero-palm-gradient-2400.webp 2400w"
sizes="100vw"
/>
<Squircle
aria-hidden
className="pointer-events-none absolute inset-0 -z-10 grid place-content-center overflow-hidden rounded-xl [container-type:size] [corner-shape:squircle]"
>
{/* Keep the palm aligned with the original 944 × 416 composition. */}
<div className="home-palm-sky relative aspect-[944/416] w-[max(100cqw,calc(100cqh*944/416))]">
<div className="absolute bottom-0 left-[calc(100%*360/944)] w-[calc(100%*260/944)]">
<img
src="/images/hero-palm-gradient.jpg"
src={still}
alt=""
width={2400}
height={1058}
loading="eager"
width={260}
height={348}
fetchPriority="high"
className={`relative z-10 h-full w-full object-cover object-center ${isVideoReady ? 'opacity-0 motion-reduce:opacity-100' : ''}`}
/>
</picture>
<video
ref={videoRef}
autoPlay
loop
muted
playsInline
onPause={() => setIsPlaying(false)}
onPlay={() => setIsPlaying(true)}
onCanPlay={() => setIsVideoReady(true)}
onError={() => setIsVideoReady(false)}
className="absolute inset-0 h-full w-full object-cover object-center motion-reduce:hidden"
>
<source
src="/images/hero-palm-motion.mp4"
type="video/mp4"
media="(prefers-reduced-motion: no-preference)"
className="block h-auto w-full"
/>
</video>
</Squircle>
<button
type="button"
onClick={togglePlayback}
aria-label={isPlaying ? 'Pause hero animation' : 'Play hero animation'}
className="absolute right-4 top-4 z-20 grid size-8 place-items-center rounded-full bg-ds-neutral-500/65 text-white opacity-0 backdrop-blur-sm transition-opacity hover:bg-ds-neutral-500/80 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white group-hover:opacity-100 motion-reduce:hidden"
>
{isPlaying ? (
<PauseIcon className="size-4" weight="fill" />
) : (
<PlayIcon className="size-4" weight="fill" />
)}
</button>
</>
<picture className="absolute inset-0 motion-reduce:hidden">
{!motionFailed && (
<source type="image/webp" media={allowMotion} srcSet={motion} />
)}
<img
src={still}
alt=""
width={260}
height={348}
fetchPriority="high"
ref={(image) => {
// A failed request can finish before hydration attaches onError.
if (
image?.complete &&
!image.naturalWidth &&
image.currentSrc.endsWith(motion)
) {
setMotionFailed(true)
}
}}
onError={() => setMotionFailed(true)}
className="block h-auto w-full"
/>
</picture>
</div>
</div>
</Squircle>
)
}
5 changes: 2 additions & 3 deletions src/components/home/HomeApplicationStarter.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import { Hydrate } from '@tanstack/react-start'
import { idle, visible } from '@tanstack/react-start/hydration'
import { visible } from '@tanstack/react-start/hydration'

import { ApplicationStarter } from '~/components/ApplicationStarter'
import { HomeApplicationStarterFallback } from './HomeSectionFallbacks'
Expand All @@ -17,8 +17,7 @@ const headlines = [
export function HomeApplicationStarter() {
return (
<Hydrate
when={visible({ rootMargin: '180px 0px' })}
prefetch={idle({ timeout: 3500 })}
when={visible({ rootMargin: '0px' })}
fallback={<HomeApplicationStarterFallback />}
>
<RotatingHomeApplicationStarter />
Expand Down
49 changes: 23 additions & 26 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@ import {
LightningIcon,
type Icon,
} from '@phosphor-icons/react'
import { Hydrate } from '@tanstack/react-start'
import { visible } from '@tanstack/react-start/hydration'
import { HeroPalmMedia } from '~/components/home/HeroPalmMedia'
import { HomeApplicationStarter } from '~/components/home/HomeApplicationStarter'
import { HomeCommunitySection } from '~/components/home/HomeCommunitySection'
import { HomeNewsletterSection } from '~/components/home/HomeNewsletterSection'
import { HomeSocialProofSection } from '~/components/home/HomeSocialProofSection'
import { HomeStatsFallback } from '~/components/home/HomeSectionFallbacks'
import { HomeStatsSection } from '~/components/home/HomeStatsSection'
import { useQuery } from '@tanstack/react-query'
import { Button, Eyebrow } from '~/components/ds/ui'
Expand All @@ -31,15 +34,7 @@ import { seo } from '~/utils/seo'
import { getTanStackHomepageJsonLd } from '~/utils/organization-structured-data'

export const Route = createFileRoute('/')({
loader: async ({ context: { queryClient } }) => {
const [, , recentPosts] = await Promise.all([
queryClient.ensureQueryData(ossStatsQuery()),
queryClient.ensureQueryData(homepageNpmStatsSummaryQuery()),
fetchRecentPosts(),
])

return { recentPosts }
},
loader: () => fetchRecentPosts(),
head: () => ({
meta: seo({
title: 'TanStack | The open-source application stack for the web.',
Expand All @@ -57,7 +52,7 @@ export const Route = createFileRoute('/')({
})

function Index() {
const { recentPosts } = Route.useLoaderData()
const recentPosts = Route.useLoaderData()
const { openLibraries } = useLibrariesOverlay()

const startWithPrompt = (e: React.MouseEvent) => {
Expand All @@ -78,19 +73,14 @@ function Index() {
<Scarf id={homepageScarfPixel} path="/" />
<main className="max-w-full z-10 space-y-24">
<div className="space-y-8">
{/* Hero — Figma node 802:2027. Full-bleed palm/gradient photo card:
headline bottom-left, description + CTA bottom-right. The photo is
{/* Hero — Figma node 802:2027. Full-bleed palm and sky:
headline bottom-left, description + CTA bottom-right. The sky is
always light, so text uses a mode-stable dark token (neutral-500)
rather than a theme-flipping semantic. */}
<div className="mx-0 rounded-none bg-background-subtle p-0 sm:mx-2 sm:rounded-2xl sm:p-1">
{/* `svh`, not `dvh` — the dynamic viewport grows as iOS collapses
the URL bar mid-scroll, visibly stretching the hero. */}
<div className="group relative isolate flex h-[calc(100svh-var(--navbar-height))] max-h-[720px] min-h-[560px] flex-col justify-between gap-8 overflow-hidden rounded-none px-6 py-10 [text-shadow:0_2px_8px_rgb(255_255_255/0.2)] sm:rounded-xl sm:px-10 md:flex-row md:items-end md:justify-between md:gap-8 md:[text-shadow:none] xl:gap-12 xl:px-16 xl:py-16">
{/* The parent supplies the 4px frame shared by the hero and stats.
This wrapper clips the image to the inner radius so the <img>
fills it exactly instead of overflowing. Plain <img> (not OptimizedImage):
the Cloudflare transform resolves against the production origin,
so a newly-added asset 404s until deployed. */}
<HeroPalmMedia />
<h1 className="max-w-[613px] font-ds-display text-ds-display-sm font-bold text-ds-neutral-500 md:w-[47%] md:text-[clamp(2rem,4.3vw,4rem)] md:leading-[1.1] md:tracking-[-0.025em] xl:leading-[1.08]">
The{' '}
Expand All @@ -106,7 +96,7 @@ function Index() {
applications that work naturally for developers and reliably
for agents
</p>
{/* The photo is always light, so scope the CTAs to the DS
{/* The sky is always light, so scope the CTAs to the DS
light mode — the Buttons then render as their standard DS
light-mode selves (no per-button color overrides). */}
<div className="ds-mode-light flex flex-wrap items-center gap-2">
Expand Down Expand Up @@ -143,7 +133,12 @@ function Index() {
</div>
</div>
<div className="flex items-center justify-center px-2.5 py-6">
<HomeStatsSection />
<Hydrate
when={visible({ rootMargin: '0px' })}
fallback={<HomeStatsFallback />}
>
<HomeStatsSection />
</Hydrate>
</div>
</div>
<div
Expand Down Expand Up @@ -459,10 +454,12 @@ function WhyTanStackSection() {

{/* proof panel — 478:1744 */}
<PrinciplePanel>
<PrincipleProof
proof={principle.proof}
accentClassName={principle.accentClassName}
/>
<Hydrate when={visible({ rootMargin: '200px' })}>
<PrincipleProof
proof={principle.proof}
accentClassName={principle.accentClassName}
/>
</Hydrate>
</PrinciplePanel>
</li>
))}
Expand Down Expand Up @@ -495,7 +492,7 @@ function WhyTanStackSection() {
*/
function PrinciplePanel({ children }: { children: React.ReactNode }) {
return (
<div className="flex h-[233px] w-full shrink-0 items-center justify-center lg:w-[460px]">
<div className="flex h-[233px] w-full shrink-0 items-center justify-center lg:w-[460px] [&>div]:w-full">
{children}
</div>
)
Expand Down Expand Up @@ -706,8 +703,8 @@ function PrincipleProof({
}

/**
* Production-Grade proof: the live npm download odometer already prefetched by
* the route loader, plus weekly volume and stars. Real numbers rather than
* Production-Grade proof: the live npm download odometer shared with
* the hero stats, plus weekly volume and stars. Real numbers rather than
* adjectives — the point of the principle is scale.
*/
function AdoptionProof({ accentClassName }: { accentClassName: string }) {
Expand Down
10 changes: 10 additions & 0 deletions src/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -2751,6 +2751,16 @@ html:not(.dark) .library-landing-graphic [style*='drop-shadow'] {
transition: opacity 120ms linear;
}

.home-palm-sky {
background: linear-gradient(
#8fd7fe,
#b0dbff 25%,
#d3e0ff 50%,
#e7dffb 75%,
#f5d9f2
);
}

@keyframes home-open-source-gradient-shift {
0%,
100% {
Expand Down
Loading
Loading