diff --git a/apps/web-ui/src/app/components/EvaluateForm.tsx b/apps/web-ui/src/app/components/EvaluateForm.tsx new file mode 100644 index 0000000..1b4c959 --- /dev/null +++ b/apps/web-ui/src/app/components/EvaluateForm.tsx @@ -0,0 +1,99 @@ +"use client"; + +import { useState } from "react"; +import { useRouter } from "next/navigation"; +import { evaluate } from "@cv-builder/core"; +import { TextStats } from "./TextStats"; +import { saveEvaluationResult } from "../lib/evaluation-storage"; +import { FileUpload } from "./FileUpload"; + +export function EvaluateForm() { + const router = useRouter(); + + const [cv, setCv] = useState(""); + const [jd, setJd] = useState(""); + const [loading, setLoading] = useState(false); + + async function handleEvaluate() { + if (!cv.trim()) { + alert("Please paste your CV."); + return; + } + + + setLoading(true); + + try { + const result = await evaluate({ + cv: { + content: cv, + format: "plaintext", + }, + jd: { + content: jd, + }, + }); + + saveEvaluationResult(result); + + router.push("/results"); + } catch (error) { + console.error(error); + alert("Evaluation failed."); + } finally { + setLoading(false); + } + } + + return ( +
+
+
+ + +