mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 17:11:12 -05:00
Fix: Display temp location data
This commit is contained in:
@@ -21,7 +21,7 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
||||
if (!data) return;
|
||||
|
||||
const fetchRelatedData = async () => {
|
||||
// Fetch location
|
||||
// Fetch location if location_id exists (for edits)
|
||||
if (data.location_id) {
|
||||
const { data: locationData } = await supabase
|
||||
.from('locations')
|
||||
@@ -30,6 +30,10 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
||||
.single();
|
||||
setLocation(locationData);
|
||||
}
|
||||
// Otherwise use temp_location_data (for new submissions)
|
||||
else if (data.temp_location_data) {
|
||||
setLocation(data.temp_location_data);
|
||||
}
|
||||
|
||||
// Fetch operator
|
||||
if (data.operator_id) {
|
||||
@@ -53,7 +57,7 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
|
||||
};
|
||||
|
||||
fetchRelatedData();
|
||||
}, [data.location_id, data.operator_id, data.property_owner_id]);
|
||||
}, [data.location_id, data.temp_location_data, data.operator_id, data.property_owner_id]);
|
||||
|
||||
const getStatusColor = (status: string | undefined) => {
|
||||
if (!status) return 'bg-gray-500';
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* These replace the `any` types in entityTransformers.ts
|
||||
*/
|
||||
|
||||
import type { LocationData } from './location';
|
||||
|
||||
export interface ParkSubmissionData {
|
||||
name: string;
|
||||
slug: string;
|
||||
@@ -19,6 +21,7 @@ export interface ParkSubmissionData {
|
||||
operator_id?: string | null;
|
||||
property_owner_id?: string | null;
|
||||
location_id?: string | null;
|
||||
temp_location_data?: LocationData | null;
|
||||
banner_image_url?: string | null;
|
||||
banner_image_id?: string | null;
|
||||
card_image_url?: string | null;
|
||||
|
||||
Reference in New Issue
Block a user