Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 0 additions & 22 deletions src/components/home/HomeApplicationStarter.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import * as React from 'react'
import { Hydrate } from '@tanstack/react-start'
import { visible } from '@tanstack/react-start/hydration'

import { ApplicationStarter } from '~/components/ApplicationStarter'
import { HomeApplicationStarterFallback } from './HomeSectionFallbacks'

const headlineStorageKey = 'tanstack-home-starter-headline-index'
const headlines = [
Expand All @@ -15,17 +12,6 @@ const headlines = [
] as const

export function HomeApplicationStarter() {
return (
<Hydrate
when={visible({ rootMargin: '0px' })}
fallback={<HomeApplicationStarterFallback />}
>
<RotatingHomeApplicationStarter />
</Hydrate>
)
}

function RotatingHomeApplicationStarter() {
const [headlineIndex, setHeadlineIndex] = React.useState(0)

React.useEffect(() => {
Expand All @@ -45,14 +31,6 @@ function RotatingHomeApplicationStarter() {
headlineStorageKey,
String((currentIndex + 1) % headlines.length),
)

const section = document.getElementById('start-with-a-prompt')
if (section?.dataset.focusPrompt === 'true') {
const field = section.querySelector<HTMLTextAreaElement>('textarea')
field?.focus()
field?.select()
delete section.dataset.focusPrompt
}
}, [])

return (
Expand Down
23 changes: 6 additions & 17 deletions src/components/home/HomeCommunitySection.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { lazy, Suspense } from 'react'
import { ClientOnly, createLink } from '@tanstack/react-router'
import { Hydrate } from '@tanstack/react-start'
import { visible } from '@tanstack/react-start/hydration'
import { ArrowRightIcon } from '@phosphor-icons/react'
import { Button } from '~/components/ds/ui'
import { allMaintainers } from '~/libraries/maintainers'
Expand All @@ -14,28 +12,19 @@ const MaintainersMap = lazy(() =>
})),
)

// Reserve the map, its help text line, and the gap between them.
const globeFallback = (
<div aria-hidden="true" className="box-content h-(--globe-height) pb-16" />
<div
aria-hidden="true"
className="box-content h-(--globe-height) pb-[calc(1rem+1lh)] text-xs leading-relaxed"
/>
)

export function HomeCommunitySection() {
return (
<div className="@container mx-auto w-full max-w-(--breakpoint-lg) px-4 [--globe-width:calc(100cqw+2rem)] [--globe-height:calc(var(--globe-width)*1.25)] sm:[--globe-width:min(120cqw,calc(100vw-1rem))] sm:[--globe-height:calc(var(--globe-width)*0.875)]">
<Hydrate
when={visible({ rootMargin: '25%' })}
fallback={<div className="pt-16">{globeFallback}</div>}
>
<HomeCommunityContent />
</Hydrate>
</div>
)
}

