mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 22:31:13 -05:00
Refactor History component
This commit is contained in:
@@ -44,9 +44,7 @@ import { useAuth } from '@/hooks/useAuth';
|
||||
import { useUserRole } from '@/hooks/useUserRole';
|
||||
import { toast } from '@/hooks/use-toast';
|
||||
import { VersionIndicator } from '@/components/versioning/VersionIndicator';
|
||||
import { EntityVersionHistory } from '@/components/versioning/EntityVersionHistory';
|
||||
import { EntityHistoryTimeline, HistoryEvent } from '@/components/history/EntityHistoryTimeline';
|
||||
import { FormerNamesSection } from '@/components/history/FormerNamesSection';
|
||||
import { EntityHistoryTabs } from '@/components/history/EntityHistoryTabs';
|
||||
|
||||
export default function RideDetail() {
|
||||
const { parkSlug, rideSlug } = useParams<{ parkSlug: string; rideSlug: string }>();
|
||||
@@ -661,48 +659,27 @@ export default function RideDetail() {
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="history" className="mt-6">
|
||||
<Tabs defaultValue="ride-history" className="w-full">
|
||||
<TabsList className="grid w-full grid-cols-2">
|
||||
<TabsTrigger value="ride-history">Ride History</TabsTrigger>
|
||||
<TabsTrigger value="version-history">Version History</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="ride-history" className="mt-6 space-y-6">
|
||||
{ride.name_history && ride.name_history.length > 0 && (
|
||||
<FormerNamesSection
|
||||
currentName={ride.name}
|
||||
formerNames={ride.name_history}
|
||||
entityType="ride"
|
||||
/>
|
||||
)}
|
||||
|
||||
<EntityHistoryTimeline
|
||||
events={[
|
||||
...(ride.opening_date ? [{
|
||||
date: ride.opening_date,
|
||||
title: `${ride.name} Opened`,
|
||||
description: `${ride.name} opened to the public at ${ride.park.name}`,
|
||||
type: 'milestone' as const
|
||||
}] : []),
|
||||
...(ride.closing_date ? [{
|
||||
date: ride.closing_date,
|
||||
title: `${ride.name} Closed`,
|
||||
description: `${ride.name} ceased operation`,
|
||||
type: 'status_change' as const
|
||||
}] : []),
|
||||
]}
|
||||
entityName={ride.name}
|
||||
/>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="version-history" className="mt-6">
|
||||
<EntityVersionHistory
|
||||
entityType="ride"
|
||||
entityId={ride.id}
|
||||
entityName={ride.name}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
<EntityHistoryTabs
|
||||
entityType="ride"
|
||||
entityId={ride.id}
|
||||
entityName={ride.name}
|
||||
currentName={ride.name}
|
||||
formerNames={ride.name_history}
|
||||
events={[
|
||||
...(ride.opening_date ? [{
|
||||
date: ride.opening_date,
|
||||
title: `${ride.name} Opened`,
|
||||
description: `${ride.name} opened to the public at ${ride.park.name}`,
|
||||
type: 'milestone' as const
|
||||
}] : []),
|
||||
...(ride.closing_date ? [{
|
||||
date: ride.closing_date,
|
||||
title: `${ride.name} Closed`,
|
||||
description: `${ride.name} ceased operation`,
|
||||
type: 'status_change' as const
|
||||
}] : []),
|
||||
]}
|
||||
/>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user