Implemented the new react version of the frontend
This commit is contained in:
1 parent
236e6e06fb
commit
ffe7e52527
65 files changed
+5228
-177
No files matched your search
@@ -0,0 +1,71 @@
|
||||
import { useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { ChevronRight } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||
import { EntryCard, EntryCardSkeleton } from './EntryCard';
|
||||
import type { TmdbEntry } from '@/types';
|
||||
|
||||
interface TrendingGridProps {
|
||||
title: string;
|
||||
movieEntries: TmdbEntry[];
|
||||
tvEntries: TmdbEntry[];
|
||||
isLoading?: boolean;
|
||||
moreLink: string;
|
||||
}
|
||||
|
||||
export function TrendingGrid({
|
||||
title,
|
||||
movieEntries,
|
||||
tvEntries,
|
||||
isLoading,
|
||||
moreLink,
|
||||
}: TrendingGridProps) {
|
||||
const [activeTab, setActiveTab] = useState<'movie' | 'tv'>('movie');
|
||||
const entries = activeTab === 'movie' ? movieEntries : tvEntries;
|
||||
|
||||
// Limit to 2 rows (14 items for a 7-column grid)
|
||||
const displayEntries = entries.slice(0, 14);
|
||||
|
||||
return (
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-xl font-semibold">{title}</h2>
|
||||
<div className="flex items-center gap-3">
|
||||
<Tabs
|
||||
value={activeTab}
|
||||
onValueChange={(v) => setActiveTab(v as 'movie' | 'tv')}
|
||||
>
|
||||
<TabsList className="h-8">
|
||||
<TabsTrigger value="movie" className="text-xs px-3">
|
||||
Movies
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="tv" className="text-xs px-3">
|
||||
TV Series
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
<Button variant="ghost" size="sm" asChild>
|
||||
<Link to={moreLink}>
|
||||
More <ChevronRight className="ml-1 h-4 w-4" />
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{isLoading ? (
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||
{Array.from({ length: 14 }).map((_, i) => (
|
||||
<EntryCardSkeleton key={i} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 2xl:grid-cols-7">
|
||||
{displayEntries.map((tmdbEntry) => (
|
||||
<EntryCard key={tmdbEntry.id} tmdbEntry={tmdbEntry} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user