- HomeController: is_logged_in now lives inside props JSON (not separate view var) - HomepageService: allForUser() adds user_data, fresh, suggested_creators; auth payload includes is_logged_in:true; guest payload merged with is_logged_in:false - getTrending/getFreshUploads/getFollowingFeed: limit 12→10 (2 clean rows of 5) - New getUserData() — unread messages + notifications counts via DB - New getSuggestedCreators() — top followed-count creators not yet followed, cached 5 min React — new components: - HomeWelcomeRow: greeting bar with avatar, unread message/notification badges, upload CTA - HomeFromFollowing: art grid from followed creators with empty-state - HomeTrendingForYou: personalized grid adapts heading/link to user's top tag - HomeBecauseYouLike: secondary personalized section keyed on top tag - HomeSuggestedCreators: 4-col creator cards with avatar, stats, View Profile link - HomeCTA: gradient upload banner; guest sees Create Account second CTA - HomeCategories: 5-tile static category grid with mascot images React — updated: - HomePage: split into GuestHomePage + AuthHomePage; routes on is_logged_in prop - HomeHero: isLoggedIn prop; upload href gates on auth; CTA → /discover/trending - HomeTrending: see-all → /discover/trending; grid 4→5 cols; slice to multiple of 5 - HomeFresh: see-all → /discover/fresh; grid 4→5 cols; slice to multiple of 5 - HomeFromFollowing/TrendingForYou/BecauseYouLike: 5-col grid, slice to multiple of 5 - HomeCategories: mascots per category (wallpapers/photography/skins/other), smaller tiles
80 lines
3.2 KiB
JavaScript
80 lines
3.2 KiB
JavaScript
import React from 'react'
|
|
|
|
const FALLBACK = 'https://files.skinbase.org/default/missing_lg.webp'
|
|
|
|
export default function HomeHero({ artwork, isLoggedIn }) {
|
|
const uploadHref = isLoggedIn ? '/upload' : '/login?redirect=/upload'
|
|
|
|
if (!artwork) {
|
|
return (
|
|
<section className="relative flex min-h-[27vw] max-h-[300px] w-full items-end overflow-hidden bg-nova-900">
|
|
<div className="pointer-events-none absolute inset-0 bg-gradient-to-t from-nova-900 via-nova-900/60 to-transparent" />
|
|
<div className="relative z-10 w-full px-6 pb-7 sm:px-10 lg:px-16">
|
|
<h1 className="text-2xl font-bold tracking-tight text-white sm:text-4xl">
|
|
Skinbase Nova
|
|
</h1>
|
|
<p className="mt-2 max-w-xl text-sm text-soft">
|
|
Discover. Create. Inspire.
|
|
</p>
|
|
<div className="mt-4 flex flex-wrap gap-3">
|
|
<a href="/discover/trending" className="rounded-xl bg-accent px-5 py-2 text-sm font-semibold text-white shadow-lg transition hover:brightness-110">Explore Trending</a>
|
|
<a href={uploadHref} className="rounded-xl bg-nova-700 px-5 py-2 text-sm font-semibold text-white shadow-lg transition hover:bg-nova-600">Upload</a>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
)
|
|
}
|
|
|
|
const src = artwork.thumb_lg || artwork.thumb || FALLBACK
|
|
|
|
return (
|
|
<section className="group relative flex min-h-[27vw] max-h-[300px] w-full items-end overflow-hidden bg-nova-900">
|
|
{/* Background image */}
|
|
<img
|
|
src={src}
|
|
alt={artwork.title}
|
|
className="absolute inset-0 h-full w-full object-cover transition-transform duration-700 group-hover:scale-[1.02]"
|
|
fetchpriority="high"
|
|
decoding="async"
|
|
onError={(e) => { e.currentTarget.src = FALLBACK }}
|
|
/>
|
|
|
|
{/* Gradient overlay */}
|
|
<div className="pointer-events-none absolute inset-0 bg-gradient-to-t from-nova-900 via-nova-900/55 to-transparent" />
|
|
|
|
{/* Content */}
|
|
<div className="relative z-10 w-full px-6 pb-7 sm:px-10 lg:px-16">
|
|
<p className="mb-1.5 text-xs font-semibold uppercase tracking-widest text-accent">
|
|
Featured Artwork
|
|
</p>
|
|
<h1 className="text-2xl font-bold tracking-tight text-white drop-shadow sm:text-4xl lg:text-5xl">
|
|
{artwork.title}
|
|
</h1>
|
|
<p className="mt-1.5 text-sm text-soft">
|
|
by <a href={artwork.url} className="text-nova-200 hover:text-white transition">{artwork.author}</a>
|
|
</p>
|
|
<div className="mt-4 flex flex-wrap gap-3">
|
|
<a
|
|
href="/discover/trending"
|
|
className="rounded-xl bg-accent px-5 py-2 text-sm font-semibold text-white shadow-lg transition hover:brightness-110"
|
|
>
|
|
Explore Trending
|
|
</a>
|
|
<a
|
|
href={uploadHref}
|
|
className="rounded-xl bg-nova-700 px-5 py-2 text-sm font-semibold text-white shadow-lg transition hover:bg-nova-600"
|
|
>
|
|
Upload
|
|
</a>
|
|
<a
|
|
href={artwork.url}
|
|
className="rounded-xl border border-nova-600 px-5 py-2 text-sm font-semibold text-nova-200 shadow transition hover:border-nova-400 hover:text-white"
|
|
>
|
|
View Artwork
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
)
|
|
}
|