mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 10:11:13 -05:00
Implement remaining homepage features
This commit is contained in:
@@ -4,6 +4,9 @@ import { TooltipProvider } from "@/components/ui/tooltip";
|
|||||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||||
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
import { BrowserRouter, Routes, Route } from "react-router-dom";
|
||||||
import Index from "./pages/Index";
|
import Index from "./pages/Index";
|
||||||
|
import Parks from "./pages/Parks";
|
||||||
|
import ParkDetail from "./pages/ParkDetail";
|
||||||
|
import Rides from "./pages/Rides";
|
||||||
import NotFound from "./pages/NotFound";
|
import NotFound from "./pages/NotFound";
|
||||||
|
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
@@ -16,6 +19,9 @@ const App = () => (
|
|||||||
<BrowserRouter>
|
<BrowserRouter>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<Index />} />
|
<Route path="/" element={<Index />} />
|
||||||
|
<Route path="/parks" element={<Parks />} />
|
||||||
|
<Route path="/parks/:slug" element={<ParkDetail />} />
|
||||||
|
<Route path="/rides" element={<Rides />} />
|
||||||
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
|
{/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */}
|
||||||
<Route path="*" element={<NotFound />} />
|
<Route path="*" element={<NotFound />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
|
|||||||
@@ -4,16 +4,18 @@ import { Button } from '@/components/ui/button';
|
|||||||
import { Input } from '@/components/ui/input';
|
import { Input } from '@/components/ui/input';
|
||||||
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
|
import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
export function Header() {
|
export function Header() {
|
||||||
const [isSearchFocused, setIsSearchFocused] = useState(false);
|
const [isSearchFocused, setIsSearchFocused] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className="sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
<header className="sticky top-0 z-50 w-full border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
|
||||||
<div className="container flex h-16 items-center justify-between px-4">
|
<div className="container flex h-16 items-center justify-between px-4">
|
||||||
{/* Logo and Brand */}
|
{/* Logo and Brand */}
|
||||||
<div className="flex items-center gap-4">
|
<div className="flex items-center gap-4">
|
||||||
<div className="flex items-center gap-2">
|
<Link to="/" className="flex items-center gap-2">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Zap className="h-8 w-8 text-primary" />
|
<Zap className="h-8 w-8 text-primary" />
|
||||||
<div className="absolute inset-0 blur-sm bg-primary/20 rounded-full"></div>
|
<div className="absolute inset-0 blur-sm bg-primary/20 rounded-full"></div>
|
||||||
@@ -24,15 +26,23 @@ export function Header() {
|
|||||||
</h1>
|
</h1>
|
||||||
<span className="text-xs text-muted-foreground -mt-1">Theme Park Database</span>
|
<span className="text-xs text-muted-foreground -mt-1">Theme Park Database</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</Link>
|
||||||
|
|
||||||
{/* Desktop Navigation */}
|
{/* Desktop Navigation */}
|
||||||
<nav className="hidden md:flex items-center gap-6 ml-8">
|
<nav className="hidden md:flex items-center gap-6 ml-8">
|
||||||
<Button variant="ghost" className="text-sm font-medium hover:text-primary">
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="text-sm font-medium hover:text-primary"
|
||||||
|
onClick={() => navigate('/parks')}
|
||||||
|
>
|
||||||
<MapPin className="w-4 h-4 mr-2" />
|
<MapPin className="w-4 h-4 mr-2" />
|
||||||
Parks
|
Parks
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" className="text-sm font-medium hover:text-primary">
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="text-sm font-medium hover:text-primary"
|
||||||
|
onClick={() => navigate('/rides')}
|
||||||
|
>
|
||||||
🎢 Rides
|
🎢 Rides
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" className="text-sm font-medium hover:text-primary">
|
<Button variant="ghost" className="text-sm font-medium hover:text-primary">
|
||||||
@@ -94,11 +104,19 @@ export function Header() {
|
|||||||
</SheetTrigger>
|
</SheetTrigger>
|
||||||
<SheetContent side="right" className="w-[300px] sm:w-[400px]">
|
<SheetContent side="right" className="w-[300px] sm:w-[400px]">
|
||||||
<div className="flex flex-col gap-4 mt-8">
|
<div className="flex flex-col gap-4 mt-8">
|
||||||
<Button variant="ghost" className="justify-start">
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="justify-start"
|
||||||
|
onClick={() => navigate('/parks')}
|
||||||
|
>
|
||||||
<MapPin className="w-4 h-4 mr-2" />
|
<MapPin className="w-4 h-4 mr-2" />
|
||||||
Parks
|
Parks
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" className="justify-start">
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
className="justify-start"
|
||||||
|
onClick={() => navigate('/rides')}
|
||||||
|
>
|
||||||
🎢 Rides
|
🎢 Rides
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="ghost" className="justify-start">
|
<Button variant="ghost" className="justify-start">
|
||||||
|
|||||||
448
src/pages/ParkDetail.tsx
Normal file
448
src/pages/ParkDetail.tsx
Normal file
@@ -0,0 +1,448 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { useParams, useNavigate } from 'react-router-dom';
|
||||||
|
import { Header } from '@/components/layout/Header';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
|
||||||
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
|
||||||
|
import { Separator } from '@/components/ui/separator';
|
||||||
|
import {
|
||||||
|
MapPin,
|
||||||
|
Star,
|
||||||
|
Clock,
|
||||||
|
Phone,
|
||||||
|
Globe,
|
||||||
|
Calendar,
|
||||||
|
ArrowLeft,
|
||||||
|
Users,
|
||||||
|
Zap,
|
||||||
|
Camera
|
||||||
|
} from 'lucide-react';
|
||||||
|
import { Park, Ride } from '@/types/database';
|
||||||
|
import { supabase } from '@/integrations/supabase/client';
|
||||||
|
|
||||||
|
export default function ParkDetail() {
|
||||||
|
const { slug } = useParams<{ slug: string }>();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [park, setPark] = useState<Park | null>(null);
|
||||||
|
const [rides, setRides] = useState<Ride[]>([]);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (slug) {
|
||||||
|
fetchParkData();
|
||||||
|
}
|
||||||
|
}, [slug]);
|
||||||
|
|
||||||
|
const fetchParkData = async () => {
|
||||||
|
try {
|
||||||
|
// Fetch park details
|
||||||
|
const { data: parkData } = await supabase
|
||||||
|
.from('parks')
|
||||||
|
.select(`
|
||||||
|
*,
|
||||||
|
location:locations(*),
|
||||||
|
operator:companies!parks_operator_id_fkey(*),
|
||||||
|
property_owner:companies!parks_property_owner_id_fkey(*)
|
||||||
|
`)
|
||||||
|
.eq('slug', slug)
|
||||||
|
.maybeSingle();
|
||||||
|
|
||||||
|
if (parkData) {
|
||||||
|
setPark(parkData);
|
||||||
|
|
||||||
|
// Fetch park rides
|
||||||
|
const { data: ridesData } = await supabase
|
||||||
|
.from('rides')
|
||||||
|
.select(`*`)
|
||||||
|
.eq('park_id', parkData.id)
|
||||||
|
.order('name');
|
||||||
|
|
||||||
|
setRides(ridesData || []);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching park data:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
const getRideIcon = (category: string) => {
|
||||||
|
switch (category) {
|
||||||
|
case 'roller_coaster': return '🎢';
|
||||||
|
case 'water_ride': return '🌊';
|
||||||
|
case 'dark_ride': return '🎭';
|
||||||
|
case 'flat_ride': return '🎡';
|
||||||
|
case 'kiddie_ride': return '🎠';
|
||||||
|
case 'transportation': return '🚂';
|
||||||
|
default: return '🎢';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
<div className="container mx-auto px-4 py-8">
|
||||||
|
<div className="animate-pulse space-y-6">
|
||||||
|
<div className="h-64 bg-muted rounded-lg"></div>
|
||||||
|
<div className="h-8 bg-muted rounded w-1/2"></div>
|
||||||
|
<div className="h-4 bg-muted rounded w-1/3"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!park) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
<div className="container mx-auto px-4 py-8">
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<h1 className="text-2xl font-bold mb-4">Park Not Found</h1>
|
||||||
|
<p className="text-muted-foreground mb-6">
|
||||||
|
The park you're looking for doesn't exist or has been removed.
|
||||||
|
</p>
|
||||||
|
<Button onClick={() => navigate('/parks')}>
|
||||||
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||||
|
Back to Parks
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
|
||||||
|
<main className="container mx-auto px-4 py-8">
|
||||||
|
{/* Back Button */}
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
onClick={() => navigate('/parks')}
|
||||||
|
className="mb-6"
|
||||||
|
>
|
||||||
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
||||||
|
Back to Parks
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
{/* Hero Section */}
|
||||||
|
<div className="relative mb-8">
|
||||||
|
<div className="aspect-[21/9] bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 rounded-lg overflow-hidden relative">
|
||||||
|
{park.banner_image_url ? (
|
||||||
|
<img
|
||||||
|
src={park.banner_image_url}
|
||||||
|
alt={park.name}
|
||||||
|
className="w-full h-full object-cover"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="flex items-center justify-center h-full">
|
||||||
|
<div className="text-8xl opacity-50">
|
||||||
|
{getParkTypeIcon(park.park_type)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent" />
|
||||||
|
|
||||||
|
{/* Park Title Overlay */}
|
||||||
|
<div className="absolute bottom-0 left-0 right-0 p-8">
|
||||||
|
<div className="flex items-end justify-between">
|
||||||
|
<div>
|
||||||
|
<div className="flex items-center gap-3 mb-2">
|
||||||
|
<Badge className={`${getStatusColor(park.status)} border`}>
|
||||||
|
{park.status.replace('_', ' ').toUpperCase()}
|
||||||
|
</Badge>
|
||||||
|
<Badge variant="outline" className="bg-black/20 text-white border-white/20">
|
||||||
|
{formatParkType(park.park_type)}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
<h1 className="text-4xl md:text-6xl font-bold text-white mb-2">
|
||||||
|
{park.name}
|
||||||
|
</h1>
|
||||||
|
{park.location && (
|
||||||
|
<div className="flex items-center text-white/90 text-lg">
|
||||||
|
<MapPin className="w-5 h-5 mr-2" />
|
||||||
|
{park.location.city && `${park.location.city}, `}{park.location.country}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{park.average_rating > 0 && (
|
||||||
|
<div className="bg-black/20 backdrop-blur-sm rounded-lg p-4 text-center">
|
||||||
|
<div className="flex items-center gap-2 text-white mb-1">
|
||||||
|
<Star className="w-5 h-5 fill-yellow-400 text-yellow-400" />
|
||||||
|
<span className="text-2xl font-bold">{park.average_rating.toFixed(1)}</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-white/70 text-sm">
|
||||||
|
{park.review_count} reviews
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Quick Stats */}
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-8">
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<div className="text-2xl font-bold text-primary">{park.ride_count}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">Total Rides</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<div className="text-2xl font-bold text-accent">{park.coaster_count}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">Roller Coasters</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<div className="text-2xl font-bold text-secondary">{park.review_count}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">Reviews</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<CardContent className="p-4 text-center">
|
||||||
|
<div className="text-2xl font-bold">{getParkTypeIcon(park.park_type)}</div>
|
||||||
|
<div className="text-sm text-muted-foreground">{formatParkType(park.park_type)}</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Main Content */}
|
||||||
|
<Tabs defaultValue="overview" className="w-full">
|
||||||
|
<TabsList className="grid w-full grid-cols-4">
|
||||||
|
<TabsTrigger value="overview">Overview</TabsTrigger>
|
||||||
|
<TabsTrigger value="rides">Rides ({rides.length})</TabsTrigger>
|
||||||
|
<TabsTrigger value="reviews">Reviews</TabsTrigger>
|
||||||
|
<TabsTrigger value="photos">Photos</TabsTrigger>
|
||||||
|
</TabsList>
|
||||||
|
|
||||||
|
<TabsContent value="overview" className="mt-6">
|
||||||
|
<div className="grid lg:grid-cols-3 gap-6">
|
||||||
|
<div className="lg:col-span-2 space-y-6">
|
||||||
|
{/* Description */}
|
||||||
|
{park.description && (
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>About {park.name}</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<p className="text-muted-foreground leading-relaxed">
|
||||||
|
{park.description}
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Top Rides Preview */}
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Featured Rides</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className="grid md:grid-cols-2 gap-4">
|
||||||
|
{rides.slice(0, 4).map((ride) => (
|
||||||
|
<div key={ride.id} className="flex items-center gap-3 p-3 border rounded-lg">
|
||||||
|
<div className="text-2xl">{getRideIcon(ride.category)}</div>
|
||||||
|
<div className="flex-1">
|
||||||
|
<h4 className="font-medium">{ride.name}</h4>
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
{ride.category.replace('_', ' ')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{ride.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">{ride.average_rating.toFixed(1)}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="space-y-6">
|
||||||
|
{/* Park Information */}
|
||||||
|
<Card>
|
||||||
|
<CardHeader>
|
||||||
|
<CardTitle>Park Information</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-4">
|
||||||
|
{park.opening_date && (
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Calendar className="w-4 h-4 text-muted-foreground" />
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Opened</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{new Date(park.opening_date).getFullYear()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{park.operator && (
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Users className="w-4 h-4 text-muted-foreground" />
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Operator</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{park.operator.name}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{park.website_url && (
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Globe className="w-4 h-4 text-muted-foreground" />
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Website</div>
|
||||||
|
<a
|
||||||
|
href={park.website_url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="text-sm text-primary hover:underline"
|
||||||
|
>
|
||||||
|
Visit Website
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{park.phone && (
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<Phone className="w-4 h-4 text-muted-foreground" />
|
||||||
|
<div>
|
||||||
|
<div className="font-medium">Phone</div>
|
||||||
|
<div className="text-sm text-muted-foreground">
|
||||||
|
{park.phone}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<div className="space-y-2">
|
||||||
|
<div className="font-medium">Location</div>
|
||||||
|
{park.location && (
|
||||||
|
<div className="text-sm text-muted-foreground space-y-1">
|
||||||
|
{park.location.city && <div>{park.location.city}</div>}
|
||||||
|
{park.location.state_province && <div>{park.location.state_province}</div>}
|
||||||
|
<div>{park.location.country}</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="rides" className="mt-6">
|
||||||
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
|
{rides.map((ride) => (
|
||||||
|
<Card key={ride.id} className="hover:shadow-lg transition-shadow cursor-pointer">
|
||||||
|
<CardContent className="p-4">
|
||||||
|
<div className="flex items-start gap-3 mb-3">
|
||||||
|
<div className="text-2xl">{getRideIcon(ride.category)}</div>
|
||||||
|
<div className="flex-1">
|
||||||
|
<h3 className="font-medium">{ride.name}</h3>
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
{ride.category.replace('_', ' ')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{ride.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">{ride.average_rating.toFixed(1)}</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{ride.description && (
|
||||||
|
<p className="text-sm text-muted-foreground line-clamp-2 mb-3">
|
||||||
|
{ride.description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="flex items-center justify-between text-xs">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
{ride.max_speed_kmh && (
|
||||||
|
<span className="bg-primary/10 text-primary px-2 py-1 rounded">
|
||||||
|
{ride.max_speed_kmh} km/h
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{ride.max_height_meters && (
|
||||||
|
<span className="bg-accent/10 text-accent px-2 py-1 rounded">
|
||||||
|
{ride.max_height_meters}m
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<Badge variant="outline" className="text-xs">
|
||||||
|
{ride.status}
|
||||||
|
</Badge>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="reviews" className="mt-6">
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<Star className="w-16 h-16 text-muted-foreground mx-auto mb-4" />
|
||||||
|
<h3 className="text-xl font-semibold mb-2">Reviews Coming Soon</h3>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
User reviews and ratings will be available soon
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
|
||||||
|
<TabsContent value="photos" className="mt-6">
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<Camera className="w-16 h-16 text-muted-foreground mx-auto mb-4" />
|
||||||
|
<h3 className="text-xl font-semibold mb-2">Photo Gallery Coming Soon</h3>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
Photo galleries and media uploads will be available soon
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</TabsContent>
|
||||||
|
</Tabs>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
207
src/pages/Parks.tsx
Normal file
207
src/pages/Parks.tsx
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { Header } from '@/components/layout/Header';
|
||||||
|
import { ParkCard } from '@/components/parks/ParkCard';
|
||||||
|
import { Input } from '@/components/ui/input';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { MapPin, Search, Filter, SlidersHorizontal } from 'lucide-react';
|
||||||
|
import { Park } from '@/types/database';
|
||||||
|
import { supabase } from '@/integrations/supabase/client';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
export default function Parks() {
|
||||||
|
const [parks, setParks] = useState<Park[]>([]);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
|
const [sortBy, setSortBy] = useState('name');
|
||||||
|
const [filterType, setFilterType] = useState('all');
|
||||||
|
const [filterStatus, setFilterStatus] = useState('all');
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchParks();
|
||||||
|
}, [sortBy, filterType, filterStatus]);
|
||||||
|
|
||||||
|
const fetchParks = async () => {
|
||||||
|
try {
|
||||||
|
let query = supabase
|
||||||
|
.from('parks')
|
||||||
|
.select(`*, location:locations(*), operator:companies!parks_operator_id_fkey(*)`);
|
||||||
|
|
||||||
|
// Apply filters
|
||||||
|
if (filterType !== 'all') {
|
||||||
|
query = query.eq('park_type', filterType);
|
||||||
|
}
|
||||||
|
if (filterStatus !== 'all') {
|
||||||
|
query = query.eq('status', filterStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply sorting
|
||||||
|
switch (sortBy) {
|
||||||
|
case 'rating':
|
||||||
|
query = query.order('average_rating', { ascending: false });
|
||||||
|
break;
|
||||||
|
case 'rides':
|
||||||
|
query = query.order('ride_count', { ascending: false });
|
||||||
|
break;
|
||||||
|
case 'reviews':
|
||||||
|
query = query.order('review_count', { ascending: false });
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
query = query.order('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data } = await query;
|
||||||
|
setParks(data || []);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching parks:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const filteredParks = parks.filter(park =>
|
||||||
|
park.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
park.location?.city?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
park.location?.country?.toLowerCase().includes(searchQuery.toLowerCase())
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleParkClick = (park: Park) => {
|
||||||
|
navigate(`/parks/${park.slug}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const parkTypes = [
|
||||||
|
{ value: 'all', label: 'All Types' },
|
||||||
|
{ value: 'theme_park', label: 'Theme Parks' },
|
||||||
|
{ value: 'amusement_park', label: 'Amusement Parks' },
|
||||||
|
{ value: 'water_park', label: 'Water Parks' },
|
||||||
|
{ value: 'family_entertainment', label: 'Family Entertainment' }
|
||||||
|
];
|
||||||
|
|
||||||
|
const statusOptions = [
|
||||||
|
{ value: 'all', label: 'All Status' },
|
||||||
|
{ value: 'operating', label: 'Operating' },
|
||||||
|
{ value: 'seasonal', label: 'Seasonal' },
|
||||||
|
{ value: 'under_construction', label: 'Under Construction' },
|
||||||
|
{ value: 'closed', label: 'Closed' }
|
||||||
|
];
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
<div className="container mx-auto px-4 py-8">
|
||||||
|
<div className="animate-pulse space-y-6">
|
||||||
|
<div className="h-12 bg-muted rounded w-1/3"></div>
|
||||||
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||||
|
{[...Array(8)].map((_, i) => (
|
||||||
|
<div key={i} className="h-64 bg-muted rounded-lg"></div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
|
||||||
|
<main className="container mx-auto px-4 py-8">
|
||||||
|
{/* Page Header */}
|
||||||
|
<div className="mb-8">
|
||||||
|
<div className="flex items-center gap-3 mb-4">
|
||||||
|
<MapPin className="w-8 h-8 text-primary" />
|
||||||
|
<h1 className="text-4xl font-bold">Theme Parks</h1>
|
||||||
|
</div>
|
||||||
|
<p className="text-lg text-muted-foreground">
|
||||||
|
Discover amazing theme parks, amusement parks, and attractions worldwide
|
||||||
|
</p>
|
||||||
|
<div className="flex items-center gap-2 mt-2">
|
||||||
|
<Badge variant="secondary">{filteredParks.length} parks found</Badge>
|
||||||
|
<Badge variant="outline">{parks.reduce((sum, park) => sum + park.ride_count, 0)} total rides</Badge>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Search and Filters */}
|
||||||
|
<div className="mb-8 space-y-4">
|
||||||
|
<div className="flex flex-col md:flex-row gap-4">
|
||||||
|
<div className="relative flex-1">
|
||||||
|
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
|
||||||
|
<Input
|
||||||
|
placeholder="Search parks by name, city, or country..."
|
||||||
|
value={searchQuery}
|
||||||
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
className="pl-10"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Select value={sortBy} onValueChange={setSortBy}>
|
||||||
|
<SelectTrigger className="w-[180px]">
|
||||||
|
<SlidersHorizontal className="w-4 h-4 mr-2" />
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="name">Name A-Z</SelectItem>
|
||||||
|
<SelectItem value="rating">Highest Rated</SelectItem>
|
||||||
|
<SelectItem value="rides">Most Rides</SelectItem>
|
||||||
|
<SelectItem value="reviews">Most Reviews</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
|
||||||
|
<Select value={filterType} onValueChange={setFilterType}>
|
||||||
|
<SelectTrigger className="w-[160px]">
|
||||||
|
<Filter className="w-4 h-4 mr-2" />
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{parkTypes.map(type => (
|
||||||
|
<SelectItem key={type.value} value={type.value}>
|
||||||
|
{type.label}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
|
||||||
|
<Select value={filterStatus} onValueChange={setFilterStatus}>
|
||||||
|
<SelectTrigger className="w-[140px]">
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{statusOptions.map(status => (
|
||||||
|
<SelectItem key={status.value} value={status.value}>
|
||||||
|
{status.label}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Parks Grid */}
|
||||||
|
{filteredParks.length > 0 ? (
|
||||||
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6">
|
||||||
|
{filteredParks.map((park) => (
|
||||||
|
<ParkCard
|
||||||
|
key={park.id}
|
||||||
|
park={park}
|
||||||
|
onClick={() => handleParkClick(park)}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<MapPin className="w-16 h-16 text-muted-foreground mx-auto mb-4" />
|
||||||
|
<h3 className="text-xl font-semibold mb-2">No parks found</h3>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
Try adjusting your search criteria or filters
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
334
src/pages/Rides.tsx
Normal file
334
src/pages/Rides.tsx
Normal file
@@ -0,0 +1,334 @@
|
|||||||
|
import { useState, useEffect } from 'react';
|
||||||
|
import { Header } from '@/components/layout/Header';
|
||||||
|
import { Card, CardContent } from '@/components/ui/card';
|
||||||
|
import { Input } from '@/components/ui/input';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Search, Filter, SlidersHorizontal, Zap, Clock, Star } from 'lucide-react';
|
||||||
|
import { Ride } from '@/types/database';
|
||||||
|
import { supabase } from '@/integrations/supabase/client';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
|
export default function Rides() {
|
||||||
|
const [rides, setRides] = useState<Ride[]>([]);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
|
const [sortBy, setSortBy] = useState('name');
|
||||||
|
const [filterCategory, setFilterCategory] = useState('all');
|
||||||
|
const [filterStatus, setFilterStatus] = useState('all');
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
fetchRides();
|
||||||
|
}, [sortBy, filterCategory, filterStatus]);
|
||||||
|
|
||||||
|
const fetchRides = async () => {
|
||||||
|
try {
|
||||||
|
let query = supabase
|
||||||
|
.from('rides')
|
||||||
|
.select(`
|
||||||
|
*,
|
||||||
|
park:parks!inner(name, slug, location:locations(*)),
|
||||||
|
manufacturer:companies!rides_manufacturer_id_fkey(*)
|
||||||
|
`);
|
||||||
|
|
||||||
|
// Apply filters
|
||||||
|
if (filterCategory !== 'all') {
|
||||||
|
query = query.eq('category', filterCategory);
|
||||||
|
}
|
||||||
|
if (filterStatus !== 'all') {
|
||||||
|
query = query.eq('status', filterStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply sorting
|
||||||
|
switch (sortBy) {
|
||||||
|
case 'rating':
|
||||||
|
query = query.order('average_rating', { ascending: false });
|
||||||
|
break;
|
||||||
|
case 'speed':
|
||||||
|
query = query.order('max_speed_kmh', { ascending: false, nullsFirst: false });
|
||||||
|
break;
|
||||||
|
case 'height':
|
||||||
|
query = query.order('max_height_meters', { ascending: false, nullsFirst: false });
|
||||||
|
break;
|
||||||
|
case 'reviews':
|
||||||
|
query = query.order('review_count', { ascending: false });
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
query = query.order('name');
|
||||||
|
}
|
||||||
|
|
||||||
|
const { data } = await query;
|
||||||
|
setRides(data || []);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error fetching rides:', error);
|
||||||
|
} finally {
|
||||||
|
setLoading(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const filteredRides = rides.filter(ride =>
|
||||||
|
ride.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
ride.park?.name?.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||||
|
ride.manufacturer?.name?.toLowerCase().includes(searchQuery.toLowerCase())
|
||||||
|
);
|
||||||
|
|
||||||
|
const getRideIcon = (category: string) => {
|
||||||
|
switch (category) {
|
||||||
|
case 'roller_coaster': return '🎢';
|
||||||
|
case 'water_ride': return '🌊';
|
||||||
|
case 'dark_ride': return '🎭';
|
||||||
|
case 'flat_ride': return '🎡';
|
||||||
|
case 'kiddie_ride': return '🎠';
|
||||||
|
case 'transportation': return '🚂';
|
||||||
|
default: return '🎢';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
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 formatCategory = (category: string) => {
|
||||||
|
return category.split('_').map(word =>
|
||||||
|
word.charAt(0).toUpperCase() + word.slice(1)
|
||||||
|
).join(' ');
|
||||||
|
};
|
||||||
|
|
||||||
|
const categories = [
|
||||||
|
{ value: 'all', label: 'All Categories' },
|
||||||
|
{ value: 'roller_coaster', label: 'Roller Coasters' },
|
||||||
|
{ value: 'flat_ride', label: 'Flat Rides' },
|
||||||
|
{ value: 'water_ride', label: 'Water Rides' },
|
||||||
|
{ value: 'dark_ride', label: 'Dark Rides' },
|
||||||
|
{ value: 'kiddie_ride', label: 'Kiddie Rides' },
|
||||||
|
{ value: 'transportation', label: 'Transportation' }
|
||||||
|
];
|
||||||
|
|
||||||
|
const statusOptions = [
|
||||||
|
{ value: 'all', label: 'All Status' },
|
||||||
|
{ value: 'operating', label: 'Operating' },
|
||||||
|
{ value: 'seasonal', label: 'Seasonal' },
|
||||||
|
{ value: 'under_construction', label: 'Under Construction' },
|
||||||
|
{ value: 'closed', label: 'Closed' }
|
||||||
|
];
|
||||||
|
|
||||||
|
if (loading) {
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
<div className="container mx-auto px-4 py-8">
|
||||||
|
<div className="animate-pulse space-y-6">
|
||||||
|
<div className="h-12 bg-muted rounded w-1/3"></div>
|
||||||
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
|
||||||
|
{[...Array(8)].map((_, i) => (
|
||||||
|
<div key={i} className="h-64 bg-muted rounded-lg"></div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="min-h-screen bg-background">
|
||||||
|
<Header />
|
||||||
|
|
||||||
|
<main className="container mx-auto px-4 py-8">
|
||||||
|
{/* Page Header */}
|
||||||
|
<div className="mb-8">
|
||||||
|
<div className="flex items-center gap-3 mb-4">
|
||||||
|
<div className="text-4xl">🎢</div>
|
||||||
|
<h1 className="text-4xl font-bold">Rides & Attractions</h1>
|
||||||
|
</div>
|
||||||
|
<p className="text-lg text-muted-foreground">
|
||||||
|
Explore amazing rides and attractions from theme parks worldwide
|
||||||
|
</p>
|
||||||
|
<div className="flex items-center gap-2 mt-2">
|
||||||
|
<Badge variant="secondary">{filteredRides.length} rides found</Badge>
|
||||||
|
<Badge variant="outline">{rides.filter(r => r.category === 'roller_coaster').length} roller coasters</Badge>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Search and Filters */}
|
||||||
|
<div className="mb-8 space-y-4">
|
||||||
|
<div className="flex flex-col md:flex-row gap-4">
|
||||||
|
<div className="relative flex-1">
|
||||||
|
<Search className="absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground w-4 h-4" />
|
||||||
|
<Input
|
||||||
|
placeholder="Search rides by name, park, or manufacturer..."
|
||||||
|
value={searchQuery}
|
||||||
|
onChange={(e) => setSearchQuery(e.target.value)}
|
||||||
|
className="pl-10"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<Select value={sortBy} onValueChange={setSortBy}>
|
||||||
|
<SelectTrigger className="w-[180px]">
|
||||||
|
<SlidersHorizontal className="w-4 h-4 mr-2" />
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="name">Name A-Z</SelectItem>
|
||||||
|
<SelectItem value="rating">Highest Rated</SelectItem>
|
||||||
|
<SelectItem value="speed">Fastest</SelectItem>
|
||||||
|
<SelectItem value="height">Tallest</SelectItem>
|
||||||
|
<SelectItem value="reviews">Most Reviews</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
|
||||||
|
<Select value={filterCategory} onValueChange={setFilterCategory}>
|
||||||
|
<SelectTrigger className="w-[160px]">
|
||||||
|
<Filter className="w-4 h-4 mr-2" />
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{categories.map(category => (
|
||||||
|
<SelectItem key={category.value} value={category.value}>
|
||||||
|
{category.label}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
|
||||||
|
<Select value={filterStatus} onValueChange={setFilterStatus}>
|
||||||
|
<SelectTrigger className="w-[140px]">
|
||||||
|
<SelectValue />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
{statusOptions.map(status => (
|
||||||
|
<SelectItem key={status.value} value={status.value}>
|
||||||
|
{status.label}
|
||||||
|
</SelectItem>
|
||||||
|
))}
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Rides Grid */}
|
||||||
|
{filteredRides.length > 0 ? (
|
||||||
|
<div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6">
|
||||||
|
{filteredRides.map((ride) => (
|
||||||
|
<Card
|
||||||
|
key={ride.id}
|
||||||
|
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]"
|
||||||
|
>
|
||||||
|
<div className="relative overflow-hidden">
|
||||||
|
{/* Image/Icon Section */}
|
||||||
|
<div className="aspect-video bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 flex items-center justify-center relative">
|
||||||
|
{ride.image_url ? (
|
||||||
|
<img
|
||||||
|
src={ride.image_url}
|
||||||
|
alt={ride.name}
|
||||||
|
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<div className="text-6xl opacity-50">
|
||||||
|
{getRideIcon(ride.category)}
|
||||||
|
</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(ride.status)} border`}
|
||||||
|
>
|
||||||
|
{ride.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">
|
||||||
|
{ride.name}
|
||||||
|
</h3>
|
||||||
|
<span className="text-xl">{getRideIcon(ride.category)}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{ride.park?.name && (
|
||||||
|
<p className="text-sm text-muted-foreground">
|
||||||
|
at {ride.park.name}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Description */}
|
||||||
|
{ride.description && (
|
||||||
|
<p className="text-sm text-muted-foreground line-clamp-2">
|
||||||
|
{ride.description}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{/* Category Badge */}
|
||||||
|
<Badge variant="outline" className="text-xs">
|
||||||
|
{formatCategory(ride.category)}
|
||||||
|
</Badge>
|
||||||
|
|
||||||
|
{/* Stats */}
|
||||||
|
<div className="flex items-center justify-between text-sm">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
{ride.max_speed_kmh && (
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<Zap className="w-3 h-3 text-primary" />
|
||||||
|
<span className="text-primary font-medium text-xs">{ride.max_speed_kmh}km/h</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.max_height_meters && (
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<span className="text-accent font-medium text-xs">{ride.max_height_meters}m</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{ride.duration_seconds && (
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<Clock className="w-3 h-3 text-secondary" />
|
||||||
|
<span className="text-secondary font-medium text-xs">{Math.floor(ride.duration_seconds / 60)}min</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{ride.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">{ride.average_rating.toFixed(1)}</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"
|
||||||
|
>
|
||||||
|
View Details
|
||||||
|
</Button>
|
||||||
|
</CardContent>
|
||||||
|
</div>
|
||||||
|
</Card>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="text-center py-12">
|
||||||
|
<div className="text-6xl mb-4">🎢</div>
|
||||||
|
<h3 className="text-xl font-semibold mb-2">No rides found</h3>
|
||||||
|
<p className="text-muted-foreground">
|
||||||
|
Try adjusting your search criteria or filters
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user