mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 02:31:12 -05:00
Refactor versioning utility functions
This commit is contained in:
@@ -5,11 +5,12 @@ import { ScrollArea } from '@/components/ui/scroll-area';
|
||||
import { Separator } from '@/components/ui/separator';
|
||||
import { ArrowRight, Plus, Minus, Edit } from 'lucide-react';
|
||||
import { useEntityVersions } from '@/hooks/useEntityVersions';
|
||||
import type { EntityType } from '@/types/versioning';
|
||||
|
||||
interface VersionComparisonDialogProps {
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
entityType: string;
|
||||
entityType: EntityType;
|
||||
entityId: string;
|
||||
fromVersionId: string;
|
||||
toVersionId: string;
|
||||
@@ -27,8 +28,8 @@ export function VersionComparisonDialog({
|
||||
const [diff, setDiff] = useState<any>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
|
||||
const fromVersion = versions.find(v => v.id === fromVersionId);
|
||||
const toVersion = versions.find(v => v.id === toVersionId);
|
||||
const fromVersion = versions.find(v => v.version_id === fromVersionId);
|
||||
const toVersion = versions.find(v => v.version_id === toVersionId);
|
||||
|
||||
useEffect(() => {
|
||||
const loadDiff = async () => {
|
||||
@@ -65,12 +66,12 @@ export function VersionComparisonDialog({
|
||||
<div className="flex items-center gap-4 text-sm text-muted-foreground mt-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge variant="outline">Version {fromVersion?.version_number}</Badge>
|
||||
<span>{new Date(fromVersion?.changed_at || '').toLocaleString()}</span>
|
||||
<span>{new Date(fromVersion?.created_at || '').toLocaleString()}</span>
|
||||
</div>
|
||||
<ArrowRight className="h-4 w-4" />
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge variant="outline">Version {toVersion?.version_number}</Badge>
|
||||
<span>{new Date(toVersion?.changed_at || '').toLocaleString()}</span>
|
||||
<span>{new Date(toVersion?.created_at || '').toLocaleString()}</span>
|
||||
</div>
|
||||
</div>
|
||||
</DialogHeader>
|
||||
|
||||
Reference in New Issue
Block a user