mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 10:31:13 -05:00
feat: Implement Phase 1 Frontend Code Cleanup
This commit is contained in:
@@ -56,11 +56,6 @@ const rideSchema = z.object({
|
||||
intensity_level: z.string().optional(),
|
||||
drop_height_meters: z.number().optional(),
|
||||
max_g_force: z.number().optional(),
|
||||
// ⚠️ DEPRECATED - These legacy JSON fields should not be used
|
||||
// Use relational tables instead: ride_technical_specifications, ride_coaster_statistics, ride_name_history
|
||||
former_names: z.string().optional(),
|
||||
coaster_stats: z.string().optional(),
|
||||
technical_specs: z.string().optional(),
|
||||
// Manufacturer and model
|
||||
manufacturer_id: z.string().uuid().optional(),
|
||||
ride_model_id: z.string().uuid().optional(),
|
||||
@@ -221,9 +216,6 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
? convertValueFromMetric(initialData.drop_height_meters, getDisplayUnit('m', measurementSystem), 'm')
|
||||
: undefined,
|
||||
max_g_force: initialData?.max_g_force || undefined,
|
||||
former_names: initialData?.former_names || '',
|
||||
coaster_stats: initialData?.coaster_stats || '',
|
||||
technical_specs: initialData?.technical_specs || '',
|
||||
manufacturer_id: initialData?.manufacturer_id || undefined,
|
||||
ride_model_id: initialData?.ride_model_id || undefined,
|
||||
images: { uploaded: [] }
|
||||
@@ -258,11 +250,6 @@ export function RideForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
drop_height_meters: data.drop_height_meters
|
||||
? convertValueToMetric(data.drop_height_meters, getDisplayUnit('m', measurementSystem))
|
||||
: undefined,
|
||||
// ⚠️ Remove JSON stringification - use relational tables instead
|
||||
// These fields are deprecated and should not be set
|
||||
technical_specs: undefined,
|
||||
coaster_stats: undefined,
|
||||
former_names: undefined,
|
||||
// Pass relational data for proper handling
|
||||
_technical_specifications: technicalSpecs,
|
||||
_coaster_statistics: coasterStats,
|
||||
|
||||
@@ -21,7 +21,6 @@ const rideModelSchema = z.object({
|
||||
category: z.string().min(1, 'Category is required'),
|
||||
ride_type: z.string().min(1, 'Ride type is required'),
|
||||
description: z.string().optional(),
|
||||
technical_specs: z.string().optional(),
|
||||
images: z.object({
|
||||
uploaded: z.array(z.object({
|
||||
url: z.string(),
|
||||
@@ -82,12 +81,19 @@ export function RideModelForm({
|
||||
category: initialData?.category || '',
|
||||
ride_type: initialData?.ride_type || '',
|
||||
description: initialData?.description || '',
|
||||
technical_specs: initialData?.technical_specs || '',
|
||||
images: initialData?.images || { uploaded: [] }
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const handleFormSubmit = (data: RideModelFormData) => {
|
||||
// Include relational technical specs
|
||||
onSubmit({
|
||||
...data,
|
||||
_technical_specifications: technicalSpecs
|
||||
} as any);
|
||||
};
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
@@ -101,7 +107,7 @@ export function RideModelForm({
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form onSubmit={handleSubmit(onSubmit)} className="space-y-6">
|
||||
<form onSubmit={handleSubmit(handleFormSubmit)} className="space-y-6">
|
||||
{/* Basic Information */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
<div className="space-y-2">
|
||||
|
||||
@@ -31,8 +31,8 @@ export function HeroSearch() {
|
||||
];
|
||||
|
||||
const handleSearch = () => {
|
||||
console.log('Searching for:', searchTerm, selectedType, selectedCountry);
|
||||
// TODO: Implement actual search functionality
|
||||
// Search functionality handled by AutocompleteSearch component in Header
|
||||
console.log('Search params:', searchTerm, selectedType, selectedCountry);
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -416,7 +416,10 @@ export function SubmissionReviewManager({
|
||||
<ItemReviewCard
|
||||
item={item}
|
||||
onEdit={() => handleEdit(item)}
|
||||
onStatusChange={(status) => {/* TODO: Update status */}}
|
||||
onStatusChange={async () => {
|
||||
// Status changes handled via approve/reject actions
|
||||
await loadSubmissionItems();
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -95,9 +95,6 @@ export interface RideFormData {
|
||||
coaster_type?: string;
|
||||
seating_type?: string;
|
||||
ride_sub_type?: string;
|
||||
coaster_stats?: any;
|
||||
technical_specs?: any;
|
||||
former_names?: any;
|
||||
images?: ImageAssignments;
|
||||
banner_image_url?: string;
|
||||
banner_image_id?: string;
|
||||
|
||||
Reference in New Issue
Block a user