mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 09:31:12 -05:00
701 lines
28 KiB
TypeScript
701 lines
28 KiB
TypeScript
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 { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
|
import {
|
|
MapPin,
|
|
Star,
|
|
Clock,
|
|
Zap,
|
|
ArrowLeft,
|
|
Users,
|
|
Ruler,
|
|
Timer,
|
|
TrendingUp,
|
|
TrendingDown,
|
|
Camera,
|
|
Heart,
|
|
RotateCcw,
|
|
AlertTriangle,
|
|
FerrisWheel,
|
|
Waves,
|
|
Theater,
|
|
Train,
|
|
Edit
|
|
} from 'lucide-react';
|
|
import { ReviewsSection } from '@/components/reviews/ReviewsSection';
|
|
import { MeasurementDisplay } from '@/components/ui/measurement-display';
|
|
import { EntityPhotoGallery } from '@/components/upload/EntityPhotoGallery';
|
|
import { RatingDistribution } from '@/components/rides/RatingDistribution';
|
|
import { RideHighlights } from '@/components/rides/RideHighlights';
|
|
import { SimilarRides } from '@/components/rides/SimilarRides';
|
|
import { FormerNames } from '@/components/rides/FormerNames';
|
|
import { RecentPhotosPreview } from '@/components/rides/RecentPhotosPreview';
|
|
import { ParkLocationMap } from '@/components/maps/ParkLocationMap';
|
|
import { Ride } from '@/types/database';
|
|
import { supabase } from '@/integrations/supabase/client';
|
|
import { RideForm } from '@/components/admin/RideForm';
|
|
import { useAuth } from '@/hooks/useAuth';
|
|
import { useUserRole } from '@/hooks/useUserRole';
|
|
import { toast } from '@/hooks/use-toast';
|
|
|
|
export default function RideDetail() {
|
|
const { parkSlug, rideSlug } = useParams<{ parkSlug: string; rideSlug: string }>();
|
|
const navigate = useNavigate();
|
|
const [ride, setRide] = useState<Ride | null>(null);
|
|
const [loading, setLoading] = useState(true);
|
|
const [activeTab, setActiveTab] = useState("overview");
|
|
const [isEditModalOpen, setIsEditModalOpen] = useState(false);
|
|
const { user } = useAuth();
|
|
const { isModerator } = useUserRole();
|
|
|
|
useEffect(() => {
|
|
if (parkSlug && rideSlug) {
|
|
fetchRideData();
|
|
}
|
|
}, [parkSlug, rideSlug]);
|
|
|
|
const fetchRideData = async () => {
|
|
try {
|
|
// First get park to find park_id
|
|
const { data: parkData } = await supabase
|
|
.from('parks')
|
|
.select('id')
|
|
.eq('slug', parkSlug)
|
|
.maybeSingle();
|
|
|
|
if (parkData) {
|
|
// Then get ride details with park_id stored separately
|
|
const { data: rideData } = await supabase
|
|
.from('rides')
|
|
.select(`
|
|
*,
|
|
park:parks!inner(id, name, slug, location:locations(*)),
|
|
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
|
designer:companies!rides_designer_id_fkey(*)
|
|
`)
|
|
.eq('park_id', parkData.id)
|
|
.eq('slug', rideSlug)
|
|
.maybeSingle();
|
|
|
|
if (rideData) {
|
|
// Store park_id for easier access
|
|
(rideData as any).currentParkId = parkData.id;
|
|
}
|
|
|
|
setRide(rideData);
|
|
}
|
|
} catch (error) {
|
|
console.error('Error fetching ride 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 getRideIcon = (category: string) => {
|
|
switch (category) {
|
|
case 'roller_coaster': return <FerrisWheel className="w-20 h-20" />;
|
|
case 'water_ride': return <Waves className="w-20 h-20" />;
|
|
case 'dark_ride': return <Theater className="w-20 h-20" />;
|
|
case 'flat_ride': return <FerrisWheel className="w-20 h-20" />;
|
|
case 'kiddie_ride': return <FerrisWheel className="w-20 h-20" />;
|
|
case 'transportation': return <Train className="w-20 h-20" />;
|
|
default: return <FerrisWheel className="w-20 h-20" />;
|
|
}
|
|
};
|
|
|
|
const formatCategory = (category: string) => {
|
|
return category.split('_').map(word =>
|
|
word.charAt(0).toUpperCase() + word.slice(1)
|
|
).join(' ');
|
|
};
|
|
|
|
const handleEditSubmit = async (data: any) => {
|
|
if (!user || !ride) return;
|
|
|
|
try {
|
|
// Everyone goes through submission queue
|
|
const { submitRideUpdate } = await import('@/lib/entitySubmissionHelpers');
|
|
await submitRideUpdate(ride.id, data, user.id);
|
|
|
|
toast({
|
|
title: "Edit Submitted",
|
|
description: isModerator
|
|
? "Your edit has been submitted. You can approve it in the moderation queue."
|
|
: "Your ride edit has been submitted for review."
|
|
});
|
|
|
|
setIsEditModalOpen(false);
|
|
} catch (error: any) {
|
|
toast({
|
|
title: "Error",
|
|
description: error.message || "Failed to submit edit.",
|
|
variant: "destructive"
|
|
});
|
|
}
|
|
};
|
|
|
|
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 (!ride || !ride.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">Ride Not Found</h1>
|
|
<p className="text-muted-foreground mb-6">
|
|
The ride you're looking for doesn't exist or has been removed.
|
|
</p>
|
|
<Button onClick={() => navigate('/rides')}>
|
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
|
Back to Rides
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="min-h-screen bg-background">
|
|
<Header />
|
|
|
|
<main className="container mx-auto px-4 py-8">
|
|
{/* Back Button and Edit Button */}
|
|
<div className="flex items-center justify-between mb-6">
|
|
<Button
|
|
variant="ghost"
|
|
onClick={() => navigate(`/parks/${ride.park?.slug}`)}
|
|
>
|
|
<ArrowLeft className="w-4 h-4 mr-2" />
|
|
Back to {ride.park?.name}
|
|
</Button>
|
|
|
|
<Button
|
|
variant="outline"
|
|
onClick={() => {
|
|
if (!user) {
|
|
navigate('/auth');
|
|
} else {
|
|
setIsEditModalOpen(true);
|
|
}
|
|
}}
|
|
>
|
|
<Edit className="w-4 h-4 mr-2" />
|
|
Edit Ride
|
|
</Button>
|
|
</div>
|
|
|
|
{/* 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">
|
|
{(ride.banner_image_url || ride.banner_image_id) ? (
|
|
<img
|
|
src={ride.banner_image_url || `https://imagedelivery.net/X-2-mmiWukWxvAQQ2_o-7Q/${ride.banner_image_id}/public`}
|
|
alt={ride.name}
|
|
className="w-full h-full object-cover"
|
|
/>
|
|
) : (
|
|
<div className="flex items-center justify-center h-full">
|
|
<div className="opacity-50">
|
|
{getRideIcon(ride.category)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
<div className="absolute inset-0 bg-gradient-to-t from-black/60 via-transparent to-transparent" />
|
|
|
|
{/* Ride 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(ride.status)} border`}>
|
|
{ride.status.replace('_', ' ').toUpperCase()}
|
|
</Badge>
|
|
<Badge variant="outline" className="bg-black/20 text-white border-white/20">
|
|
{formatCategory(ride.category)}
|
|
</Badge>
|
|
</div>
|
|
<h1 className="text-4xl md:text-6xl font-bold text-white mb-2">
|
|
{ride.name}
|
|
</h1>
|
|
<div className="flex items-center text-white/90 text-lg">
|
|
<MapPin className="w-5 h-5 mr-2" />
|
|
{ride.park.name}
|
|
</div>
|
|
</div>
|
|
|
|
{ride.average_rating > 0 && (
|
|
<div className="bg-black/30 backdrop-blur-md rounded-lg p-6 text-center min-w-[160px]">
|
|
<div className="flex items-center justify-center gap-2 text-white mb-2">
|
|
<Star className="w-6 h-6 fill-yellow-400 text-yellow-400" />
|
|
<span className="text-3xl font-bold">
|
|
{ride.average_rating.toFixed(1)}
|
|
</span>
|
|
</div>
|
|
<div className="text-white/90 text-sm mb-3">
|
|
{ride.review_count} {ride.review_count === 1 ? "review" : "reviews"}
|
|
</div>
|
|
<Button
|
|
size="sm"
|
|
variant="secondary"
|
|
onClick={() => setActiveTab("reviews")}
|
|
>
|
|
Write Review
|
|
</Button>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Quick Stats */}
|
|
<div className="grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4 mb-8">
|
|
{ride.max_speed_kmh && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<Zap className="w-6 h-6 text-primary mx-auto mb-2" />
|
|
<div className="text-2xl font-bold text-primary">
|
|
<MeasurementDisplay value={ride.max_speed_kmh} type="speed" />
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{ride.max_height_meters && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<TrendingUp className="w-6 h-6 text-accent mx-auto mb-2" />
|
|
<div className="text-2xl font-bold text-accent">
|
|
<MeasurementDisplay value={ride.max_height_meters} type="distance" />
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{ride.length_meters && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<Ruler className="w-6 h-6 text-secondary mx-auto mb-2" />
|
|
<div className="text-2xl font-bold text-secondary">
|
|
<MeasurementDisplay value={ride.length_meters} type="distance" />
|
|
</div>
|
|
<div className="text-sm text-muted-foreground">long</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{ride.duration_seconds && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<Timer className="w-6 h-6 text-primary mx-auto mb-2" />
|
|
<div className="text-2xl font-bold text-primary">{Math.floor(ride.duration_seconds / 60)}:{(ride.duration_seconds % 60).toString().padStart(2, '0')}</div>
|
|
<div className="text-sm text-muted-foreground">duration</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{ride.capacity_per_hour && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<Users className="w-6 h-6 text-accent mx-auto mb-2" />
|
|
<div className="text-2xl font-bold text-accent">{ride.capacity_per_hour}</div>
|
|
<div className="text-sm text-muted-foreground">riders/hour</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{ride.inversions !== null && ride.inversions !== undefined && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<RotateCcw className="w-6 h-6 text-accent mx-auto mb-2" />
|
|
<div className="text-2xl font-bold text-accent">{ride.inversions}</div>
|
|
<div className="text-sm text-muted-foreground">inversions</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{/* New roller coaster specific stats */}
|
|
{ride.drop_height_meters && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<TrendingDown className="w-6 h-6 mx-auto mb-2 text-destructive" />
|
|
<div className="text-2xl font-bold text-destructive">
|
|
<MeasurementDisplay value={ride.drop_height_meters} type="distance" />
|
|
</div>
|
|
<div className="text-sm text-muted-foreground">drop</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{ride.max_g_force && (
|
|
<Card>
|
|
<CardContent className="p-4 text-center">
|
|
<Zap className="w-6 h-6 mx-auto mb-2 text-warning" />
|
|
<div className="text-2xl font-bold text-warning">{ride.max_g_force}g</div>
|
|
<div className="text-sm text-muted-foreground">max G-force</div>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
</div>
|
|
|
|
|
|
{/* Main Content */}
|
|
<Tabs value={activeTab} onValueChange={setActiveTab} className="w-full">
|
|
<TabsList className="grid w-full grid-cols-2 md:grid-cols-4">
|
|
<TabsTrigger value="overview">Overview</TabsTrigger>
|
|
<TabsTrigger value="specs">Specifications</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 */}
|
|
{ride.description && (
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>About {ride.name}</CardTitle>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<p className="text-muted-foreground leading-relaxed">
|
|
{ride.description}
|
|
</p>
|
|
</CardContent>
|
|
</Card>
|
|
)}
|
|
|
|
{ride.name_history && ride.name_history.length > 0 && (
|
|
<FormerNames nameHistory={ride.name_history} currentName={ride.name} />
|
|
)}
|
|
|
|
<SimilarRides
|
|
currentRideId={ride.id}
|
|
parkId={(ride as any).currentParkId}
|
|
parkSlug={parkSlug || ''}
|
|
category={ride.category}
|
|
/>
|
|
|
|
<RecentPhotosPreview
|
|
rideId={ride.id}
|
|
onViewAll={() => setActiveTab("photos")}
|
|
/>
|
|
</div>
|
|
|
|
<div className="space-y-6">
|
|
<RatingDistribution
|
|
rideId={ride.id}
|
|
totalReviews={ride.review_count}
|
|
averageRating={ride.average_rating}
|
|
/>
|
|
{/* Ride Information */}
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Ride Information</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="space-y-4">
|
|
<div>
|
|
<div className="font-medium">Category</div>
|
|
<div className="text-sm text-muted-foreground">
|
|
{formatCategory(ride.category)}
|
|
</div>
|
|
</div>
|
|
|
|
{ride.opening_date && (
|
|
<div className="flex items-center gap-3">
|
|
<Clock className="w-4 h-4 text-muted-foreground" />
|
|
<div>
|
|
<div className="font-medium">Opened</div>
|
|
<div className="text-sm text-muted-foreground">
|
|
{ride.opening_date.split('-')[0]}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{ride.manufacturer && (
|
|
<div className="flex items-center gap-3">
|
|
<Users className="w-4 h-4 text-muted-foreground" />
|
|
<div>
|
|
<div className="font-medium">Manufacturer</div>
|
|
<div className="text-sm text-muted-foreground">
|
|
{ride.manufacturer.name}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{ride.designer && (
|
|
<div className="flex items-center gap-3">
|
|
<Users className="w-4 h-4 text-muted-foreground" />
|
|
<div>
|
|
<div className="font-medium">Designer</div>
|
|
<div className="text-sm text-muted-foreground">
|
|
{ride.designer.name}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Roller Coaster Specific Info */}
|
|
{ride.category === 'roller_coaster' && (ride.coaster_type || ride.seating_type || ride.intensity_level) && (
|
|
<>
|
|
<Separator />
|
|
<div className="space-y-3">
|
|
<div className="font-medium">Coaster Details</div>
|
|
{ride.coaster_type && (
|
|
<div className="flex items-center gap-3">
|
|
<div className="text-lg">🎢</div>
|
|
<div>
|
|
<div className="font-medium">Type</div>
|
|
<div className="text-sm text-muted-foreground">
|
|
{ride.coaster_type.charAt(0).toUpperCase() + ride.coaster_type.slice(1)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
{ride.seating_type && (
|
|
<div className="flex items-center gap-3">
|
|
<div className="text-lg">💺</div>
|
|
<div>
|
|
<div className="font-medium">Seating</div>
|
|
<div className="text-sm text-muted-foreground">
|
|
{ride.seating_type.replace('_', ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
{ride.intensity_level && (
|
|
<div className="flex items-center gap-3">
|
|
<div className="text-lg">🔥</div>
|
|
<div>
|
|
<div className="font-medium">Intensity</div>
|
|
<div className="text-sm text-muted-foreground">
|
|
{ride.intensity_level.charAt(0).toUpperCase() + ride.intensity_level.slice(1)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</>
|
|
)}
|
|
|
|
<Separator />
|
|
|
|
<div className="space-y-2">
|
|
<div className="font-medium">Located at</div>
|
|
<Button
|
|
variant="outline"
|
|
className="w-full justify-start"
|
|
onClick={() => navigate(`/parks/${ride.park?.slug}`)}
|
|
>
|
|
<MapPin className="w-4 h-4 mr-2" />
|
|
{ride.park.name}
|
|
</Button>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</div>
|
|
</TabsContent>
|
|
|
|
<TabsContent value="specs" className="mt-6">
|
|
<div className="grid md:grid-cols-2 gap-6">
|
|
{/* Performance Stats */}
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Performance</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="space-y-4">
|
|
{ride.max_speed_kmh && (
|
|
<div className="flex justify-between">
|
|
<span>Maximum Speed</span>
|
|
<span className="font-medium">
|
|
<MeasurementDisplay value={ride.max_speed_kmh} type="speed" />
|
|
</span>
|
|
</div>
|
|
)}
|
|
{ride.max_height_meters && (
|
|
<div className="flex justify-between">
|
|
<span>Maximum Height</span>
|
|
<span className="font-medium">
|
|
<MeasurementDisplay value={ride.max_height_meters} type="distance" />
|
|
</span>
|
|
</div>
|
|
)}
|
|
{ride.length_meters && (
|
|
<div className="flex justify-between">
|
|
<span>Track Length</span>
|
|
<span className="font-medium">
|
|
<MeasurementDisplay value={ride.length_meters} type="distance" />
|
|
</span>
|
|
</div>
|
|
)}
|
|
{ride.duration_seconds && (
|
|
<div className="flex justify-between">
|
|
<span>Ride Duration</span>
|
|
<span className="font-medium">{Math.floor(ride.duration_seconds / 60)}:{(ride.duration_seconds % 60).toString().padStart(2, '0')}</span>
|
|
</div>
|
|
)}
|
|
{ride.inversions && ride.inversions > 0 && (
|
|
<div className="flex justify-between">
|
|
<span>Inversions</span>
|
|
<span className="font-medium">{ride.inversions}</span>
|
|
</div>
|
|
)}
|
|
{ride.drop_height_meters && (
|
|
<div className="flex justify-between">
|
|
<span>Drop Height</span>
|
|
<span className="font-medium">
|
|
<MeasurementDisplay value={ride.drop_height_meters} type="distance" />
|
|
</span>
|
|
</div>
|
|
)}
|
|
{ride.max_g_force && (
|
|
<div className="flex justify-between">
|
|
<span>Maximum G-Force</span>
|
|
<span className="font-medium">{ride.max_g_force}g</span>
|
|
</div>
|
|
)}
|
|
</CardContent>
|
|
</Card>
|
|
|
|
{/* Operational Info */}
|
|
<Card>
|
|
<CardHeader>
|
|
<CardTitle>Operational Details</CardTitle>
|
|
</CardHeader>
|
|
<CardContent className="space-y-4">
|
|
{ride.capacity_per_hour && (
|
|
<div className="flex justify-between">
|
|
<span>Capacity</span>
|
|
<span className="font-medium">{ride.capacity_per_hour} riders/hour</span>
|
|
</div>
|
|
)}
|
|
{ride.height_requirement && (
|
|
<div className="flex justify-between">
|
|
<span>Height Requirement</span>
|
|
<span className="font-medium">
|
|
<MeasurementDisplay value={ride.height_requirement} type="height" /> minimum
|
|
</span>
|
|
</div>
|
|
)}
|
|
{ride.age_requirement && (
|
|
<div className="flex justify-between">
|
|
<span>Age Requirement</span>
|
|
<span className="font-medium">{ride.age_requirement}+ years</span>
|
|
</div>
|
|
)}
|
|
<div className="flex justify-between">
|
|
<span>Status</span>
|
|
<Badge className={getStatusColor(ride.status)}>
|
|
{ride.status.replace('_', ' ')}
|
|
</Badge>
|
|
</div>
|
|
</CardContent>
|
|
</Card>
|
|
</div>
|
|
</TabsContent>
|
|
|
|
<TabsContent value="reviews" className="mt-6">
|
|
<ReviewsSection
|
|
entityType="ride"
|
|
entityId={ride.id}
|
|
entityName={ride.name}
|
|
averageRating={ride.average_rating}
|
|
reviewCount={ride.review_count}
|
|
/>
|
|
</TabsContent>
|
|
|
|
<TabsContent value="photos" className="mt-6">
|
|
<EntityPhotoGallery
|
|
entityId={ride.id}
|
|
entityType="ride"
|
|
entityName={ride.name}
|
|
parentId={(ride as any).currentParkId}
|
|
/>
|
|
</TabsContent>
|
|
</Tabs>
|
|
|
|
{/* Edit Ride Modal */}
|
|
<Dialog open={isEditModalOpen} onOpenChange={setIsEditModalOpen}>
|
|
<DialogContent className="max-w-5xl max-h-[90vh] overflow-y-auto">
|
|
<DialogHeader>
|
|
<DialogTitle>Edit Ride</DialogTitle>
|
|
<DialogDescription>
|
|
{isModerator
|
|
? "Make changes to this ride. Changes will be applied immediately."
|
|
: "Submit changes to this ride for review. A moderator will review your submission."}
|
|
</DialogDescription>
|
|
</DialogHeader>
|
|
{ride && (
|
|
<RideForm
|
|
initialData={{
|
|
id: ride.id,
|
|
name: ride.name,
|
|
slug: ride.slug,
|
|
description: ride.description,
|
|
category: ride.category,
|
|
ride_sub_type: ride.ride_sub_type,
|
|
status: ride.status,
|
|
opening_date: ride.opening_date,
|
|
closing_date: ride.closing_date,
|
|
height_requirement: ride.height_requirement,
|
|
age_requirement: ride.age_requirement,
|
|
capacity_per_hour: ride.capacity_per_hour,
|
|
duration_seconds: ride.duration_seconds,
|
|
max_speed_kmh: ride.max_speed_kmh,
|
|
max_height_meters: ride.max_height_meters,
|
|
length_meters: ride.length_meters,
|
|
inversions: ride.inversions,
|
|
coaster_type: ride.coaster_type,
|
|
seating_type: ride.seating_type,
|
|
intensity_level: ride.intensity_level,
|
|
drop_height_meters: ride.drop_height_meters,
|
|
max_g_force: ride.max_g_force,
|
|
manufacturer_id: ride.manufacturer?.id,
|
|
ride_model_id: ride.ride_model?.id,
|
|
banner_image_url: ride.banner_image_url,
|
|
card_image_url: ride.card_image_url
|
|
}}
|
|
onSubmit={handleEditSubmit}
|
|
onCancel={() => setIsEditModalOpen(false)}
|
|
isEditing={true}
|
|
/>
|
|
)}
|
|
</DialogContent>
|
|
</Dialog>
|
|
</main>
|
|
</div>
|
|
);
|
|
} |