chore: update eslint and prettier configuration
This commit is contained in:
@@ -2,7 +2,13 @@
|
||||
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
@@ -49,17 +55,20 @@ export default function UploadPage() {
|
||||
|
||||
// Load session on mount
|
||||
useEffect(() => {
|
||||
// We don't load session on mount for the upload page to ensure
|
||||
// We don't load session on mount for the upload page to ensure
|
||||
// project details are filled manually as requested.
|
||||
setIsLoading(false);
|
||||
}, []);
|
||||
|
||||
const handleSelectionChange = useCallback((selectedSession: SessionContext | null) => {
|
||||
setSession(selectedSession);
|
||||
if (selectedSession) {
|
||||
sessionService.saveSession(selectedSession);
|
||||
}
|
||||
}, []);
|
||||
const handleSelectionChange = useCallback(
|
||||
(selectedSession: SessionContext | null) => {
|
||||
setSession(selectedSession);
|
||||
if (selectedSession) {
|
||||
sessionService.saveSession(selectedSession);
|
||||
}
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const handleUpload = async () => {
|
||||
if (!file) {
|
||||
@@ -103,7 +112,8 @@ export default function UploadPage() {
|
||||
} catch (err) {
|
||||
let errorMessage = 'Upload failed';
|
||||
if (err instanceof TypeError && err.message === 'Failed to fetch') {
|
||||
errorMessage = 'Cannot connect to server. Please check if backend is running.';
|
||||
errorMessage =
|
||||
'Cannot connect to server. Please check if backend is running.';
|
||||
} else if (err instanceof Error) {
|
||||
errorMessage = err.message;
|
||||
}
|
||||
@@ -120,7 +130,9 @@ export default function UploadPage() {
|
||||
);
|
||||
}
|
||||
|
||||
const isSessionComplete = !!(session && sessionService.isSessionValid(session));
|
||||
const isSessionComplete = !!(
|
||||
session && sessionService.isSessionValid(session)
|
||||
);
|
||||
const isFormValid = isSessionComplete && file && jsonFile;
|
||||
|
||||
return (
|
||||
@@ -140,14 +152,16 @@ export default function UploadPage() {
|
||||
<Reveal direction="up" delay={0.1}>
|
||||
<Card className="border">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-xl font-bold">1. Project Details</CardTitle>
|
||||
<CardTitle className="text-xl font-bold">
|
||||
1. Project Details
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
Select the target project, package, and segment.
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ProjectSelectionSection
|
||||
onSelectionChange={handleSelectionChange}
|
||||
<ProjectSelectionSection
|
||||
onSelectionChange={handleSelectionChange}
|
||||
asStep={true}
|
||||
hideButton={true}
|
||||
/>
|
||||
@@ -157,7 +171,13 @@ export default function UploadPage() {
|
||||
|
||||
{/* Module 2: Upload Data */}
|
||||
<Reveal direction="up" delay={0.2}>
|
||||
<Card className={cn("border transition-all duration-300", !isSessionComplete && "opacity-60 pointer-events-none grayscale-[0.5]")}>
|
||||
<Card
|
||||
className={cn(
|
||||
'border transition-all duration-300',
|
||||
!isSessionComplete &&
|
||||
'opacity-60 pointer-events-none grayscale-[0.5]',
|
||||
)}
|
||||
>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-xl font-bold flex items-center gap-2">
|
||||
2. Upload Video Data
|
||||
@@ -170,7 +190,10 @@ export default function UploadPage() {
|
||||
<div className="grid grid-cols-1 gap-6 text-sm">
|
||||
{/* Video File Input */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="video-file" className="text-sm font-semibold">
|
||||
<Label
|
||||
htmlFor="video-file"
|
||||
className="text-sm font-semibold"
|
||||
>
|
||||
Video File <span className="text-destructive">*</span>
|
||||
</Label>
|
||||
<div className="relative group">
|
||||
@@ -191,8 +214,12 @@ export default function UploadPage() {
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
||||
{/* JSON File Input */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="json-file" className="text-sm font-semibold">
|
||||
GPS JSON File <span className="text-destructive">*</span>
|
||||
<Label
|
||||
htmlFor="json-file"
|
||||
className="text-sm font-semibold"
|
||||
>
|
||||
GPS JSON File{' '}
|
||||
<span className="text-destructive">*</span>
|
||||
</Label>
|
||||
<Input
|
||||
id="json-file"
|
||||
@@ -210,7 +237,10 @@ export default function UploadPage() {
|
||||
|
||||
{/* Select Method */}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="select-method" className="text-sm font-semibold">
|
||||
<Label
|
||||
htmlFor="select-method"
|
||||
className="text-sm font-semibold"
|
||||
>
|
||||
Analysis Method
|
||||
</Label>
|
||||
<Select
|
||||
@@ -218,7 +248,10 @@ export default function UploadPage() {
|
||||
onValueChange={setSelectMethod}
|
||||
disabled={uploading || !isSessionComplete}
|
||||
>
|
||||
<SelectTrigger id="select-method" className="h-11 bg-muted/20">
|
||||
<SelectTrigger
|
||||
id="select-method"
|
||||
className="h-11 bg-muted/20"
|
||||
>
|
||||
<SelectValue placeholder="Select method" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
|
||||
Reference in New Issue
Block a user