feat(home): implement new homepage design with full-bleed hero slider and component refactor
- Replace old HomePage layout with Apple TV+/Hulu-inspired design (HomePage3) - Extract all home UI into reusable components under src/components/home/: HeroSlider, BackdropCard, BackdropScrollCard, PopularBelt, NumberedListItem, MiniPosterCard, UpcomingCard, SectionHeader - Hero slider: true slide-track animation, embedded search bar, autoplay with dot indicators - Trending Now: rotating 2x2 backdrop grid with slide-out/slide-in stagger animation (7s interval) - Popular Right Now: infinite CSS marquee belt, pauses on hover - Top Rated: 16:9 featured backdrop + 4 poster cards, no labels - Coming Soon: compact horizontal scroll, date overlay, relative countdown on hover - Fix sidebar ml offset in AppLayout (md:ml-56 -> md:ml-20) to re-center all pages - Move Collections page filters to top-right, search input to left
This commit is contained in:
1 parent
070aea3c51
commit
8641e55362
13 files changed
+749
-1077
No files matched your search
@@ -0,0 +1,77 @@
|
||||
import { Link } from 'react-router-dom';
|
||||
import type { TmdbEntry } from '@/types';
|
||||
|
||||
function formatRelativeTime(dateStr: string): string {
|
||||
const now = new Date();
|
||||
const release = new Date(dateStr);
|
||||
const diffMs = release.getTime() - now.getTime();
|
||||
if (diffMs <= 0) return 'Out now';
|
||||
const totalMinutes = Math.floor(diffMs / 60000);
|
||||
const totalHours = Math.floor(totalMinutes / 60);
|
||||
const totalDays = Math.floor(totalHours / 24);
|
||||
const months = Math.floor(totalDays / 30);
|
||||
const remDays = totalDays % 30;
|
||||
if (months > 0 && remDays > 0) return `in ${months}m ${remDays}d`;
|
||||
if (months > 0) return `in ${months}m`;
|
||||
if (totalDays > 0) return `in ${totalDays} day${totalDays !== 1 ? 's' : ''}`;
|
||||
if (totalHours > 0) return `in ${totalHours} hour${totalHours !== 1 ? 's' : ''}`;
|
||||
if (totalMinutes > 0) return `in ${totalMinutes} min`;
|
||||
return 'Very soon';
|
||||
}
|
||||
|
||||
interface UpcomingCardProps {
|
||||
entry: TmdbEntry;
|
||||
}
|
||||
|
||||
export function UpcomingCard({ entry }: UpcomingCardProps) {
|
||||
const title = entry.title || entry.name || 'Untitled';
|
||||
const poster = entry.poster_path
|
||||
? `https://image.tmdb.org/t/p/w185${entry.poster_path}`
|
||||
: null;
|
||||
const isTv = entry.media_type === 'tv' || !!entry.name;
|
||||
const linkTo = `/entry/tmdb/${isTv ? 'tv' : 'movie'}/${entry.id}`;
|
||||
const releaseDate = entry.release_date || entry.first_air_date;
|
||||
const relativeTime = releaseDate ? formatRelativeTime(releaseDate) : null;
|
||||
|
||||
return (
|
||||
<Link
|
||||
to={linkTo}
|
||||
className="group relative shrink-0 overflow-hidden rounded-xl border border-border/50 bg-card transition-colors hover:border-border"
|
||||
style={{ width: '110px' }}
|
||||
>
|
||||
<div className="relative overflow-hidden" style={{ aspectRatio: '2/3' }}>
|
||||
{poster ? (
|
||||
<img
|
||||
src={poster}
|
||||
alt={title}
|
||||
className="h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex h-full w-full items-center justify-center bg-muted text-xs text-muted-foreground">
|
||||
No Image
|
||||
</div>
|
||||
)}
|
||||
{/* Date overlay */}
|
||||
{releaseDate && (
|
||||
<div className="absolute bottom-0 left-0 right-0 bg-linear-to-t from-black/80 to-transparent px-2 py-2">
|
||||
<p className="text-[9px] font-semibold leading-tight text-white/90">
|
||||
{new Date(releaseDate).toLocaleDateString('en-US', {
|
||||
month: 'short',
|
||||
day: 'numeric',
|
||||
year: 'numeric',
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{/* Hover overlay — relative countdown */}
|
||||
{relativeTime && (
|
||||
<div className="absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 backdrop-blur-[1px] transition-opacity duration-200 group-hover:opacity-100">
|
||||
<span className="rounded-full bg-white/15 px-2.5 py-1 text-[10px] font-bold text-white backdrop-blur-sm">
|
||||
{relativeTime}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user