mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 04:51:13 -05:00
Approve Lovable Tool Use
This commit is contained in:
132
src/components/parks/ParkCard.tsx
Normal file
132
src/components/parks/ParkCard.tsx
Normal file
@@ -0,0 +1,132 @@
|
||||
import { MapPin, Star, Users, Clock } 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';
|
||||
|
||||
interface ParkCardProps {
|
||||
park: Park;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
export function ParkCard({ park, onClick }: ParkCardProps) {
|
||||
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 '🏊';
|
||||
case 'family_entertainment': return '🎪';
|
||||
default: return '🎡';
|
||||
}
|
||||
};
|
||||
|
||||
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={onClick}
|
||||
>
|
||||
<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="text-6xl opacity-50">
|
||||
{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">
|
||||
<div className="flex items-center gap-2">
|
||||
<h3 className="font-bold text-lg group-hover:text-primary transition-colors line-clamp-1">
|
||||
{park.name}
|
||||
</h3>
|
||||
<span className="text-xl">{getParkTypeIcon(park.park_type)}</span>
|
||||
</div>
|
||||
|
||||
{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">
|
||||
<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>
|
||||
<div className="flex items-center gap-1">
|
||||
<span className="text-accent font-medium">{park.coaster_count}</span>
|
||||
<span className="text-muted-foreground">🎢</span>
|
||||
</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>
|
||||
<span className="text-xs text-muted-foreground">({park.review_count})</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Action Button */}
|
||||
<Button
|
||||
className="w-full mt-3 bg-gradient-to-r from-primary/80 to-secondary/80 hover:from-primary hover:to-secondary transition-all duration-300"
|
||||
size="sm"
|
||||
>
|
||||
Explore Park
|
||||
</Button>
|
||||
</CardContent>
|
||||
</div>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user