mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 07:11:12 -05:00
176 lines
8.7 KiB
TypeScript
176 lines
8.7 KiB
TypeScript
import { MapPin, Star, Users, Calendar, ExternalLink, Castle, FerrisWheel, Waves, Tent, Sparkles } from 'lucide-react';
|
|
import { Card, CardContent } from '@/components/ui/card';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Button } from '@/components/ui/button';
|
|
import { Park } from '@/types/database';
|
|
import { cn } from '@/lib/utils';
|
|
|
|
interface ParkListViewProps {
|
|
parks: Park[];
|
|
onParkClick: (park: Park) => void;
|
|
}
|
|
|
|
export function ParkListView({ parks, onParkClick }: ParkListViewProps) {
|
|
const getStatusColor = (status: string) => {
|
|
switch (status) {
|
|
case 'operating': return 'bg-green-500/20 text-green-400 border-green-500/30';
|
|
case 'seasonal': return 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30';
|
|
case 'under_construction': return 'bg-blue-500/20 text-blue-400 border-blue-500/30';
|
|
default: return 'bg-red-500/20 text-red-400 border-red-500/30';
|
|
}
|
|
};
|
|
|
|
const getParkTypeIcon = (type: string) => {
|
|
switch (type) {
|
|
case 'theme_park': return <Castle className="w-5 h-5" />;
|
|
case 'amusement_park': return <FerrisWheel className="w-5 h-5" />;
|
|
case 'water_park': return <Waves className="w-5 h-5" />;
|
|
case 'family_entertainment': return <Tent className="w-5 h-5" />;
|
|
default: return <FerrisWheel className="w-5 h-5" />;
|
|
}
|
|
};
|
|
|
|
const formatParkType = (type: string) => {
|
|
return type.split('_').map(word =>
|
|
word.charAt(0).toUpperCase() + word.slice(1)
|
|
).join(' ');
|
|
};
|
|
|
|
return (
|
|
<div className="space-y-3">
|
|
{parks.map((park, index) => (
|
|
<Card
|
|
key={park.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={() => onParkClick(park)}
|
|
>
|
|
<CardContent className="p-0">
|
|
<div className="flex flex-col sm:flex-row">
|
|
{/* Image */}
|
|
<div className="w-full h-40 sm:w-40 sm:h-auto md:w-48 flex-shrink-0 self-stretch relative overflow-hidden">
|
|
{park.card_image_url ? (
|
|
<>
|
|
<img
|
|
src={park.card_image_url}
|
|
alt={park.name}
|
|
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-700"
|
|
/>
|
|
<div className="absolute inset-0 bg-gradient-to-t from-black/40 via-transparent to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-500" />
|
|
</>
|
|
) : (
|
|
<div className="w-full h-full bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 flex items-center justify-center relative overflow-hidden">
|
|
<span className="opacity-50 z-10 relative">
|
|
{getParkTypeIcon(park.park_type)}
|
|
</span>
|
|
<div className="absolute inset-0 bg-gradient-to-tr from-primary/10 to-transparent group-hover:scale-110 transition-transform duration-700" />
|
|
</div>
|
|
)}
|
|
|
|
{/* Status Badge */}
|
|
<Badge
|
|
className={cn(
|
|
"absolute top-2 left-2 text-xs border backdrop-blur-sm",
|
|
getStatusColor(park.status)
|
|
)}
|
|
>
|
|
{park.status.replace('_', ' ').toUpperCase()}
|
|
</Badge>
|
|
</div>
|
|
|
|
{/* Content */}
|
|
<div className="flex-1 p-4 md:p-6 flex flex-col justify-between min-h-[160px]">
|
|
<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">
|
|
{park.name}
|
|
</h3>
|
|
|
|
{park.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">
|
|
{park.location.city && `${park.location.city}, `}
|
|
{park.location.state_province && `${park.location.state_province}, `}
|
|
{park.location.country}
|
|
</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Rating */}
|
|
{(park.average_rating != null && park.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">{park.average_rating.toFixed(1)}</span>
|
|
<span className="text-xs text-muted-foreground">({park.review_count})</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{/* Description */}
|
|
{park.description && (
|
|
<p className="text-sm text-muted-foreground group-hover:text-foreground/80 transition-colors duration-300 line-clamp-2">
|
|
{park.description}
|
|
</p>
|
|
)}
|
|
|
|
{/* Tags */}
|
|
<div className="flex items-center gap-2 flex-wrap">
|
|
<Badge variant="outline" className="text-xs backdrop-blur-sm border-primary/20 group-hover:border-primary/40 transition-colors duration-300">
|
|
{formatParkType(park.park_type)}
|
|
</Badge>
|
|
{park.opening_date && (
|
|
<Badge variant="outline" className="text-xs backdrop-blur-sm border-accent/20 group-hover:border-accent/40 transition-colors duration-300">
|
|
<Calendar className="w-3 h-3 mr-1" />
|
|
Opened {park.opening_date.split('-')[0]}
|
|
</Badge>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
{/* Stats and Actions */}
|
|
<div className="flex items-center justify-between mt-4 pt-3 border-t border-border/50">
|
|
<div className="flex items-center gap-4 md:gap-6 text-sm flex-wrap">
|
|
<div className="flex items-center gap-1.5 group/stat">
|
|
<Sparkles className="w-3.5 h-3.5 text-primary/60 group-hover/stat:text-primary transition-colors duration-300" />
|
|
<span className="text-primary font-semibold">{park.ride_count || 0}</span>
|
|
<span className="text-muted-foreground text-xs">rides</span>
|
|
</div>
|
|
<div className="flex items-center gap-1.5 group/stat">
|
|
<FerrisWheel className="w-3.5 h-3.5 text-accent/60 group-hover/stat:text-accent transition-colors duration-300" />
|
|
<span className="text-accent font-semibold">{park.coaster_count || 0}</span>
|
|
<span className="text-muted-foreground text-xs">coasters</span>
|
|
</div>
|
|
{(park.review_count != null && park.review_count > 0) && (
|
|
<div className="flex items-center gap-1.5 group/stat">
|
|
<Users className="w-3.5 h-3.5 text-muted-foreground group-hover/stat:text-foreground transition-colors duration-300" />
|
|
<span className="text-muted-foreground text-xs">{park.review_count} reviews</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
<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"
|
|
>
|
|
<ExternalLink 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>
|
|
);
|
|
} |