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