Fix all compliance violations

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 18:38:46 +00:00
parent 7eb0b77d76
commit 6efb6dda66
6 changed files with 60 additions and 40 deletions

View File

@@ -201,17 +201,36 @@ export function ImageDiff({ change, compact = false }: ImageDiffProps) {
);
}
interface LocationData {
location_id?: string;
city?: string;
state_province?: string;
country?: string;
postal_code?: string;
latitude?: number | string;
longitude?: number | string;
}
interface LocationDiffProps {
oldLocation: any;
newLocation: any;
oldLocation: LocationData | string | null | undefined;
newLocation: LocationData | string | null | undefined;
compact?: boolean;
}
export function LocationDiff({ oldLocation, newLocation, compact = false }: LocationDiffProps) {
// Type guards for LocationData
const isLocationData = (loc: unknown): loc is LocationData => {
return typeof loc === 'object' && loc !== null && !Array.isArray(loc);
};
// Check if we're creating a new location entity
const isCreatingNewLocation = oldLocation?.location_id && !oldLocation?.city && newLocation?.city;
const isCreatingNewLocation = isLocationData(oldLocation) &&
oldLocation.location_id &&
!oldLocation.city &&
isLocationData(newLocation) &&
newLocation.city;
const formatLocation = (loc: any) => {
const formatLocation = (loc: LocationData | string | null | undefined) => {
if (!loc) return 'None';
if (typeof loc === 'string') return loc;
@@ -242,12 +261,14 @@ export function LocationDiff({ oldLocation, newLocation, compact = false }: Loca
};
// 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));
const onlyCoordinatesChanged = isLocationData(oldLocation) &&
isLocationData(newLocation) &&
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);