diff --git a/src/components/moderation/FieldComparison.tsx b/src/components/moderation/FieldComparison.tsx
index dd5fb883..017cea2d 100644
--- a/src/components/moderation/FieldComparison.tsx
+++ b/src/components/moderation/FieldComparison.tsx
@@ -203,16 +203,47 @@ interface LocationDiffProps {
}
export function LocationDiff({ oldLocation, newLocation, compact = false }: LocationDiffProps) {
+ // Check if we're creating a new location entity
+ const isCreatingNewLocation = oldLocation?.location_id && !oldLocation?.city && newLocation?.city;
+
const formatLocation = (loc: any) => {
if (!loc) return 'None';
if (typeof loc === 'string') return loc;
+
+ // Handle location_id reference
+ if (loc.location_id && !loc.city) {
+ return `Location ID: ${loc.location_id.substring(0, 8)}...`;
+ }
+
if (typeof loc === 'object') {
- const parts = [loc.city, loc.state_province, loc.country].filter(Boolean);
- return parts.join(', ') || 'Unknown';
+ const parts = [];
+ if (loc.city) parts.push(loc.city);
+ if (loc.state_province) parts.push(loc.state_province);
+ if (loc.country && loc.country !== loc.state_province) parts.push(loc.country);
+ if (loc.postal_code) parts.push(loc.postal_code);
+
+ let locationStr = parts.join(', ') || 'Unknown';
+
+ // Add coordinates if available
+ if (loc.latitude && loc.longitude) {
+ const lat = Number(loc.latitude).toFixed(6);
+ const lng = Number(loc.longitude).toFixed(6);
+ locationStr += ` (${lat}°, ${lng}°)`;
+ }
+
+ return locationStr;
}
return String(loc);
};
+ // Check if only coordinates changed
+ const onlyCoordinatesChanged = oldLocation?.city === newLocation?.city &&
+ oldLocation?.state_province === newLocation?.state_province &&
+ oldLocation?.country === newLocation?.country &&
+ oldLocation?.postal_code === newLocation?.postal_code &&
+ (Number(oldLocation?.latitude) !== Number(newLocation?.latitude) ||
+ Number(oldLocation?.longitude) !== Number(newLocation?.longitude));
+
if (compact) {
const oldLoc = formatLocation(oldLocation);
const newLoc = formatLocation(newLocation);
@@ -235,14 +266,24 @@ export function LocationDiff({ oldLocation, newLocation, compact = false }: Loca
return (