mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 22:31:13 -05:00
Fix TypeScript errors in moderation components
This commit is contained in:
@@ -113,7 +113,9 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
};
|
||||
|
||||
const renderEditForm = (editItem: SubmissionItemWithDeps) => {
|
||||
const data = editItem.item_data;
|
||||
const itemData = typeof editItem.item_data === 'object' && editItem.item_data !== null && !Array.isArray(editItem.item_data)
|
||||
? editItem.item_data as Record<string, unknown>
|
||||
: {};
|
||||
|
||||
switch (editItem.item_type) {
|
||||
case 'park':
|
||||
@@ -121,7 +123,8 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<ParkForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
initialData={data}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
isEditing
|
||||
/>
|
||||
);
|
||||
@@ -131,7 +134,8 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<RideForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
initialData={data}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
isEditing
|
||||
/>
|
||||
);
|
||||
@@ -141,7 +145,8 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<ManufacturerForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
initialData={data}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -150,7 +155,8 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<DesignerForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
initialData={data}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -159,7 +165,8 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<OperatorForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
initialData={data}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -168,25 +175,37 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<PropertyOwnerForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
initialData={data}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
/>
|
||||
);
|
||||
|
||||
case 'ride_model':
|
||||
const manufacturerName = 'manufacturer_name' in itemData && typeof itemData.manufacturer_name === 'string'
|
||||
? itemData.manufacturer_name
|
||||
: 'Unknown';
|
||||
const manufacturerId = 'manufacturer_id' in itemData && typeof itemData.manufacturer_id === 'string'
|
||||
? itemData.manufacturer_id
|
||||
: '';
|
||||
return (
|
||||
<RideModelForm
|
||||
manufacturerName={data.manufacturer_name || 'Unknown'}
|
||||
manufacturerId={data.manufacturer_id}
|
||||
manufacturerName={manufacturerName}
|
||||
manufacturerId={manufacturerId}
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
initialData={data}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
/>
|
||||
);
|
||||
|
||||
case 'photo':
|
||||
const photos = 'photos' in itemData && Array.isArray(itemData.photos)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
? itemData.photos as any
|
||||
: [];
|
||||
return (
|
||||
<PhotoEditForm
|
||||
photos={data.photos || []}
|
||||
photos={photos}
|
||||
onSubmit={handlePhotoSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
submitting={submitting}
|
||||
|
||||
Reference in New Issue
Block a user