"use client"; import { useRef, useState } from "react"; import { Button } from "@mui/material"; import OTPForm from "../element/OTPForm"; import EditLogin from "../../icons/EditLogin"; import ArrowRightS from "../../icons/ArrowRightS"; import Recode from "./Recode"; import SendReq from "./SendReq"; function VerificationPage({ setIsSendMsg, uuid, link, setUuid, num, setStep }) { const retryIcon = useRef(); const [timer, setTimer] = useState(0); const [loading, setLoading] = useState(false); const [code, setCode] = useState(["", "", "", "", ""]); const [isError, setIsError] = useState(false); const inputRefs = Array.from({ length: 5 }, () => useRef()); const handleChange = (index, val) => { const newCode = [...code]; if (val === "backspace") { newCode[index] = ""; setCode(newCode); if (index > 0) { inputRefs[index - 1].current?.focus(); } return; } newCode[index] = val; if (newCode.join("").length === 5 && isError) { setIsError(false); } setCode(newCode); if (val && index < inputRefs.length - 1) { inputRefs[index + 1].current?.focus(); } }; return (
کد تایید را وارد نمایید
کد تایید برای شماره 09{num} ارسال شد.
!کد را وارد کنید