feat: Implement Array Field Comparison

This commit is contained in:
gpt-engineer-app[bot]
2025-10-03 15:56:35 +00:00
parent b047291eb6
commit a4805cf0cc
2 changed files with 232 additions and 1 deletions

View File

@@ -1,7 +1,8 @@
import { Badge } from '@/components/ui/badge';
import { formatFieldName, formatFieldValue } from '@/lib/submissionChangeDetection';
import type { FieldChange, ImageChange } from '@/lib/submissionChangeDetection';
import { Badge } from '@/components/ui/badge';
import { ArrowRight } from 'lucide-react';
import { ArrayFieldDiff } from './ArrayFieldDiff';
interface FieldDiffProps {
change: FieldChange;
@@ -11,6 +12,18 @@ interface FieldDiffProps {
export function FieldDiff({ change, compact = false }: FieldDiffProps) {
const { field, oldValue, newValue, changeType } = change;
// Check if this is an array field that needs special handling
if (Array.isArray(oldValue) && Array.isArray(newValue)) {
return (
<ArrayFieldDiff
fieldName={formatFieldName(field)}
oldArray={oldValue}
newArray={newValue}
compact={compact}
/>
);
}
const getChangeColor = () => {
switch (changeType) {
case 'added': return 'text-green-600 dark:text-green-400';