mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 08:51:13 -05:00
Implement Phase 2 display enhancements
This commit is contained in:
@@ -5,13 +5,14 @@ import { PhotoSubmissionDisplay } from './PhotoSubmissionDisplay';
|
|||||||
import { RichParkDisplay } from './displays/RichParkDisplay';
|
import { RichParkDisplay } from './displays/RichParkDisplay';
|
||||||
import { RichRideDisplay } from './displays/RichRideDisplay';
|
import { RichRideDisplay } from './displays/RichRideDisplay';
|
||||||
import { RichCompanyDisplay } from './displays/RichCompanyDisplay';
|
import { RichCompanyDisplay } from './displays/RichCompanyDisplay';
|
||||||
|
import { RichRideModelDisplay } from './displays/RichRideModelDisplay';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { AlertCircle, Loader2 } from 'lucide-react';
|
import { AlertCircle, Loader2 } from 'lucide-react';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import type { SubmissionItemData } from '@/types/submissions';
|
import type { SubmissionItemData } from '@/types/submissions';
|
||||||
import type { ParkSubmissionData, RideSubmissionData, CompanySubmissionData } from '@/types/submission-data';
|
import type { ParkSubmissionData, RideSubmissionData, CompanySubmissionData, RideModelSubmissionData } from '@/types/submission-data';
|
||||||
import { logger } from '@/lib/logger';
|
import { logger } from '@/lib/logger';
|
||||||
import { getErrorMessage } from '@/lib/errorHandler';
|
import { getErrorMessage } from '@/lib/errorHandler';
|
||||||
import { ModerationErrorBoundary } from '@/components/error/ModerationErrorBoundary';
|
import { ModerationErrorBoundary } from '@/components/error/ModerationErrorBoundary';
|
||||||
@@ -109,6 +110,15 @@ export const SubmissionItemsList = memo(function SubmissionItemsList({
|
|||||||
entityData = data as any;
|
entityData = data as any;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'ride_model': {
|
||||||
|
const { data } = await supabase
|
||||||
|
.from('ride_model_submissions')
|
||||||
|
.select('*')
|
||||||
|
.eq('id', item.item_data_id)
|
||||||
|
.maybeSingle();
|
||||||
|
entityData = data as any;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
entityData = null;
|
entityData = null;
|
||||||
}
|
}
|
||||||
@@ -267,6 +277,18 @@ export const SubmissionItemsList = memo(function SubmissionItemsList({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.item_type === 'ride_model' && entityData) {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{itemMetadata}
|
||||||
|
<RichRideModelDisplay
|
||||||
|
data={entityData as unknown as RideModelSubmissionData}
|
||||||
|
actionType={actionType}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Fallback to SubmissionChangesDisplay
|
// Fallback to SubmissionChangesDisplay
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -142,11 +142,21 @@ export function RichCompanyDisplay({ data, actionType, showAllFields = true }: R
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Images Preview */}
|
{/* Images Preview */}
|
||||||
{(data.banner_image_url || data.card_image_url) && (
|
{(data.logo_url || data.banner_image_url || data.card_image_url) && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="text-sm font-semibold">Images</div>
|
<div className="text-sm font-semibold">Images</div>
|
||||||
<div className="grid grid-cols-2 gap-2">
|
<div className="grid grid-cols-2 gap-2">
|
||||||
|
{data.logo_url && (
|
||||||
|
<div className="space-y-1">
|
||||||
|
<img
|
||||||
|
src={data.logo_url}
|
||||||
|
alt="Logo"
|
||||||
|
className="w-full h-24 object-contain bg-muted rounded border p-2"
|
||||||
|
/>
|
||||||
|
<div className="text-xs text-center text-muted-foreground">Logo</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{data.banner_image_url && (
|
{data.banner_image_url && (
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<img
|
<img
|
||||||
@@ -154,7 +164,12 @@ export function RichCompanyDisplay({ data, actionType, showAllFields = true }: R
|
|||||||
alt="Banner"
|
alt="Banner"
|
||||||
className="w-full h-24 object-cover rounded border"
|
className="w-full h-24 object-cover rounded border"
|
||||||
/>
|
/>
|
||||||
<div className="text-xs text-center text-muted-foreground">Banner</div>
|
<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>
|
</div>
|
||||||
)}
|
)}
|
||||||
{data.card_image_url && (
|
{data.card_image_url && (
|
||||||
@@ -164,7 +179,12 @@ export function RichCompanyDisplay({ data, actionType, showAllFields = true }: R
|
|||||||
alt="Card"
|
alt="Card"
|
||||||
className="w-full h-24 object-cover rounded border"
|
className="w-full h-24 object-cover rounded border"
|
||||||
/>
|
/>
|
||||||
<div className="text-xs text-center text-muted-foreground">Card</div>
|
<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>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -111,6 +111,30 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
|
|
||||||
{/* Key Information Grid */}
|
{/* Key Information Grid */}
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-3">
|
||||||
|
{/* Contact Information */}
|
||||||
|
{(data.phone || data.email) && (
|
||||||
|
<div className="bg-muted/50 rounded-lg p-3">
|
||||||
|
<div className="flex items-center gap-2 mb-2">
|
||||||
|
<Globe className="h-4 w-4 text-muted-foreground" />
|
||||||
|
<span className="text-sm font-semibold">Contact</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-sm space-y-1 ml-6">
|
||||||
|
{data.phone && (
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Phone:</span>{' '}
|
||||||
|
<a href={`tel:${data.phone}`} className="font-medium hover:underline">{data.phone}</a>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{data.email && (
|
||||||
|
<div>
|
||||||
|
<span className="text-muted-foreground">Email:</span>{' '}
|
||||||
|
<a href={`mailto:${data.email}`} className="font-medium hover:underline">{data.email}</a>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Dates */}
|
{/* Dates */}
|
||||||
{(data.opening_date || data.closing_date) && (
|
{(data.opening_date || data.closing_date) && (
|
||||||
<div className="bg-muted/50 rounded-lg p-3">
|
<div className="bg-muted/50 rounded-lg p-3">
|
||||||
@@ -231,7 +255,12 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
alt="Banner"
|
alt="Banner"
|
||||||
className="w-full h-24 object-cover rounded border"
|
className="w-full h-24 object-cover rounded border"
|
||||||
/>
|
/>
|
||||||
<div className="text-xs text-center text-muted-foreground">Banner</div>
|
<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>
|
</div>
|
||||||
)}
|
)}
|
||||||
{data.card_image_url && (
|
{data.card_image_url && (
|
||||||
@@ -241,7 +270,12 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
alt="Card"
|
alt="Card"
|
||||||
className="w-full h-24 object-cover rounded border"
|
className="w-full h-24 object-cover rounded border"
|
||||||
/>
|
/>
|
||||||
<div className="text-xs text-center text-muted-foreground">Card</div>
|
<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>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { Train, Gauge, Ruler, Zap, Calendar, Building, User, ExternalLink, AlertCircle, TrendingUp } from 'lucide-react';
|
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 { Badge } from '@/components/ui/badge';
|
||||||
import { Separator } from '@/components/ui/separator';
|
import { Separator } from '@/components/ui/separator';
|
||||||
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
|
||||||
|
import { ChevronDown, ChevronRight } from 'lucide-react';
|
||||||
import type { RideSubmissionData } from '@/types/submission-data';
|
import type { RideSubmissionData } from '@/types/submission-data';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { supabase } from '@/lib/supabaseClient';
|
import { supabase } from '@/lib/supabaseClient';
|
||||||
@@ -16,10 +18,11 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
const [manufacturer, setManufacturer] = useState<string | null>(null);
|
const [manufacturer, setManufacturer] = useState<string | null>(null);
|
||||||
const [designer, setDesigner] = useState<string | null>(null);
|
const [designer, setDesigner] = useState<string | null>(null);
|
||||||
const [model, setModel] = useState<string | null>(null);
|
const [model, setModel] = useState<string | null>(null);
|
||||||
|
const [showCategorySpecific, setShowCategorySpecific] = useState(false);
|
||||||
|
const [showTechnical, setShowTechnical] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const fetchRelatedData = async () => {
|
const fetchRelatedData = async () => {
|
||||||
// Fetch park
|
|
||||||
if (data.park_id) {
|
if (data.park_id) {
|
||||||
const { data: parkData } = await supabase
|
const { data: parkData } = await supabase
|
||||||
.from('parks')
|
.from('parks')
|
||||||
@@ -29,7 +32,6 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
setPark(parkData?.name || null);
|
setPark(parkData?.name || null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch manufacturer
|
|
||||||
if (data.manufacturer_id) {
|
if (data.manufacturer_id) {
|
||||||
const { data: mfgData } = await supabase
|
const { data: mfgData } = await supabase
|
||||||
.from('companies')
|
.from('companies')
|
||||||
@@ -39,7 +41,6 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
setManufacturer(mfgData?.name || null);
|
setManufacturer(mfgData?.name || null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch designer
|
|
||||||
if (data.designer_id) {
|
if (data.designer_id) {
|
||||||
const { data: designerData } = await supabase
|
const { data: designerData } = await supabase
|
||||||
.from('companies')
|
.from('companies')
|
||||||
@@ -49,7 +50,6 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
setDesigner(designerData?.name || null);
|
setDesigner(designerData?.name || null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch model
|
|
||||||
if (data.ride_model_id) {
|
if (data.ride_model_id) {
|
||||||
const { data: modelData } = await supabase
|
const { data: modelData } = await supabase
|
||||||
.from('ride_models')
|
.from('ride_models')
|
||||||
@@ -73,19 +73,15 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Format metrics for display
|
// Determine which category-specific section to show
|
||||||
const heightDisplay = data.max_height_meters
|
const category = data.category?.toLowerCase();
|
||||||
? `${data.max_height_meters.toFixed(1)} m`
|
const hasWaterFields = category === 'water_ride' && (data.water_depth_cm || data.splash_height_meters || data.wetness_level || data.flume_type || data.boat_capacity);
|
||||||
: null;
|
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 speedDisplay = data.max_speed_kmh
|
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);
|
||||||
? `${data.max_speed_kmh.toFixed(1)} km/h`
|
const hasKiddieFields = category === 'kiddie_ride' && (data.min_age || data.max_age || data.educational_theme || data.character_theme);
|
||||||
: null;
|
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 lengthDisplay = data.length_meters
|
|
||||||
? `${data.length_meters.toFixed(1)} m`
|
const hasTechnicalFields = data.track_material || data.support_material || data.propulsion_method || data.coaster_type || data.seating_type || data.intensity_level;
|
||||||
: null;
|
|
||||||
const dropDisplay = data.drop_height_meters
|
|
||||||
? `${data.drop_height_meters.toFixed(1)} m`
|
|
||||||
: null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
@@ -124,46 +120,46 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Statistics Grid */}
|
{/* Primary Statistics Grid */}
|
||||||
{(heightDisplay || speedDisplay || lengthDisplay || dropDisplay || data.duration_seconds || data.inversions) && (
|
{(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">
|
<div className="grid grid-cols-2 md:grid-cols-3 gap-3">
|
||||||
{heightDisplay && (
|
{data.max_height_meters && (
|
||||||
<div className="bg-muted/50 rounded-lg p-3">
|
<div className="bg-muted/50 rounded-lg p-3">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
<TrendingUp className="h-4 w-4 text-blue-500" />
|
<TrendingUp className="h-4 w-4 text-blue-500" />
|
||||||
<span className="text-xs text-muted-foreground">Height</span>
|
<span className="text-xs text-muted-foreground">Height</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-lg font-bold">{heightDisplay}</div>
|
<div className="text-lg font-bold">{data.max_height_meters.toFixed(1)} m</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{speedDisplay && (
|
{data.max_speed_kmh && (
|
||||||
<div className="bg-muted/50 rounded-lg p-3">
|
<div className="bg-muted/50 rounded-lg p-3">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
<Zap className="h-4 w-4 text-yellow-500" />
|
<Zap className="h-4 w-4 text-yellow-500" />
|
||||||
<span className="text-xs text-muted-foreground">Speed</span>
|
<span className="text-xs text-muted-foreground">Speed</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-lg font-bold">{speedDisplay}</div>
|
<div className="text-lg font-bold">{data.max_speed_kmh.toFixed(1)} km/h</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{lengthDisplay && (
|
{data.length_meters && (
|
||||||
<div className="bg-muted/50 rounded-lg p-3">
|
<div className="bg-muted/50 rounded-lg p-3">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
<Ruler className="h-4 w-4 text-green-500" />
|
<Ruler className="h-4 w-4 text-green-500" />
|
||||||
<span className="text-xs text-muted-foreground">Length</span>
|
<span className="text-xs text-muted-foreground">Length</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-lg font-bold">{lengthDisplay}</div>
|
<div className="text-lg font-bold">{data.length_meters.toFixed(1)} m</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{dropDisplay && (
|
{data.drop_height_meters && (
|
||||||
<div className="bg-muted/50 rounded-lg p-3">
|
<div className="bg-muted/50 rounded-lg p-3">
|
||||||
<div className="flex items-center gap-2 mb-1">
|
<div className="flex items-center gap-2 mb-1">
|
||||||
<TrendingUp className="h-4 w-4 text-purple-500" />
|
<TrendingUp className="h-4 w-4 text-purple-500" />
|
||||||
<span className="text-xs text-muted-foreground">Drop</span>
|
<span className="text-xs text-muted-foreground">Drop</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="text-lg font-bold">{dropDisplay}</div>
|
<div className="text-lg font-bold">{data.drop_height_meters.toFixed(1)} m</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -189,7 +185,379 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Companies */}
|
{/* 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) && (
|
{(manufacturer || designer || model) && (
|
||||||
<div className="bg-muted/50 rounded-lg p-4">
|
<div className="bg-muted/50 rounded-lg p-4">
|
||||||
<div className="flex items-center gap-2 mb-2">
|
<div className="flex items-center gap-2 mb-2">
|
||||||
@@ -259,27 +627,6 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Additional Details */}
|
|
||||||
{(data.capacity_per_hour || data.max_g_force || data.height_requirement || data.age_requirement) && (
|
|
||||||
<div className="bg-muted/50 rounded-lg p-4">
|
|
||||||
<div className="text-sm font-semibold mb-2">Additional Details</div>
|
|
||||||
<div className="grid grid-cols-2 gap-2 text-sm ml-2">
|
|
||||||
{data.capacity_per_hour && (
|
|
||||||
<div><span className="text-muted-foreground">Capacity/Hour:</span> <span className="font-medium">{data.capacity_per_hour}</span></div>
|
|
||||||
)}
|
|
||||||
{data.max_g_force && (
|
|
||||||
<div><span className="text-muted-foreground">Max G-Force:</span> <span className="font-medium">{data.max_g_force}g</span></div>
|
|
||||||
)}
|
|
||||||
{data.height_requirement && (
|
|
||||||
<div><span className="text-muted-foreground">Height Req:</span> <span className="font-medium">{data.height_requirement} cm</span></div>
|
|
||||||
)}
|
|
||||||
{data.age_requirement && (
|
|
||||||
<div><span className="text-muted-foreground">Age Req:</span> <span className="font-medium">{data.age_requirement}+</span></div>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Source */}
|
{/* Source */}
|
||||||
{data.source_url && (
|
{data.source_url && (
|
||||||
<a
|
<a
|
||||||
@@ -307,7 +654,7 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Images Preview */}
|
{/* Images Preview */}
|
||||||
{(data.banner_image_url || data.card_image_url) && (
|
{(data.banner_image_url || data.card_image_url || data.image_url) && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Separator />
|
<Separator />
|
||||||
<div className="text-sm font-semibold">Images</div>
|
<div className="text-sm font-semibold">Images</div>
|
||||||
@@ -319,7 +666,12 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
alt="Banner"
|
alt="Banner"
|
||||||
className="w-full h-32 object-cover rounded border"
|
className="w-full h-32 object-cover rounded border"
|
||||||
/>
|
/>
|
||||||
<div className="text-xs text-center text-muted-foreground">Banner</div>
|
<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>
|
</div>
|
||||||
)}
|
)}
|
||||||
{data.card_image_url && (
|
{data.card_image_url && (
|
||||||
@@ -329,7 +681,22 @@ export function RichRideDisplay({ data, actionType, showAllFields = true }: Rich
|
|||||||
alt="Card"
|
alt="Card"
|
||||||
className="w-full h-32 object-cover rounded border"
|
className="w-full h-32 object-cover rounded border"
|
||||||
/>
|
/>
|
||||||
<div className="text-xs text-center text-muted-foreground">Card</div>
|
<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>
|
||||||
|
|||||||
156
src/components/moderation/displays/RichRideModelDisplay.tsx
Normal file
156
src/components/moderation/displays/RichRideModelDisplay.tsx
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
import { Package, Building, Calendar, ExternalLink, AlertCircle } from 'lucide-react';
|
||||||
|
import { Badge } from '@/components/ui/badge';
|
||||||
|
import { Separator } from '@/components/ui/separator';
|
||||||
|
import type { RideModelSubmissionData } from '@/types/submission-data';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { supabase } from '@/lib/supabaseClient';
|
||||||
|
|
||||||
|
interface RichRideModelDisplayProps {
|
||||||
|
data: RideModelSubmissionData;
|
||||||
|
actionType: 'create' | 'edit' | 'delete';
|
||||||
|
showAllFields?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function RichRideModelDisplay({ data, actionType, showAllFields = true }: RichRideModelDisplayProps) {
|
||||||
|
const [manufacturer, setManufacturer] = useState<string | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchManufacturer = async () => {
|
||||||
|
if (data.manufacturer_id) {
|
||||||
|
const { data: mfgData } = await supabase
|
||||||
|
.from('companies')
|
||||||
|
.select('name')
|
||||||
|
.eq('id', data.manufacturer_id)
|
||||||
|
.single();
|
||||||
|
setManufacturer(mfgData?.name || null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchManufacturer();
|
||||||
|
}, [data.manufacturer_id]);
|
||||||
|
|
||||||
|
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">
|
||||||
|
<Package 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>
|
||||||
|
{manufacturer && (
|
||||||
|
<div className="text-sm text-muted-foreground mt-0.5">by {manufacturer}</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_type && (
|
||||||
|
<Badge variant="outline" className="text-xs">
|
||||||
|
{data.ride_type.replace(/_/g, ' ').replace(/\b\w/g, l => l.toUpperCase())}
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
{actionType === 'create' && (
|
||||||
|
<Badge className="bg-green-600 text-white text-xs">New Model</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>
|
||||||
|
|
||||||
|
{/* Manufacturer */}
|
||||||
|
{manufacturer && (
|
||||||
|
<div className="bg-muted/50 rounded-lg p-3">
|
||||||
|
<div className="flex items-center gap-2 mb-2">
|
||||||
|
<Building className="h-4 w-4 text-muted-foreground" />
|
||||||
|
<span className="text-sm font-semibold">Manufacturer</span>
|
||||||
|
</div>
|
||||||
|
<div className="text-sm font-medium ml-6">
|
||||||
|
{manufacturer}
|
||||||
|
</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) && (
|
||||||
|
<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-24 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-24 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>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user