mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 16:11:13 -05:00
716 lines
32 KiB
TypeScript
716 lines
32 KiB
TypeScript
import { Train, Gauge, Ruler, Zap, Calendar, Building, User, ExternalLink, AlertCircle, TrendingUp, Droplets, Sparkles, RotateCw, Baby, Navigation } from 'lucide-react';
|
|
import { Badge } from '@/components/ui/badge';
|
|
import { Separator } from '@/components/ui/separator';
|
|
import { FlexibleDateDisplay } from '@/components/ui/flexible-date-display';
|
|
import type { DatePrecision } from '@/components/ui/flexible-date-input';
|
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
|
|
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
import type { RideSubmissionData } from '@/types/submission-data';
|
|
import { useEffect, useState } from 'react';
|
|
import { supabase } from '@/lib/supabaseClient';
|
|
|
|
interface RichRideDisplayProps {
|
|
data: RideSubmissionData;
|
|
actionType: 'create' | 'edit' | 'delete';
|
|
showAllFields?: boolean;
|
|
}
|
|
|
|
export function RichRideDisplay({ data, actionType, showAllFields = true }: RichRideDisplayProps) {
|
|
const [park, setPark] = useState<string | null>(null);
|
|
const [manufacturer, setManufacturer] = useState<string | null>(null);
|
|
const [designer, setDesigner] = useState<string | null>(null);
|
|
const [model, setModel] = useState<string | null>(null);
|
|
const [showCategorySpecific, setShowCategorySpecific] = useState(false);
|
|
const [showTechnical, setShowTechnical] = useState(false);
|
|
|
|
useEffect(() => {
|
|
// Guard against null/undefined data
|
|
if (!data) return;
|
|
|
|
const fetchRelatedData = async () => {
|
|
if (data.park_id) {
|
|
const { data: parkData } = await supabase
|
|
.from('parks')
|
|
.select('name')
|
|
.eq('id', data.park_id)
|
|
.single();
|
|
setPark(parkData?.name || null);
|
|
}
|
|
|
|
if (data.manufacturer_id) {
|
|
const { data: mfgData } = await supabase
|
|
.from('companies')
|
|
.select('name')
|
|
.eq('id', data.manufacturer_id)
|
|
.single();
|
|
setManufacturer(mfgData?.name || null);
|
|
}
|
|
|
|
if (data.designer_id) {
|
|
const { data: designerData } = await supabase
|
|
.from('companies')
|
|
.select('name')
|
|
.eq('id', data.designer_id)
|
|
.single();
|
|
setDesigner(designerData?.name || null);
|
|
}
|
|
|
|
if (data.ride_model_id) {
|
|
const { data: modelData } = await supabase
|
|
.from('ride_models')
|
|
.select('name')
|
|
.eq('id', data.ride_model_id)
|
|
.single();
|
|
setModel(modelData?.name || null);
|
|
}
|
|
};
|
|
|
|
fetchRelatedData();
|
|
}, [data.park_id, data.manufacturer_id, data.designer_id, data.ride_model_id]);
|
|
|
|
const getStatusColor = (status: string | undefined) => {
|
|
if (!status) return 'bg-gray-500';
|
|
switch (status.toLowerCase()) {
|
|
case 'operating': return 'bg-green-500';
|
|
case 'closed': return 'bg-red-500';
|
|
case 'under_construction': return 'bg-blue-500';
|
|
case 'sbno': return 'bg-orange-500';
|
|
default: return 'bg-gray-500';
|
|
}
|
|
};
|
|
|
|
// Determine which category-specific section to show
|
|
const category = data.category?.toLowerCase();
|
|
const hasWaterFields = category === 'water_ride' && (data.water_depth_cm || data.splash_height_meters || data.wetness_level || data.flume_type || data.boat_capacity);
|
|
const hasDarkRideFields = category === 'dark_ride' && (data.theme_name || data.story_description || data.show_duration_seconds || data.animatronics_count || data.projection_type || data.ride_system || data.scenes_count);
|
|
const hasFlatRideFields = category === 'flat_ride' && (data.rotation_type || data.motion_pattern || data.platform_count || data.swing_angle_degrees || data.rotation_speed_rpm || data.arm_length_meters || data.max_height_reached_meters);
|
|
const hasKiddieFields = category === 'kiddie_ride' && (data.min_age || data.max_age || data.educational_theme || data.character_theme);
|
|
const hasTransportFields = category === 'transport_ride' && (data.transport_type || data.route_length_meters || data.stations_count || data.vehicle_capacity || data.vehicles_count || data.round_trip_duration_seconds);
|
|
|
|
const hasTechnicalFields = data.track_material || data.support_material || data.propulsion_method || data.coaster_type || data.seating_type || data.intensity_level;
|
|
|
|
return (
|
|
<div className="space-y-4">
|
|
{/* Header Section */}
|
|
<div className="flex items-start gap-3">
|
|
<div className="p-2 rounded-lg bg-primary/10 text-primary">
|
|
<Train className="h-5 w-5" />
|
|
</div>
|
|
<div className="flex-1 min-w-0">
|
|
<h3 className="text-xl font-bold text-foreground truncate">{data.name}</h3>
|
|
{park && (
|
|
<div className="text-sm text-muted-foreground mt-0.5">at {park}</div>
|
|
)}
|
|
<div className="flex items-center gap-2 mt-1 flex-wrap">
|
|
<Badge variant="secondary" className="text-xs">
|
|
{data.category?.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
|
</Badge>
|
|
{data.ride_sub_type && (
|
|
<Badge variant="outline" className="text-xs">
|
|
{data.ride_sub_type.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
|
</Badge>
|
|
)}
|
|
<Badge className={`${getStatusColor(data.status)} text-white text-xs`}>
|
|
{data.status?.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
|
</Badge>
|
|
{actionType === 'create' && (
|
|
<Badge className="bg-green-600 text-white text-xs">New Ride</Badge>
|
|
)}
|
|
{actionType === 'edit' && (
|
|
<Badge className="bg-amber-600 text-white text-xs">Edit</Badge>
|
|
)}
|
|
{actionType === 'delete' && (
|
|
<Badge variant="destructive" className="text-xs">Delete</Badge>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Primary Statistics Grid */}
|
|
{(data.max_height_meters || data.max_speed_kmh || data.length_meters || data.drop_height_meters || data.duration_seconds || data.inversions !== null) && (
|
|
<div className="grid grid-cols-2 md:grid-cols-3 gap-3">
|
|
{data.max_height_meters && (
|
|
<div className="bg-muted/50 rounded-lg p-3">
|
|
<div className="flex items-center gap-2 mb-1">
|
|
<TrendingUp className="h-4 w-4 text-blue-500" />
|
|
<span className="text-xs text-muted-foreground">Height</span>
|
|
</div>
|
|
<div className="text-lg font-bold">{data.max_height_meters.toFixed(1)} m</div>
|
|
</div>
|
|
)}
|
|
|
|
{data.max_speed_kmh && (
|
|
<div className="bg-muted/50 rounded-lg p-3">
|
|
<div className="flex items-center gap-2 mb-1">
|
|
<Zap className="h-4 w-4 text-yellow-500" />
|
|
<span className="text-xs text-muted-foreground">Speed</span>
|
|
</div>
|
|
<div className="text-lg font-bold">{data.max_speed_kmh.toFixed(1)} km/h</div>
|
|
</div>
|
|
)}
|
|
|
|
{data.length_meters && (
|
|
<div className="bg-muted/50 rounded-lg p-3">
|
|
<div className="flex items-center gap-2 mb-1">
|
|
<Ruler className="h-4 w-4 text-green-500" />
|
|
<span className="text-xs text-muted-foreground">Length</span>
|
|
</div>
|
|
<div className="text-lg font-bold">{data.length_meters.toFixed(1)} m</div>
|
|
</div>
|
|
)}
|
|
|
|
{data.drop_height_meters && (
|
|
<div className="bg-muted/50 rounded-lg p-3">
|
|
<div className="flex items-center gap-2 mb-1">
|
|
<TrendingUp className="h-4 w-4 text-purple-500" />
|
|
<span className="text-xs text-muted-foreground">Drop</span>
|
|
</div>
|
|
<div className="text-lg font-bold">{data.drop_height_meters.toFixed(1)} m</div>
|
|
</div>
|
|
)}
|
|
|
|
{data.duration_seconds && (
|
|
<div className="bg-muted/50 rounded-lg p-3">
|
|
<div className="flex items-center gap-2 mb-1">
|
|
<Gauge className="h-4 w-4 text-orange-500" />
|
|
<span className="text-xs text-muted-foreground">Duration</span>
|
|
</div>
|
|
<div className="text-lg font-bold">{Math.floor(data.duration_seconds / 60)}:{(data.duration_seconds % 60).toString().padStart(2, '0')}</div>
|
|
</div>
|
|
)}
|
|
|
|
{data.inversions !== null && data.inversions !== undefined && (
|
|
<div className="bg-muted/50 rounded-lg p-3">
|
|
<div className="flex items-center gap-2 mb-1">
|
|
<Train className="h-4 w-4 text-red-500" />
|
|
<span className="text-xs text-muted-foreground">Inversions</span>
|
|
</div>
|
|
<div className="text-lg font-bold">{data.inversions}</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
)}
|
|
|
|
{/* Requirements & Capacity */}
|
|
{(data.height_requirement || data.age_requirement || data.capacity_per_hour || data.max_g_force) && (
|
|
<div className="bg-muted/50 rounded-lg p-4">
|
|
<div className="text-sm font-semibold mb-3">Requirements & Capacity</div>
|
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-3 text-sm">
|
|
{data.height_requirement && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Height Requirement</span>
|
|
<span className="font-medium">{data.height_requirement} cm</span>
|
|
</div>
|
|
)}
|
|
{data.age_requirement && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Min Age</span>
|
|
<span className="font-medium">{data.age_requirement}+</span>
|
|
</div>
|
|
)}
|
|
{data.capacity_per_hour && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Capacity/Hour</span>
|
|
<span className="font-medium">{data.capacity_per_hour}</span>
|
|
</div>
|
|
)}
|
|
{data.max_g_force && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Max G-Force</span>
|
|
<span className="font-medium">{data.max_g_force}g</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Technical Details (Collapsible) */}
|
|
{hasTechnicalFields && (
|
|
<Collapsible open={showTechnical} onOpenChange={setShowTechnical}>
|
|
<CollapsibleTrigger className="flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors w-full">
|
|
{showTechnical ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
|
<Building className="h-4 w-4" />
|
|
<span>Technical Specifications</span>
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="mt-3">
|
|
<div className="bg-muted/50 rounded-lg p-4 space-y-3">
|
|
{data.track_material && data.track_material.length > 0 && (
|
|
<div>
|
|
<span className="text-sm text-muted-foreground block mb-1.5">Track Material</span>
|
|
<div className="flex flex-wrap gap-1.5">
|
|
{data.track_material.map((material, i) => (
|
|
<Badge key={i} variant="outline" className="text-xs">
|
|
{material.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
|
</Badge>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{data.support_material && data.support_material.length > 0 && (
|
|
<div>
|
|
<span className="text-sm text-muted-foreground block mb-1.5">Support Material</span>
|
|
<div className="flex flex-wrap gap-1.5">
|
|
{data.support_material.map((material, i) => (
|
|
<Badge key={i} variant="outline" className="text-xs">
|
|
{material.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
|
</Badge>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{data.propulsion_method && data.propulsion_method.length > 0 && (
|
|
<div>
|
|
<span className="text-sm text-muted-foreground block mb-1.5">Propulsion Method</span>
|
|
<div className="flex flex-wrap gap-1.5">
|
|
{data.propulsion_method.map((method, i) => (
|
|
<Badge key={i} variant="outline" className="text-xs">
|
|
{method.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
|
</Badge>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
<div className="grid grid-cols-2 gap-3 text-sm pt-2">
|
|
{data.coaster_type && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Coaster Type</span>
|
|
<span className="font-medium">{data.coaster_type.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
{data.seating_type && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Seating Type</span>
|
|
<span className="font-medium">{data.seating_type.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
{data.intensity_level && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Intensity Level</span>
|
|
<Badge variant="secondary">{data.intensity_level.replace(/_/g, ' ').toUpperCase()}</Badge>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</CollapsibleContent>
|
|
</Collapsible>
|
|
)}
|
|
|
|
{/* Water Ride Fields */}
|
|
{hasWaterFields && (
|
|
<Collapsible open={showCategorySpecific} onOpenChange={setShowCategorySpecific}>
|
|
<CollapsibleTrigger className="flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors w-full">
|
|
{showCategorySpecific ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
|
<Droplets className="h-4 w-4 text-blue-500" />
|
|
<span>Water Ride Specifications</span>
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="mt-3">
|
|
<div className="bg-blue-50 dark:bg-blue-950/30 rounded-lg p-4 border border-blue-200 dark:border-blue-800">
|
|
<div className="grid grid-cols-2 gap-3 text-sm">
|
|
{data.water_depth_cm && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Water Depth</span>
|
|
<span className="font-medium">{data.water_depth_cm} cm</span>
|
|
</div>
|
|
)}
|
|
{data.splash_height_meters && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Splash Height</span>
|
|
<span className="font-medium">{data.splash_height_meters.toFixed(1)} m</span>
|
|
</div>
|
|
)}
|
|
{data.wetness_level && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Wetness Level</span>
|
|
<Badge variant="secondary">{data.wetness_level.toUpperCase()}</Badge>
|
|
</div>
|
|
)}
|
|
{data.flume_type && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Flume Type</span>
|
|
<span className="font-medium">{data.flume_type.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
{data.boat_capacity && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Boat Capacity</span>
|
|
<span className="font-medium">{data.boat_capacity} riders</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</CollapsibleContent>
|
|
</Collapsible>
|
|
)}
|
|
|
|
{/* Dark Ride Fields */}
|
|
{hasDarkRideFields && (
|
|
<Collapsible open={showCategorySpecific} onOpenChange={setShowCategorySpecific}>
|
|
<CollapsibleTrigger className="flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors w-full">
|
|
{showCategorySpecific ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
|
<Sparkles className="h-4 w-4 text-purple-500" />
|
|
<span>Dark Ride Details</span>
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="mt-3">
|
|
<div className="bg-purple-50 dark:bg-purple-950/30 rounded-lg p-4 border border-purple-200 dark:border-purple-800 space-y-3">
|
|
{data.theme_name && (
|
|
<div>
|
|
<span className="text-sm text-muted-foreground block mb-1">Theme Name</span>
|
|
<span className="font-medium">{data.theme_name}</span>
|
|
</div>
|
|
)}
|
|
{data.story_description && (
|
|
<div>
|
|
<span className="text-sm text-muted-foreground block mb-1">Story Description</span>
|
|
<p className="text-sm text-foreground">{data.story_description}</p>
|
|
</div>
|
|
)}
|
|
<div className="grid grid-cols-2 md:grid-cols-3 gap-3 text-sm pt-2">
|
|
{data.show_duration_seconds && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Show Duration</span>
|
|
<span className="font-medium">{Math.floor(data.show_duration_seconds / 60)}:{(data.show_duration_seconds % 60).toString().padStart(2, '0')}</span>
|
|
</div>
|
|
)}
|
|
{data.animatronics_count && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Animatronics</span>
|
|
<span className="font-medium">{data.animatronics_count}</span>
|
|
</div>
|
|
)}
|
|
{data.scenes_count && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Scenes</span>
|
|
<span className="font-medium">{data.scenes_count}</span>
|
|
</div>
|
|
)}
|
|
{data.projection_type && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Projection Type</span>
|
|
<span className="font-medium">{data.projection_type.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
{data.ride_system && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Ride System</span>
|
|
<span className="font-medium">{data.ride_system.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</CollapsibleContent>
|
|
</Collapsible>
|
|
)}
|
|
|
|
{/* Flat Ride Fields */}
|
|
{hasFlatRideFields && (
|
|
<Collapsible open={showCategorySpecific} onOpenChange={setShowCategorySpecific}>
|
|
<CollapsibleTrigger className="flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors w-full">
|
|
{showCategorySpecific ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
|
<RotateCw className="h-4 w-4 text-orange-500" />
|
|
<span>Flat Ride Specifications</span>
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="mt-3">
|
|
<div className="bg-orange-50 dark:bg-orange-950/30 rounded-lg p-4 border border-orange-200 dark:border-orange-800">
|
|
<div className="grid grid-cols-2 md:grid-cols-3 gap-3 text-sm">
|
|
{data.rotation_type && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Rotation Type</span>
|
|
<span className="font-medium">{data.rotation_type.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
{data.motion_pattern && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Motion Pattern</span>
|
|
<span className="font-medium">{data.motion_pattern.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
{data.platform_count && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Platforms</span>
|
|
<span className="font-medium">{data.platform_count}</span>
|
|
</div>
|
|
)}
|
|
{data.swing_angle_degrees && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Swing Angle</span>
|
|
<span className="font-medium">{data.swing_angle_degrees}°</span>
|
|
</div>
|
|
)}
|
|
{data.rotation_speed_rpm && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Rotation Speed</span>
|
|
<span className="font-medium">{data.rotation_speed_rpm} RPM</span>
|
|
</div>
|
|
)}
|
|
{data.arm_length_meters && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Arm Length</span>
|
|
<span className="font-medium">{data.arm_length_meters.toFixed(1)} m</span>
|
|
</div>
|
|
)}
|
|
{data.max_height_reached_meters && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Max Height Reached</span>
|
|
<span className="font-medium">{data.max_height_reached_meters.toFixed(1)} m</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</CollapsibleContent>
|
|
</Collapsible>
|
|
)}
|
|
|
|
{/* Kiddie Ride Fields */}
|
|
{hasKiddieFields && (
|
|
<Collapsible open={showCategorySpecific} onOpenChange={setShowCategorySpecific}>
|
|
<CollapsibleTrigger className="flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors w-full">
|
|
{showCategorySpecific ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
|
<Baby className="h-4 w-4 text-pink-500" />
|
|
<span>Kiddie Ride Details</span>
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="mt-3">
|
|
<div className="bg-pink-50 dark:bg-pink-950/30 rounded-lg p-4 border border-pink-200 dark:border-pink-800">
|
|
<div className="grid grid-cols-2 gap-3 text-sm">
|
|
{data.min_age && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Min Age</span>
|
|
<span className="font-medium">{data.min_age}</span>
|
|
</div>
|
|
)}
|
|
{data.max_age && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Max Age</span>
|
|
<span className="font-medium">{data.max_age}</span>
|
|
</div>
|
|
)}
|
|
{data.educational_theme && (
|
|
<div className="col-span-2">
|
|
<span className="text-muted-foreground block text-xs mb-1">Educational Theme</span>
|
|
<span className="font-medium">{data.educational_theme}</span>
|
|
</div>
|
|
)}
|
|
{data.character_theme && (
|
|
<div className="col-span-2">
|
|
<span className="text-muted-foreground block text-xs mb-1">Character Theme</span>
|
|
<span className="font-medium">{data.character_theme}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</CollapsibleContent>
|
|
</Collapsible>
|
|
)}
|
|
|
|
{/* Transport Ride Fields */}
|
|
{hasTransportFields && (
|
|
<Collapsible open={showCategorySpecific} onOpenChange={setShowCategorySpecific}>
|
|
<CollapsibleTrigger className="flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors w-full">
|
|
{showCategorySpecific ? <ChevronDown className="h-4 w-4" /> : <ChevronRight className="h-4 w-4" />}
|
|
<Navigation className="h-4 w-4 text-teal-500" />
|
|
<span>Transport Ride Specifications</span>
|
|
</CollapsibleTrigger>
|
|
|
|
<CollapsibleContent className="mt-3">
|
|
<div className="bg-teal-50 dark:bg-teal-950/30 rounded-lg p-4 border border-teal-200 dark:border-teal-800">
|
|
<div className="grid grid-cols-2 md:grid-cols-3 gap-3 text-sm">
|
|
{data.transport_type && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Transport Type</span>
|
|
<span className="font-medium">{data.transport_type.replace(/_/g, ' ')}</span>
|
|
</div>
|
|
)}
|
|
{data.route_length_meters && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Route Length</span>
|
|
<span className="font-medium">{data.route_length_meters.toFixed(0)} m</span>
|
|
</div>
|
|
)}
|
|
{data.stations_count && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Stations</span>
|
|
<span className="font-medium">{data.stations_count}</span>
|
|
</div>
|
|
)}
|
|
{data.vehicle_capacity && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Vehicle Capacity</span>
|
|
<span className="font-medium">{data.vehicle_capacity}</span>
|
|
</div>
|
|
)}
|
|
{data.vehicles_count && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Total Vehicles</span>
|
|
<span className="font-medium">{data.vehicles_count}</span>
|
|
</div>
|
|
)}
|
|
{data.round_trip_duration_seconds && (
|
|
<div>
|
|
<span className="text-muted-foreground block text-xs mb-1">Round Trip</span>
|
|
<span className="font-medium">{Math.floor(data.round_trip_duration_seconds / 60)}:{(data.round_trip_duration_seconds % 60).toString().padStart(2, '0')}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
</CollapsibleContent>
|
|
</Collapsible>
|
|
)}
|
|
|
|
{/* Companies & Model */}
|
|
{(manufacturer || designer || model) && (
|
|
<div className="bg-muted/50 rounded-lg p-4">
|
|
<div className="flex items-center gap-2 mb-2">
|
|
<Building className="h-4 w-4 text-muted-foreground" />
|
|
<span className="text-sm font-semibold">Companies & Model</span>
|
|
</div>
|
|
<div className="text-sm space-y-1 ml-6">
|
|
{manufacturer && (
|
|
<div>
|
|
<span className="text-muted-foreground">Manufacturer:</span>{' '}
|
|
<span className="font-medium">{manufacturer}</span>
|
|
</div>
|
|
)}
|
|
{designer && (
|
|
<div>
|
|
<span className="text-muted-foreground">Designer:</span>{' '}
|
|
<span className="font-medium">{designer}</span>
|
|
</div>
|
|
)}
|
|
{model && (
|
|
<div>
|
|
<span className="text-muted-foreground">Model:</span>{' '}
|
|
<span className="font-medium">{model}</span>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Dates */}
|
|
{(data.opening_date || data.closing_date) && (
|
|
<div className="bg-muted/50 rounded-lg p-3">
|
|
<div className="flex items-center gap-2 mb-2">
|
|
<Calendar className="h-4 w-4 text-muted-foreground" />
|
|
<span className="text-sm font-semibold">Dates</span>
|
|
</div>
|
|
<div className="text-sm space-y-1 ml-6">
|
|
{data.opening_date && (
|
|
<div>
|
|
<span className="text-muted-foreground">Opened:</span>{' '}
|
|
<FlexibleDateDisplay
|
|
date={data.opening_date}
|
|
precision={(data.opening_date_precision as DatePrecision) || 'day'}
|
|
className="font-medium"
|
|
/>
|
|
</div>
|
|
)}
|
|
{data.closing_date && (
|
|
<div>
|
|
<span className="text-muted-foreground">Closed:</span>{' '}
|
|
<FlexibleDateDisplay
|
|
date={data.closing_date}
|
|
precision={(data.closing_date_precision as DatePrecision) || 'day'}
|
|
className="font-medium"
|
|
/>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Description */}
|
|
{data.description && (
|
|
<div className="bg-muted/50 rounded-lg p-4">
|
|
<div className="text-sm font-semibold mb-2">Description</div>
|
|
<div className="text-sm text-muted-foreground leading-relaxed">
|
|
{data.description}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Source */}
|
|
{data.source_url && (
|
|
<a
|
|
href={data.source_url}
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
className="inline-flex items-center gap-1 text-sm text-muted-foreground hover:underline"
|
|
>
|
|
Source
|
|
<ExternalLink className="h-3 w-3" />
|
|
</a>
|
|
)}
|
|
|
|
{/* Submission Notes */}
|
|
{data.submission_notes && (
|
|
<div className="bg-amber-50 dark:bg-amber-950 rounded-lg p-3 border border-amber-200 dark:border-amber-800">
|
|
<div className="flex items-center gap-2 mb-1">
|
|
<AlertCircle className="h-4 w-4 text-amber-600 dark:text-amber-400" />
|
|
<span className="text-sm font-semibold text-amber-900 dark:text-amber-100">Submitter Notes</span>
|
|
</div>
|
|
<div className="text-sm text-amber-800 dark:text-amber-200 ml-6">
|
|
{data.submission_notes}
|
|
</div>
|
|
</div>
|
|
)}
|
|
|
|
{/* Images Preview */}
|
|
{(data.banner_image_url || data.card_image_url || data.image_url) && (
|
|
<div className="space-y-2">
|
|
<Separator />
|
|
<div className="text-sm font-semibold">Images</div>
|
|
<div className="grid grid-cols-2 gap-2">
|
|
{data.banner_image_url && (
|
|
<div className="space-y-1">
|
|
<img
|
|
src={data.banner_image_url}
|
|
alt="Banner"
|
|
className="w-full h-32 object-cover rounded border"
|
|
/>
|
|
<div className="text-xs text-center text-muted-foreground">
|
|
Banner
|
|
{data.banner_image_id && (
|
|
<span className="block font-mono text-[10px] mt-0.5">ID: {data.banner_image_id.slice(0, 8)}...</span>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
{data.card_image_url && (
|
|
<div className="space-y-1">
|
|
<img
|
|
src={data.card_image_url}
|
|
alt="Card"
|
|
className="w-full h-32 object-cover rounded border"
|
|
/>
|
|
<div className="text-xs text-center text-muted-foreground">
|
|
Card
|
|
{data.card_image_id && (
|
|
<span className="block font-mono text-[10px] mt-0.5">ID: {data.card_image_id.slice(0, 8)}...</span>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
{data.image_url && !data.banner_image_url && !data.card_image_url && (
|
|
<div className="space-y-1">
|
|
<img
|
|
src={data.image_url}
|
|
alt="Ride"
|
|
className="w-full h-32 object-cover rounded border"
|
|
/>
|
|
<div className="text-xs text-center text-muted-foreground">Legacy Image</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|