import { useState } from "react"; import BoxContainer from "./components/BoxContainer"; import VideoWrapper from "@/components/VideoWrapper.tsx"; import ResultContainer from "@/components/ResultContainer.tsx"; import DarkVideoWrapper from "@/components/DarkVideoWrapper.tsx"; enum StepType { takeId, verifyId, takeFrontPic, verifyProfile, result, } const stepsArray: StepType[] = [ StepType.takeId, StepType.verifyId, StepType.takeFrontPic, StepType.verifyProfile, StepType.result, ]; export default function VerificationScene() { const [currentStep, setCurrentStep] = useState(StepType.takeId); const [idCardPicture, setIdCardPicture] = useState(); const [profilePicture, setProfilePicture] = useState(); const handleNextStep = () => { if (currentStep == StepType.result) return; setCurrentStep((currentStep + 1) % stepsArray.length); }; const handlePrevStep = () => { if (currentStep == StepType.takeId) return; setCurrentStep((currentStep - 1) % stepsArray.length); }; const sendImageToServer = async ( imageDataUrl: string, setLoading: (n: boolean) => void, ) => { try { const response = await fetch("http://localhost:8000/uploadpdf", { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ image: imageDataUrl }), }); if (!response.ok) { throw new Error("Erreur lors de l'envoi de l'image"); } const data = await response.json(); console.log("Image envoyée avec succès:", data); setLoading(false); } catch (error) { console.error("Erreur:", error); setLoading(false); } }; let stepContent = undefined; if (currentStep == StepType.takeId) { stepContent = ( <>

Take a picture of the Capture the front side of your ID Card

); } if (currentStep == StepType.verifyId) { stepContent = ( <>
captured

Is This Picture Correct ?

); } if (currentStep == StepType.takeFrontPic) { stepContent = ( <>

Center your face

); } if (currentStep == StepType.verifyProfile) { stepContent = ( <>
captured

Is This Picture Correct ?

); } if (currentStep == StepType.result) { stepContent = ( ); } return ( <>
{stepContent}
); }