diff --git a/frontend/app/compile/page.tsx b/frontend/app/compile/page.tsx index 1bcdb5c..8090378 100644 --- a/frontend/app/compile/page.tsx +++ b/frontend/app/compile/page.tsx @@ -1,9 +1,9 @@ "use client"; -import { useState, useEffect, Suspense } from "react"; +import { useState, useEffect, useRef, Suspense } from "react"; import { useSearchParams } from "next/navigation"; import Link from "next/link"; -import { ArrowRight, Loader2, Link as LinkIcon, FileText, AlertCircle } from "lucide-react"; +import { ArrowRight, Loader2, Link as LinkIcon, FileText, AlertCircle, CheckCircle } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { parseJobDescription, compileResume, type ParsedJD, type CompileResponse } from "@/lib/api"; @@ -17,16 +17,45 @@ function CompilePageContent() { const [isParsingJD, setIsParsingJD] = useState(false); const [parsedJD, setParsedJD] = useState(null); const [isCompiling, setIsCompiling] = useState(false); + const [compileStep, setCompileStep] = useState(0); const [compileResult, setCompileResult] = useState(null); const [error, setError] = useState(null); + const [isValidUrl, setIsValidUrl] = useState(true); + const stepTimerRef = useRef(null); - // Redirect if no master version useEffect(() => { if (!masterVersion) { // Could redirect to vault } }, [masterVersion]); + useEffect(() => { + if (isCompiling) { + setCompileStep(0); + stepTimerRef.current = setInterval(() => { + setCompileStep((prev) => (prev < 2 ? prev + 1 : prev)); + }, 3000); + } else { + if (stepTimerRef.current) { + clearInterval(stepTimerRef.current); + stepTimerRef.current = null; + } + setCompileStep(0); + } + return () => { + if (stepTimerRef.current) clearInterval(stepTimerRef.current); + }; + }, [isCompiling]); + + const handleUrlInputChange = (value: string) => { + setJdInput(value); + if (value.trim() === "") { + setIsValidUrl(true); + } else { + setIsValidUrl(/^https?:\/\/.+/.test(value.trim())); + } + }; + const handleParseJD = async () => { if (!jdInput.trim()) return; @@ -93,7 +122,7 @@ function CompilePageContent() { ← Back to Upload -

+

Add Job Description

@@ -126,11 +155,11 @@ function CompilePageContent() { {/* Input Mode Toggle */} -

+