diff --git a/src/components/history/EntityHistoryTabs.tsx b/src/components/history/EntityHistoryTabs.tsx
new file mode 100644
index 00000000..b2a65833
--- /dev/null
+++ b/src/components/history/EntityHistoryTabs.tsx
@@ -0,0 +1,81 @@
+import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
+import { EntityHistoryTimeline, HistoryEvent } from './EntityHistoryTimeline';
+import { EntityVersionHistory } from '@/components/versioning/EntityVersionHistory';
+import { FormerNamesSection } from './FormerNamesSection';
+import { RideNameHistory } from '@/types/database';
+
+interface EntityHistoryTabsProps {
+ entityType: 'park' | 'ride' | 'company';
+ entityId: string;
+ entityName: string;
+ events: HistoryEvent[];
+ formerNames?: RideNameHistory[];
+ currentName?: string;
+}
+
+const getHistoryLabel = (entityType: string) => {
+ switch (entityType) {
+ case 'park':
+ return 'Park History';
+ case 'ride':
+ return 'Ride History';
+ case 'company':
+ return 'Company History';
+ default:
+ return 'History';
+ }
+};
+
+const getHistoryValue = (entityType: string) => {
+ switch (entityType) {
+ case 'park':
+ return 'park-history';
+ case 'ride':
+ return 'ride-history';
+ case 'company':
+ return 'company-history';
+ default:
+ return 'entity-history';
+ }
+};
+
+export function EntityHistoryTabs({
+ entityType,
+ entityId,
+ entityName,
+ events,
+ formerNames,
+ currentName,
+}: EntityHistoryTabsProps) {
+ const historyValue = getHistoryValue(entityType);
+ const historyLabel = getHistoryLabel(entityType);
+
+ return (
+
+
+ {historyLabel}
+ Version History
+
+
+
+ {formerNames && formerNames.length > 0 && currentName && (
+
+ )}
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/pages/DesignerDetail.tsx b/src/pages/DesignerDetail.tsx
index 58a50156..dba6a0ce 100644
--- a/src/pages/DesignerDetail.tsx
+++ b/src/pages/DesignerDetail.tsx
@@ -16,9 +16,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyUpdate } from '@/lib/companyHelpers';
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 DesignerDetail() {
const { slug } = useParams<{ slug: string }>();
@@ -276,34 +274,19 @@ export default function DesignerDetail() {
-
-
- Company History
- Version History
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/pages/ManufacturerDetail.tsx b/src/pages/ManufacturerDetail.tsx
index aed1d9a5..67cc7f48 100644
--- a/src/pages/ManufacturerDetail.tsx
+++ b/src/pages/ManufacturerDetail.tsx
@@ -16,9 +16,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyUpdate } from '@/lib/companyHelpers';
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 ManufacturerDetail() {
const { slug } = useParams<{ slug: string }>();
@@ -298,34 +296,19 @@ export default function ManufacturerDetail() {
-
-
- Company History
- Version History
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/pages/OperatorDetail.tsx b/src/pages/OperatorDetail.tsx
index e6d1dfa1..7c3b927c 100644
--- a/src/pages/OperatorDetail.tsx
+++ b/src/pages/OperatorDetail.tsx
@@ -17,9 +17,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyUpdate } from '@/lib/companyHelpers';
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 OperatorDetail() {
const { slug } = useParams<{ slug: string }>();
@@ -321,34 +319,19 @@ export default function OperatorDetail() {
-
-
- Company History
- Version History
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/pages/ParkDetail.tsx b/src/pages/ParkDetail.tsx
index e5fbf941..3084ebd0 100644
--- a/src/pages/ParkDetail.tsx
+++ b/src/pages/ParkDetail.tsx
@@ -21,9 +21,7 @@ import { toast } from '@/hooks/use-toast';
import { useUserRole } from '@/hooks/useUserRole';
import { Edit } from 'lucide-react';
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 ParkDetail() {
const {
@@ -593,40 +591,25 @@ export default function ParkDetail() {
-
-
- Park History
- Version History
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/pages/PropertyOwnerDetail.tsx b/src/pages/PropertyOwnerDetail.tsx
index 352783c2..6e1143cc 100644
--- a/src/pages/PropertyOwnerDetail.tsx
+++ b/src/pages/PropertyOwnerDetail.tsx
@@ -17,9 +17,7 @@ import { useUserRole } from '@/hooks/useUserRole';
import { toast } from '@/hooks/use-toast';
import { submitCompanyUpdate } from '@/lib/companyHelpers';
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 PropertyOwnerDetail() {
const { slug } = useParams<{ slug: string }>();
@@ -321,34 +319,19 @@ export default function PropertyOwnerDetail() {
-
-
- Company History
- Version History
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/pages/RideDetail.tsx b/src/pages/RideDetail.tsx
index 02a3e61c..20ed1b1a 100644
--- a/src/pages/RideDetail.tsx
+++ b/src/pages/RideDetail.tsx
@@ -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() {
-
-
- Ride History
- Version History
-
-
-
- {ride.name_history && ride.name_history.length > 0 && (
-
- )}
-
-
-
-
-
-
-
-
+