Files
thrilltrack-explorer/src-old/components/operators/OperatorListView.tsx

118 lines
5.7 KiB
TypeScript

import { MapPin, Star, Building2, Calendar, Globe } from 'lucide-react';
import { Card, CardContent } from '@/components/ui/card';
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Company } from '@/types/database';
import { cn } from '@/lib/utils';
interface OperatorListViewProps {
operators: (Company & { park_count?: number })[];
onOperatorClick: (operator: Company) => void;
}
export function OperatorListView({ operators, onOperatorClick }: OperatorListViewProps) {
return (
<div className="space-y-3">
{operators.map((operator, index) => (
<Card
key={operator.id}
className={cn(
"group overflow-hidden cursor-pointer",
"border-border/40 bg-gradient-to-br from-card via-card/95 to-card/90",
"hover:border-primary/30 hover:shadow-2xl hover:shadow-primary/5",
"transition-all duration-500 animate-fade-in-up"
)}
style={{ animationDelay: `${index * 50}ms` }}
onClick={() => onOperatorClick(operator)}
>
<CardContent className="p-0">
<div className="flex flex-col sm:flex-row">
{/* Logo */}
<div className="w-full h-32 sm:w-32 sm:h-auto md:w-40 flex-shrink-0 self-stretch relative overflow-hidden bg-gradient-to-br from-muted/50 to-muted/30">
{operator.logo_url ? (
<img
src={operator.logo_url}
alt={operator.name}
className="w-full h-full object-contain p-4 group-hover:scale-110 transition-transform duration-700"
/>
) : (
<div className="w-full h-full flex items-center justify-center">
<Building2 className="w-12 h-12 text-muted-foreground/40" />
</div>
)}
</div>
{/* Content */}
<div className="flex-1 p-4 md:p-6 flex flex-col justify-between min-h-[128px]">
<div className="space-y-3">
{/* Header */}
<div className="flex items-start justify-between gap-4">
<div className="flex-1 min-w-0">
<h3 className="font-bold text-lg md:text-xl group-hover:text-primary transition-colors duration-300 line-clamp-1 mb-1.5">
{operator.name}
</h3>
{operator.headquarters_location && (
<div className="flex items-center text-sm text-muted-foreground group-hover:text-foreground transition-colors duration-300">
<MapPin className="w-3.5 h-3.5 mr-1.5 flex-shrink-0" />
<span className="line-clamp-1">{operator.headquarters_location}</span>
</div>
)}
</div>
{/* Rating */}
{operator.average_rating && operator.average_rating > 0 && (
<div className="flex items-center gap-1.5 ml-4 flex-shrink-0 bg-yellow-400/10 px-3 py-1.5 rounded-full group-hover:bg-yellow-400/20 transition-colors duration-300">
<Star className="w-4 h-4 fill-yellow-400 text-yellow-400" />
<span className="font-semibold text-foreground">{operator.average_rating.toFixed(1)}</span>
{operator.review_count && operator.review_count > 0 && (
<span className="text-xs text-muted-foreground">({operator.review_count})</span>
)}
</div>
)}
</div>
{/* Description */}
{operator.description && (
<p className="text-sm text-muted-foreground group-hover:text-foreground/80 transition-colors duration-300 line-clamp-2">
{operator.description}
</p>
)}
{/* Tags */}
<div className="flex items-center gap-2 flex-wrap">
{operator.founded_year && (
<Badge variant="outline" className="text-xs backdrop-blur-sm border-primary/20 group-hover:border-primary/40 transition-colors duration-300">
<Calendar className="w-3 h-3 mr-1" />
Founded {operator.founded_year}
</Badge>
)}
{operator.park_count !== undefined && operator.park_count > 0 && (
<Badge variant="outline" className="text-xs backdrop-blur-sm border-accent/20 group-hover:border-accent/40 transition-colors duration-300">
<Building2 className="w-3 h-3 mr-1" />
{operator.park_count} {operator.park_count === 1 ? 'park' : 'parks'}
</Badge>
)}
</div>
</div>
{/* Actions */}
<div className="flex items-center justify-end mt-4 pt-3 border-t border-border/50">
<Button
size="sm"
className="bg-gradient-to-r from-primary to-secondary hover:shadow-lg hover:shadow-primary/20 hover:scale-105 transition-all duration-300 flex-shrink-0"
>
<Globe className="w-3.5 h-3.5 mr-1.5" />
<span className="hidden sm:inline">View Details</span>
<span className="sm:hidden">View</span>
</Button>
</div>
</div>
</div>
</CardContent>
</Card>
))}
</div>
);
}