import { Container, TextInput, SelectInput, MultiSelectInput } from '@ifrc-go/ui'; import styles from '../../pages/UploadPage/UploadPage.module.css'; interface MetadataFormSectionProps { files: File[]; imageType: string; title: string; source: string; eventType: string; epsg: string; countries: string[]; centerLon: string; centerLat: string; amslM: string; aglM: string; headingDeg: string; yawDeg: string; pitchDeg: string; rollDeg: string; rtkFix: boolean; stdHM: string; stdVM: string; metadataArray: Array<{ source: string; eventType: string; epsg: string; countries: string[]; centerLon: string; centerLat: string; amslM: string; aglM: string; headingDeg: string; yawDeg: string; pitchDeg: string; rollDeg: string; rtkFix: boolean; stdHM: string; stdVM: string; }>; sources: {s_code: string, label: string}[]; types: {t_code: string, label: string}[]; spatialReferences: {epsg: string, srid: string, proj4: string, wkt: string}[]; imageTypes: {image_type: string, label: string}[]; countriesOptions: {c_code: string, label: string, r_code: string}[]; onTitleChange: (value: string | undefined) => void; onSourceChange: (value: string | undefined) => void; onEventTypeChange: (value: string | undefined) => void; onEpsgChange: (value: string | undefined) => void; onCountriesChange: (value: string[] | undefined) => void; onCenterLonChange: (value: string | undefined) => void; onCenterLatChange: (value: string | undefined) => void; onAmslMChange: (value: string | undefined) => void; onAglMChange: (value: string | undefined) => void; onHeadingDegChange: (value: string | undefined) => void; onYawDegChange: (value: string | undefined) => void; onPitchDegChange: (value: string | undefined) => void; onRollDegChange: (value: string | undefined) => void; onRtkFixChange: (value: boolean | undefined) => void; onStdHMChange: (value: string | undefined) => void; onStdVMChange: (value: string | undefined) => void; onImageTypeChange: (value: string | undefined) => void; updateMetadataForImage: (index: number, field: string, value: string | string[] | boolean | undefined) => void; } export default function MetadataFormSection({ files, imageType, title, source, eventType, epsg, countries, centerLon, centerLat, amslM, aglM, headingDeg, yawDeg, pitchDeg, rollDeg, rtkFix, stdHM, stdVM, metadataArray, sources, types, spatialReferences, imageTypes, countriesOptions, onTitleChange, onSourceChange, onEventTypeChange, onEpsgChange, onCountriesChange, onCenterLonChange, onCenterLatChange, onAmslMChange, onAglMChange, onHeadingDegChange, onYawDegChange, onPitchDegChange, onRollDegChange, onRtkFixChange, onStdHMChange, onStdVMChange, onImageTypeChange, updateMetadataForImage, }: MetadataFormSectionProps) { if (files.length > 1) { return (
{files.map((file, index) => (
{imageType !== 'drone_image' && ( updateMetadataForImage(index, 'source', value)} options={sources} keySelector={(o) => o.s_code} labelSelector={(o) => o.label} required /> )} updateMetadataForImage(index, 'eventType', value)} options={types} keySelector={(o) => o.t_code} labelSelector={(o) => o.label} required={imageType !== 'drone_image'} /> updateMetadataForImage(index, 'epsg', value)} options={spatialReferences} keySelector={(o) => o.epsg} labelSelector={(o) => `${o.srid} (EPSG:${o.epsg})`} placeholder="EPSG" required={imageType !== 'drone_image'} /> updateMetadataForImage(index, 'countries', value)} options={countriesOptions} keySelector={(o) => o.c_code} labelSelector={(o) => o.label} placeholder="Select one or more" /> {imageType === 'drone_image' && ( <>

Drone Flight Data

updateMetadataForImage(index, 'centerLon', value)} placeholder="e.g., -122.4194" step="any" /> updateMetadataForImage(index, 'centerLat', value)} placeholder="e.g., 37.7749" step="any" /> updateMetadataForImage(index, 'amslM', value)} placeholder="e.g., 100.5" step="any" /> updateMetadataForImage(index, 'aglM', value)} placeholder="e.g., 50.2" step="any" /> updateMetadataForImage(index, 'headingDeg', value)} placeholder="e.g., 180.0" step="any" /> updateMetadataForImage(index, 'yawDeg', value)} placeholder="e.g., 90.0" step="any" /> updateMetadataForImage(index, 'pitchDeg', value)} placeholder="e.g., 0.0" step="any" /> updateMetadataForImage(index, 'rollDeg', value)} placeholder="e.g., 0.0" step="any" />
updateMetadataForImage(index, 'stdHM', value)} placeholder="e.g., 0.1" step="any" /> updateMetadataForImage(index, 'stdVM', value)} placeholder="e.g., 0.2" step="any" />
)}
))}
); } return (
{imageType !== 'drone_image' && ( o.s_code} labelSelector={(o) => o.label} required /> )} o.t_code} labelSelector={(o) => o.label} required={imageType !== 'drone_image'} /> o.epsg} labelSelector={(o) => `${o.srid} (EPSG:${o.epsg})`} placeholder="EPSG" required={imageType !== 'drone_image'} /> o.image_type} labelSelector={(o) => o.label} required /> o.c_code} labelSelector={(o) => o.label} placeholder="Select one or more" /> {imageType === 'drone_image' && ( <>

Drone Flight Data

)}
); }