mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 14:11:12 -05:00
115 lines
4.7 KiB
TypeScript
115 lines
4.7 KiB
TypeScript
import { MapPin, Star, Users, Clock, Castle, FerrisWheel, Waves, Tent } from 'lucide-react';
|
|
import { useNavigate } from 'react-router-dom';
|
|
import { Card, CardContent } from '@/components/ui/card';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Park } from '@/types/database';
|
|
|
|
interface ParkCardProps {
|
|
park: Park;
|
|
}
|
|
export function ParkCard({ park }: ParkCardProps) {
|
|
const navigate = useNavigate();
|
|
|
|
const handleClick = () => {
|
|
navigate(`/parks/${park.slug}`);
|
|
};
|
|
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;
|
|
case 'amusement_park':
|
|
return;
|
|
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 <Card className="group overflow-hidden border-border/50 bg-gradient-to-br from-card via-card to-card/80 hover:shadow-2xl hover:shadow-primary/20 transition-all duration-300 cursor-pointer hover:scale-[1.02]" onClick={handleClick}>
|
|
<div className="relative overflow-hidden">
|
|
{/* Image Placeholder with Gradient */}
|
|
<div className="aspect-video bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 flex items-center justify-center relative">
|
|
{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-500" /> : <div className="opacity-50 flex items-center justify-center">
|
|
{getParkTypeIcon(park.park_type)}
|
|
</div>}
|
|
|
|
{/* Gradient Overlay */}
|
|
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent" />
|
|
|
|
{/* Status Badge */}
|
|
<Badge className={`absolute top-3 right-3 ${getStatusColor(park.status)} border`}>
|
|
{park.status.replace('_', ' ').toUpperCase()}
|
|
</Badge>
|
|
</div>
|
|
|
|
<CardContent className="p-4 space-y-3">
|
|
{/* Header */}
|
|
<div className="space-y-1">
|
|
<h3 className="font-bold text-lg group-hover:text-primary transition-colors line-clamp-1">
|
|
{park.name}
|
|
</h3>
|
|
|
|
{park.location && <div className="flex items-center text-sm text-muted-foreground">
|
|
<MapPin className="w-3 h-3 mr-1" />
|
|
{park.location.city && `${park.location.city}, `}{park.location.country}
|
|
</div>}
|
|
</div>
|
|
|
|
{/* Description */}
|
|
{park.description && <p className="text-sm text-muted-foreground line-clamp-2">
|
|
{park.description}
|
|
</p>}
|
|
|
|
{/* Park Type */}
|
|
<Badge variant="outline" className="text-xs">
|
|
{formatParkType(park.park_type)}
|
|
</Badge>
|
|
|
|
{/* Stats */}
|
|
<div className="flex items-center justify-between text-sm">
|
|
<div className="flex items-center gap-4">
|
|
{park.ride_count > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<span className="text-primary font-medium">{park.ride_count}</span>
|
|
<span className="text-muted-foreground">rides</span>
|
|
</div>
|
|
)}
|
|
{park.coaster_count > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<span className="text-accent font-medium">{park.coaster_count}</span>
|
|
<FerrisWheel className="w-3 h-3 text-muted-foreground" />
|
|
</div>
|
|
)}
|
|
</div>
|
|
|
|
{park.average_rating > 0 && (
|
|
<div className="flex items-center gap-1">
|
|
<Star className="w-3 h-3 fill-yellow-400 text-yellow-400" />
|
|
<span className="text-sm font-medium">{park.average_rating.toFixed(1)}</span>
|
|
{park.review_count > 0 && (
|
|
<span className="text-xs text-muted-foreground">({park.review_count})</span>
|
|
)}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</CardContent>
|
|
</div>
|
|
</Card>;
|
|
} |