Refactor versioning utility functions

This commit is contained in:
gpt-engineer-app[bot]
2025-10-15 17:47:14 +00:00
parent 4e7d528c64
commit 96a5d235e9
11 changed files with 1251 additions and 140 deletions

View File

@@ -6,9 +6,10 @@ import { History, Clock } from 'lucide-react';
import { formatDistanceToNow } from 'date-fns';
import { EntityVersionHistory } from './EntityVersionHistory';
import { useEntityVersions } from '@/hooks/useEntityVersions';
import type { EntityType } from '@/types/versioning';
interface VersionIndicatorProps {
entityType: string;
entityType: EntityType;
entityId: string;
entityName: string;
compact?: boolean;
@@ -27,8 +28,8 @@ export function VersionIndicator({
return null;
}
const timeAgo = currentVersion.changed_at
? formatDistanceToNow(new Date(currentVersion.changed_at), { addSuffix: true })
const timeAgo = currentVersion.created_at
? formatDistanceToNow(new Date(currentVersion.created_at), { addSuffix: true })
: 'Unknown';
if (compact) {