mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 12:51:14 -05:00
Fix founded year/date handling
This commit is contained in:
@@ -186,6 +186,11 @@ function StatusFieldDisplay({ change, compact }: { change: FieldChange; compact:
|
||||
}
|
||||
|
||||
function DateFieldDisplay({ change, compact }: { change: FieldChange; compact: boolean }) {
|
||||
// Extract precision from metadata
|
||||
const precision = change.metadata?.precision;
|
||||
const oldPrecision = change.metadata?.oldPrecision;
|
||||
const newPrecision = change.metadata?.newPrecision;
|
||||
|
||||
if (compact) {
|
||||
return (
|
||||
<Badge variant="outline" className="text-teal-600 dark:text-teal-400">
|
||||
@@ -204,29 +209,34 @@ function DateFieldDisplay({ change, compact }: { change: FieldChange; compact: b
|
||||
<div className="text-sm font-medium flex items-center gap-2">
|
||||
<Calendar className="h-4 w-4" />
|
||||
{formatFieldName(change.field)}
|
||||
{precision && (
|
||||
<Badge variant="outline" className="text-xs ml-2">
|
||||
{precision === 'year' ? 'Year Only' : precision === 'month' ? 'Month & Year' : 'Full Date'}
|
||||
</Badge>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{change.changeType === 'modified' && (
|
||||
<div className="flex items-center gap-3 text-sm">
|
||||
<span className="text-red-600 dark:text-red-400 line-through">
|
||||
{formatFieldValue(change.oldValue)}
|
||||
{formatFieldValue(change.oldValue, oldPrecision || precision)}
|
||||
</span>
|
||||
<ArrowRight className="h-3 w-3 text-muted-foreground" />
|
||||
<span className="text-green-600 dark:text-green-400">
|
||||
{formatFieldValue(change.newValue)}
|
||||
{formatFieldValue(change.newValue, newPrecision || precision)}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{change.changeType === 'added' && (
|
||||
<div className="text-sm text-green-600 dark:text-green-400">
|
||||
+ {formatFieldValue(change.newValue)}
|
||||
+ {formatFieldValue(change.newValue, precision)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{change.changeType === 'removed' && (
|
||||
<div className="text-sm text-red-600 dark:text-red-400 line-through">
|
||||
{formatFieldValue(change.oldValue)}
|
||||
{formatFieldValue(change.oldValue, precision)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user