mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 16:31:12 -05:00
Refactor: Implement type safety plan
This commit is contained in:
@@ -18,6 +18,7 @@ import { RideForm } from '@/components/admin/RideForm';
|
||||
import { ManufacturerForm } from '@/components/admin/ManufacturerForm';
|
||||
import { DesignerForm } from '@/components/admin/DesignerForm';
|
||||
import { OperatorForm } from '@/components/admin/OperatorForm';
|
||||
import { jsonToFormData } from '@/lib/typeConversions';
|
||||
import { PropertyOwnerForm } from '@/components/admin/PropertyOwnerForm';
|
||||
import { RideModelForm } from '@/components/admin/RideModelForm';
|
||||
import { Save, X, Edit } from 'lucide-react';
|
||||
@@ -129,8 +130,9 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<ParkForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
// Convert Json to form-compatible object (null → undefined)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
initialData={jsonToFormData(editItem.item_data) as any}
|
||||
isEditing
|
||||
/>
|
||||
);
|
||||
@@ -140,8 +142,9 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
<RideForm
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
// Convert Json to form-compatible object (null → undefined)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
initialData={jsonToFormData(editItem.item_data) as any}
|
||||
isEditing
|
||||
/>
|
||||
);
|
||||
@@ -152,7 +155,7 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
initialData={jsonToFormData(editItem.item_data) as any}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -162,7 +165,7 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
initialData={jsonToFormData(editItem.item_data) as any}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -172,7 +175,7 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
initialData={jsonToFormData(editItem.item_data) as any}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -182,7 +185,7 @@ export function ItemEditDialog({ item, items, open, onOpenChange, onComplete }:
|
||||
onSubmit={handleSubmit}
|
||||
onCancel={() => onOpenChange(false)}
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
initialData={itemData as any}
|
||||
initialData={jsonToFormData(editItem.item_data) as any}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export function SimilarRides({ currentRideId, parkId, parkSlug, category }: Simi
|
||||
.limit(4);
|
||||
|
||||
if (!error && data) {
|
||||
setRides(data as SimilarRide[]);
|
||||
setRides(data);
|
||||
}
|
||||
setLoading(false);
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export function SimilarRides({ currentRideId, parkId, parkSlug, category }: Simi
|
||||
{rides.map((ride) => (
|
||||
<RideCard
|
||||
key={ride.id}
|
||||
ride={ride as SimilarRide}
|
||||
ride={ride}
|
||||
showParkName={false}
|
||||
parkSlug={parkSlug}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user