mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 11:51:14 -05:00
122 lines
4.6 KiB
TypeScript
122 lines
4.6 KiB
TypeScript
import { Card, CardContent } from '@/components/ui/card';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Star, MapPin, Ruler, FerrisWheel } from 'lucide-react';
|
|
import { CompanyWithStats } from '@/types/database';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { getCloudflareImageUrl } from '@/lib/cloudflareImageUtils';
|
|
|
|
interface DesignerCardProps {
|
|
company: CompanyWithStats;
|
|
}
|
|
|
|
export function DesignerCard({ company }: DesignerCardProps) {
|
|
const navigate = useNavigate();
|
|
|
|
const handleClick = () => {
|
|
navigate(`/designers/${company.slug}/`);
|
|
};
|
|
|
|
const getCompanyIcon = () => {
|
|
return <Ruler className="w-8 h-8 text-muted-foreground" />;
|
|
};
|
|
|
|
return (
|
|
<Card
|
|
className="group cursor-pointer transition-all duration-200 hover:shadow-lg hover:scale-[1.02] bg-card border border-border overflow-hidden"
|
|
onClick={handleClick}
|
|
>
|
|
{/* Header Image/Logo Section */}
|
|
<div className="relative aspect-[3/2] bg-gradient-to-br from-background to-muted/50 flex items-center justify-center border-b border-border">
|
|
{/* Background Gradient Overlay */}
|
|
<div className="absolute inset-0 bg-gradient-to-br from-primary/5 via-transparent to-accent/5" />
|
|
|
|
{/* Company Type Badge */}
|
|
<div className="absolute top-3 left-3">
|
|
<Badge variant="secondary" className="text-xs bg-background/80 backdrop-blur-sm border border-border/50">
|
|
Designer
|
|
</Badge>
|
|
</div>
|
|
|
|
{/* Logo or Icon */}
|
|
<div className="relative z-10 flex items-center justify-center">
|
|
{company.logo_url ? (
|
|
<img
|
|
src={company.logo_url}
|
|
alt={`${company.name} logo`}
|
|
className="max-w-16 max-h-16 object-contain filter drop-shadow-sm"
|
|
loading="lazy"
|
|
/>
|
|
) : (
|
|
<div className="w-12 h-12 text-muted-foreground/30">
|
|
<Ruler className="w-full h-full" />
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
<CardContent className="p-3 space-y-2">
|
|
{/* Company Name */}
|
|
<h3 className="font-semibold text-base group-hover:text-primary transition-colors line-clamp-2">
|
|
{company.name}
|
|
</h3>
|
|
|
|
{/* Company Details */}
|
|
<div className="space-y-2 text-sm">
|
|
{/* Founded Year */}
|
|
{company.founded_year && (
|
|
<div className="flex items-center gap-2">
|
|
<span className="text-muted-foreground">Founded:</span>
|
|
<span className="font-medium">{company.founded_year}</span>
|
|
</div>
|
|
)}
|
|
|
|
{/* Location */}
|
|
{company.headquarters_location && (
|
|
<div className="flex items-center gap-2">
|
|
<MapPin className="w-3 h-3 text-muted-foreground flex-shrink-0" />
|
|
<span className="text-muted-foreground line-clamp-1">{company.headquarters_location}</span>
|
|
</div>
|
|
)}
|
|
|
|
{/* Rating */}
|
|
{company.average_rating > 0 && (
|
|
<div className="flex items-center gap-2">
|
|
<Star className="w-3 h-3 text-yellow-500 fill-yellow-500 flex-shrink-0" />
|
|
<span className="font-medium">{company.average_rating.toFixed(1)}</span>
|
|
{company.review_count > 0 && (
|
|
<span className="text-muted-foreground">({company.review_count} reviews)</span>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Stats Display */}
|
|
<div className="flex flex-wrap gap-x-4 gap-y-1 text-sm">
|
|
{company.ride_count && company.ride_count > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<FerrisWheel className="w-3 h-3 text-muted-foreground" />
|
|
<span className="font-medium">{company.ride_count}</span>
|
|
<span className="text-muted-foreground">designs</span>
|
|
</div>
|
|
)}
|
|
|
|
{company.coaster_count && company.coaster_count > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<span className="text-muted-foreground">•</span>
|
|
<span className="font-medium">{company.coaster_count}</span>
|
|
<span className="text-muted-foreground">coasters</span>
|
|
</div>
|
|
)}
|
|
|
|
{company.model_count && company.model_count > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<span className="text-muted-foreground">•</span>
|
|
<span className="font-medium">{company.model_count}</span>
|
|
<span className="text-muted-foreground">concepts</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
} |