import { Link } from "@remix-run/react"; import { ChevronLeft, Store } from "lucide-react"; import { Skeleton } from "./ui/skeleton"; import { ErrorState } from "./UiProvider"; interface SellerTile { id?: string; sellerId?: string; sellerUsername?: string; sellerName?: string; imageUrl?: string; order?: number; } interface SellerTilesGridProps { sellers: SellerTile[]; isLoading: boolean; isError: boolean; refetch: () => void; showViewAllButton?: boolean; } const SellerTilesGrid = ({ sellers, isLoading, isError, refetch, showViewAllButton = true, }: SellerTilesGridProps) => { if (isLoading) { return ; } if (isError) { return (
); } if (sellers.length === 0) { return null; } return (
{/* 2x2 on mobile, single row of 5 on desktop */}
{sellers.slice(0, 5).map((seller, index) => ( {/* Background Image */} {seller.imageUrl ? ( {seller.sellerName ) : (
)} ))}
{/* View All Button */} {showViewAllButton && ( مشاهده همه فروشگاه‌ها )}
); }; const SellerTilesSkeleton = () => { return (
{Array(4) .fill(1) .map((_, index) => ( ))}
); }; export default SellerTilesGrid;