function HomeCommunityContent() {
return (
<section
aria-labelledby="maintainers"
className="isolate flex flex-col gap-4"
className="@container isolate mx-auto flex w-full max-w-(--breakpoint-lg) flex-col gap-4 px-4 [--globe-width:calc(100cqw+2rem)] [--globe-height:calc(var(--globe-width)*1.25)] sm:[--globe-width:min(120cqw,calc(100vw-1rem))] sm:[--globe-height:calc(var(--globe-width)*0.875)]"
>
<header className="sm:mb-10 lg:-mt-6">
<h2
Expand Down
127 changes: 0 additions & 127 deletions src/components/home/HomeSectionFallbacks.tsx

This file was deleted.

64 changes: 0 additions & 64 deletions src/components/home/HomeSocialProofSection.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { Link } from '@tanstack/react-router'
import { Hydrate } from '@tanstack/react-start'
import { visible } from '@tanstack/react-start/hydration'
import { ArrowRightIcon } from '@phosphor-icons/react'
import { BlogPostCard } from '~/components/ds/ui/BlogPostCard'
import { Button } from '~/components/ds/ui'
Expand All @@ -14,68 +12,6 @@ type HomeSocialProofSectionProps = {
export function HomeSocialProofSection({
recentPosts,
}: HomeSocialProofSectionProps) {
return (
<Hydrate
when={visible({ rootMargin: '25%' })}
fallback={<SocialProofSkeleton />}
>
<HomeSocialProofContent recentPosts={recentPosts} />
</Hydrate>
)
}

function SocialProofSkeleton() {
return (
<div className="space-y-24">
<div className="px-4 lg:max-w-(--breakpoint-lg) md:mx-auto">
<div className="h-10 w-40 rounded bg-gray-200/70 dark:bg-gray-800/70 animate-pulse mb-6" />
<div className="overflow-hidden rounded-2xl corner-squircle border border-gray-200 dark:border-gray-800">
{[2, 3].map((cols, band) => (
<div key={`partner-band-${band}`}>
<div className="h-12 bg-gray-200/70 dark:bg-gray-800/70 animate-pulse" />
<div
className="grid gap-px bg-gray-200/70 dark:bg-gray-800/70"
style={{
gridTemplateColumns: `repeat(${cols}, minmax(0, 1fr))`,
}}
>
{Array.from({ length: cols * 2 }).map((_, index) => (
<div
key={`partner-skeleton-${band}-${index}`}
className="min-h-[130px] bg-white/70 dark:bg-gray-950/60 animate-pulse"
/>
))}
</div>
</div>
))}
</div>
</div>
<div className="px-4 lg:max-w-(--breakpoint-lg) md:mx-auto">
<div className="h-10 w-56 rounded bg-gray-200/70 dark:bg-gray-800/70 animate-pulse mb-6" />
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
{Array.from({ length: 3 }).map((_, index) => (
<div
key={`post-skeleton-${index}`}
className="animate-pulse rounded-xl corner-squircle p-2"
>
<div className="aspect-video rounded-lg corner-squircle bg-gray-100 dark:bg-gray-800" />
<div className="px-0.5 pt-2.5">
<div className="h-5 w-5/6 rounded bg-gray-200 dark:bg-gray-700" />
<div className="mt-3 h-3 w-2/3 rounded bg-gray-200 dark:bg-gray-700" />
<div className="mt-4 space-y-2">
<div className="h-3 rounded bg-gray-100 dark:bg-gray-800" />
<div className="h-3 rounded bg-gray-100 dark:bg-gray-800" />
</div>
</div>
</div>
))}
</div>
</div>
</div>
)
}

function HomeSocialProofContent({ recentPosts }: HomeSocialProofSectionProps) {
return (
<div className="space-y-24">
<PartnersSponsorsContent
Expand Down
28 changes: 7 additions & 21 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ 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 { HomeStatNumber } from '~/components/home/HomeStatNumber'
import { LiveDownloadCount } from '~/components/home/LiveDownloadCount'
Expand Down Expand Up @@ -80,12 +77,8 @@ function Index() {
const section = document.getElementById('start-with-a-prompt')
section?.scrollIntoView({ behavior: 'smooth', block: 'start' })
const field = section?.querySelector<HTMLTextAreaElement>('textarea')
if (field) {
field.focus()
field.select()
} else if (section) {
section.dataset.focusPrompt = 'true'
}
field?.focus({ preventScroll: true })
field?.select()
}

return (
Expand Down Expand Up @@ -152,12 +145,7 @@ function Index() {
</div>
</div>
<div className="flex flex-col px-4 py-6 sm:px-1 md:flex-row md:items-center md:justify-center md:px-2.5">
<Hydrate
when={visible({ rootMargin: '0px' })}
fallback={<HomeStatsFallback />}
>
<HomeStatsSection initialStats={initialStats} />
</Hydrate>
<HomeStatsSection initialStats={initialStats} />
</div>
</div>
<div
Expand Down Expand Up @@ -446,12 +434,10 @@ function WhyTanStackSection() {

{/* proof panel — 478:1744 */}
<PrinciplePanel>
<Hydrate when={visible({ rootMargin: '200px' })}>
<PrincipleProof
proof={principle.proof}
accentClassName={principle.accentClassName}
/>
</Hydrate>
<PrincipleProof
proof={principle.proof}
accentClassName={principle.accentClassName}
/>
</PrinciplePanel>
</li>
))}
Expand Down
Loading