import React, { lazy, Suspense } from 'react'
import { createRoot } from 'react-dom/client'
// Above-fold — eager
import HomeHero from './HomeHero'
// Below-fold — lazy-loaded to keep initial bundle small
const HomeWelcomeRow = lazy(() => import('./HomeWelcomeRow'))
const HomeFromFollowing = lazy(() => import('./HomeFromFollowing'))
const HomeTrendingForYou = lazy(() => import('./HomeTrendingForYou'))
const HomeBecauseYouLike = lazy(() => import('./HomeBecauseYouLike'))
const HomeSuggestedCreators = lazy(() => import('./HomeSuggestedCreators'))
const HomeTrending = lazy(() => import('./HomeTrending'))
const HomeFresh = lazy(() => import('./HomeFresh'))
const HomeCategories = lazy(() => import('./HomeCategories'))
const HomeTags = lazy(() => import('./HomeTags'))
const HomeCreators = lazy(() => import('./HomeCreators'))
const HomeNews = lazy(() => import('./HomeNews'))
const HomeCTA = lazy(() => import('./HomeCTA'))
function SectionFallback() {
return (
)
}
function GuestHomePage(props) {
const { hero, trending, fresh, tags, creators, news } = props
return (
<>
{/* 1. Hero */}
}>
{/* 3. Fresh Uploads */}
}>
{/* 4. Explore Categories */}
}>
{/* 5. Popular Tags */}
}>
{/* 6. Top Creators */}
}>
{/* 7. News */}
}>
{/* 8. CTA Upload */}
}>
>
)
}
function AuthHomePage(props) {
const {
user_data,
hero,
from_following,
trending,
fresh,
by_tags,
by_categories,
suggested_creators,
tags,
creators,
news,
preferences,
} = props
return (
<>
{/* 1. Hero — flush to top */}
{/* P0. Welcome/status row — below hero so featured image sits at 0px */}
{/* P2. From Creators You Follow */}
}>
{/* P3. Trending For You (by_tags = Meilisearch tag overlap sorted by trending) */}
}>
{/* 2. Global Trending Now */}
}>
{/* P4. Because You Like {top tag} — uses by_categories for variety */}
}>
{/* 3. Fresh Uploads */}
}>
{/* 4. Explore Categories */}
}>
{/* P5. Suggested Creators */}
}>
{/* 5. Popular Tags */}
}>
{/* 6. Top Creators */}
}>
{/* 7. News */}
}>
{/* 8. CTA Upload */}
}>
>
)
}
function HomePage(props) {
return (
{props.is_logged_in
?
:
}
)
}
// Auto-mount when the Blade view provides #homepage-root
const mountEl = document.getElementById('homepage-root')
if (mountEl) {
let props = {}
try {
const propsEl = document.getElementById('homepage-props')
props = propsEl ? JSON.parse(propsEl.textContent || '{}') : {}
} catch {
props = {}
}
createRoot(mountEl).render()
}
export default HomePage