import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { Badge } from '@/components/ui/badge'; import { Button } from '@/components/ui/button'; import { Eye, Calendar, User, ExternalLink, Star, TrendingUp } from 'lucide-react'; import { useNavigate } from 'react-router-dom'; import { formatDate, formatRelativeTime } from '@/lib/utils'; export interface Script { id: string; name: string; description: string; compatible_os: string[]; categories: string[]; git_repository_url?: string; author_name: string; view_count: number; created_at: string; updated_at: string; is_approved: boolean; } interface ScriptCardProps { script: Script; } export function ScriptCard({ script }: ScriptCardProps) { const navigate = useNavigate(); const isPopular = script.view_count > 500; const isTrending = script.view_count > 200; return ( {/* Animated background gradient */}
{/* Popular/Trending indicators */} {isPopular && (
Popular
)} {isTrending && !isPopular && (
Trending
)} navigate(`/script/${script.id}`)} className="pb-3 relative z-10"> {script.name} {script.description} {/* OS Badges with enhanced styling */}
{script.compatible_os.map(os => ( {os} ))}
{/* Categories with gradient backgrounds */}
{script.categories.slice(0, 2).map((category, index) => ( {category} ))} {script.categories.length > 2 && ( +{script.categories.length - 2} )}
{/* Script metadata */}
{script.author_name}
{script.view_count.toLocaleString()}
{formatRelativeTime(script.updated_at)}
{/* Action buttons */}
{script.git_repository_url && ( )}
); }