Implemented the new react version of the frontend

This commit is contained in:
Mohammed Abad committed 2026-03-31 01:56:38 +01:00
1 parent 236e6e06fb
commit ffe7e52527
65 files changed
+5228 -177

No files matched your search

@@ -0,0 +1,71 @@
import { Link } from 'react-router-dom';
import { getCollectionPosterUrl } from '@/lib/media-utils';
import { Skeleton } from '@/components/ui/skeleton';
import type { Collection } from '@/types';
interface CollectionCardProps {
collection: Collection;
}
export function CollectionCard({ collection }: CollectionCardProps) {
return (
<Link
to={`/collections/${collection.id}`}
className="group overflow-hidden rounded-lg transition-all hover:scale-[1.02] hover:shadow-lg"
>
<div className="relative aspect-[2/3] w-full overflow-hidden rounded-lg bg-muted">
<img
src={getCollectionPosterUrl(collection)}
alt={collection.name}
className="h-full w-full object-cover transition-transform group-hover:scale-105"
loading="lazy"
/>
<div className="absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/80 to-transparent p-3">
<p className="text-sm font-medium text-white line-clamp-2">
{collection.name}
</p>
</div>
</div>
</Link>
);
}
export function CollectionCardSkeleton() {
return <Skeleton className="aspect-[2/3] w-full rounded-lg" />;
}
interface CollectionsGridProps {
collections: Collection[];
isLoading?: boolean;
}
export function CollectionsGrid({
collections,
isLoading,
}: CollectionsGridProps) {
if (isLoading) {
return (
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
{Array.from({ length: 12 }).map((_, i) => (
<CollectionCardSkeleton key={i} />
))}
</div>
);
}
if (collections.length === 0) {
return (
<div className="flex h-40 items-center justify-center text-muted-foreground">
No collections found.
</div>
);
}
return (
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6">
{collections.map((collection) => (
<CollectionCard key={collection.id} collection={collection} />
))}
</div>
);
}