mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 00:31:12 -05:00
feat: Standardize submission display
This commit is contained in:
@@ -5,6 +5,7 @@ import { Edit, MapPin, Zap, Building2, Image, Package } from 'lucide-react';
|
||||
import { type SubmissionItemWithDeps } from '@/lib/submissionItemsService';
|
||||
import { useIsMobile } from '@/hooks/use-mobile';
|
||||
import { PhotoSubmissionDisplay } from './PhotoSubmissionDisplay';
|
||||
import { SubmissionChangesDisplay } from './SubmissionChangesDisplay';
|
||||
|
||||
interface ItemReviewCardProps {
|
||||
item: SubmissionItemWithDeps;
|
||||
@@ -39,74 +40,8 @@ export function ItemReviewCard({ item, onEdit, onStatusChange }: ItemReviewCardP
|
||||
};
|
||||
|
||||
const renderItemPreview = () => {
|
||||
const data = item.item_data;
|
||||
|
||||
switch (item.item_type) {
|
||||
case 'park':
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<h4 className="font-semibold">{data.name}</h4>
|
||||
<p className="text-sm text-muted-foreground line-clamp-2">{data.description}</p>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
{data.park_type && <Badge variant="outline">{data.park_type}</Badge>}
|
||||
{data.status && <Badge variant="outline">{data.status}</Badge>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
case 'ride':
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<h4 className="font-semibold">{data.name}</h4>
|
||||
<p className="text-sm text-muted-foreground line-clamp-2">{data.description}</p>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
{data.category && <Badge variant="outline">{data.category}</Badge>}
|
||||
{data.status && <Badge variant="outline">{data.status}</Badge>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
case 'manufacturer':
|
||||
case 'operator':
|
||||
case 'property_owner':
|
||||
case 'designer':
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<h4 className="font-semibold">{data.name}</h4>
|
||||
<p className="text-sm text-muted-foreground line-clamp-2">{data.description}</p>
|
||||
{data.founded_year && (
|
||||
<Badge variant="outline">Founded {data.founded_year}</Badge>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
case 'ride_model':
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<h4 className="font-semibold">{data.name}</h4>
|
||||
<p className="text-sm text-muted-foreground line-clamp-2">{data.description}</p>
|
||||
<div className="flex gap-2 flex-wrap">
|
||||
{data.category && <Badge variant="outline">{data.category}</Badge>}
|
||||
{data.ride_type && <Badge variant="outline">{data.ride_type}</Badge>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
case 'photo':
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{/* Fetch and display from photo_submission_items */}
|
||||
<PhotoSubmissionDisplay submissionId={data.submission_id} />
|
||||
</div>
|
||||
);
|
||||
|
||||
default:
|
||||
return (
|
||||
<div className="text-sm text-muted-foreground">
|
||||
No preview available
|
||||
</div>
|
||||
);
|
||||
}
|
||||
// Use standardized change detection display
|
||||
return <SubmissionChangesDisplay item={item} view="summary" showImages={true} />;
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user