Refactor History component

This commit is contained in:
gpt-engineer-app[bot]
2025-10-06 16:37:56 +00:00
parent 3cda4b1fde
commit f86b772eca
7 changed files with 179 additions and 206 deletions

View File

@@ -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() {
</TabsContent>
<TabsContent value="history" className="mt-6">
<Tabs defaultValue="company-history" className="w-full">
<TabsList className="w-full max-w-md">
<TabsTrigger value="company-history">Company History</TabsTrigger>
<TabsTrigger value="version-history">Version History</TabsTrigger>
</TabsList>
<TabsContent value="company-history" className="mt-6 space-y-6">
<EntityHistoryTimeline
events={[
...(designer.founded_year ? [{
date: `${designer.founded_year}`,
title: `${designer.name} Founded`,
description: `${designer.name} was established`,
type: 'milestone' as const
}] : []),
]}
entityName={designer.name}
/>
</TabsContent>
<TabsContent value="version-history" className="mt-6">
<EntityVersionHistory
entityType="company"
entityId={designer.id}
entityName={designer.name}
/>
</TabsContent>
</Tabs>
<EntityHistoryTabs
entityType="company"
entityId={designer.id}
entityName={designer.name}
events={[
...(designer.founded_year ? [{
date: `${designer.founded_year}`,
title: `${designer.name} Founded`,
description: `${designer.name} was established`,
type: 'milestone' as const
}] : []),
]}
/>
</TabsContent>
</Tabs>
</main>