Fix: Display temp location data

This commit is contained in:
gpt-engineer-app[bot]
2025-11-06 04:37:48 +00:00
parent c8a015a15b
commit 93e8e98957
2 changed files with 9 additions and 2 deletions

View File

@@ -21,7 +21,7 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
if (!data) return; if (!data) return;
const fetchRelatedData = async () => { const fetchRelatedData = async () => {
// Fetch location // Fetch location if location_id exists (for edits)
if (data.location_id) { if (data.location_id) {
const { data: locationData } = await supabase const { data: locationData } = await supabase
.from('locations') .from('locations')
@@ -30,6 +30,10 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
.single(); .single();
setLocation(locationData); setLocation(locationData);
} }
// Otherwise use temp_location_data (for new submissions)
else if (data.temp_location_data) {
setLocation(data.temp_location_data);
}
// Fetch operator // Fetch operator
if (data.operator_id) { if (data.operator_id) {
@@ -53,7 +57,7 @@ export function RichParkDisplay({ data, actionType, showAllFields = true }: Rich
}; };
fetchRelatedData(); 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) => { const getStatusColor = (status: string | undefined) => {
if (!status) return 'bg-gray-500'; if (!status) return 'bg-gray-500';

View File

@@ -3,6 +3,8 @@
* These replace the `any` types in entityTransformers.ts * These replace the `any` types in entityTransformers.ts
*/ */
import type { LocationData } from './location';
export interface ParkSubmissionData { export interface ParkSubmissionData {
name: string; name: string;
slug: string; slug: string;
@@ -19,6 +21,7 @@ export interface ParkSubmissionData {
operator_id?: string | null; operator_id?: string | null;
property_owner_id?: string | null; property_owner_id?: string | null;
location_id?: string | null; location_id?: string | null;
temp_location_data?: LocationData | null;
banner_image_url?: string | null; banner_image_url?: string | null;
banner_image_id?: string | null; banner_image_id?: string | null;
card_image_url?: string | null; card_image_url?: string | null;