chore: make required GPS field

This commit is contained in:
2026-06-12 13:19:11 +05:30
parent c43f41d98a
commit 05c5f09cc5

View File

@@ -68,6 +68,11 @@ export default function UploadPage() {
return; return;
} }
if (!jsonFile) {
setError('Please select a GPS JSON file');
return;
}
if (!session) { if (!session) {
setError('Please complete the project selection first'); setError('Please complete the project selection first');
return; return;
@@ -77,10 +82,7 @@ export default function UploadPage() {
formData.append('file', file); formData.append('file', file);
formData.append('detection_mode', selectMethod); formData.append('detection_mode', selectMethod);
formData.append('chainage_id', session.chainageId as string); formData.append('chainage_id', session.chainageId as string);
formData.append('json_file', jsonFile);
if (jsonFile) {
formData.append('json_file', jsonFile);
}
setUploading(true); setUploading(true);
setError(null); setError(null);
@@ -120,7 +122,7 @@ export default function UploadPage() {
} }
const isSessionComplete = !!(session && sessionService.isSessionValid(session)); const isSessionComplete = !!(session && sessionService.isSessionValid(session));
const isFormValid = isSessionComplete && file; const isFormValid = isSessionComplete && file && jsonFile;
return ( return (
<div className="min-h-screen pb-12"> <div className="min-h-screen pb-12">
@@ -162,7 +164,7 @@ export default function UploadPage() {
2. Upload Video Data 2. Upload Video Data
</CardTitle> </CardTitle>
<CardDescription> <CardDescription>
Provide the video file and optional GPS telemetry for processing. Provide the video file and GPS telemetry for processing.
</CardDescription> </CardDescription>
</CardHeader> </CardHeader>
<CardContent className="space-y-6"> <CardContent className="space-y-6">
@@ -191,7 +193,7 @@ export default function UploadPage() {
{/* JSON File Input */} {/* JSON File Input */}
<div className="space-y-2"> <div className="space-y-2">
<Label htmlFor="json-file" className="text-sm font-semibold"> <Label htmlFor="json-file" className="text-sm font-semibold">
GPS JSON File (Optional) GPS JSON File <span className="text-destructive">*</span>
</Label> </Label>
<Input <Input
id="json-file" id="json-file"
@@ -202,7 +204,8 @@ export default function UploadPage() {
setError(null); setError(null);
}} }}
disabled={uploading || !isSessionComplete} disabled={uploading || !isSessionComplete}
className="h-11 bg-muted/20 file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:bg-primary/10 file:text-primary file:font-medium file:text-xs" required
className="h-11 bg-muted/30 file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:bg-primary/10 file:text-primary file:font-medium file:text-xs"
/> />
</div> </div>