Skip to content

Commit

Permalink
otp page updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sinanptm committed Aug 25, 2024
1 parent a11640b commit 9e709d7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 14 deletions.
15 changes: 15 additions & 0 deletions client/app/(patient)/signin/(.)otp-verification/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
'use client'
import { FormEvent } from "react";
import OtpVerificationModel from "@/components/models/OtpVerificationModel";

const OptInterceptor = () =>{
const handleVerify = (e:FormEvent)=>{
e.preventDefault();
};
const handleResend = ()=>{}
return (
<OtpVerificationModel returnRoute="/signin" key={12} timer={30} handleResend={handleResend} handleVerify={handleVerify} />
);
}

export default OptInterceptor;
9 changes: 9 additions & 0 deletions client/app/(patient)/signin/otp-verification/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const OtpVerificationPage = () => {
return (
<div>OtpVerificationPage</div>
)
}

export default OtpVerificationPage
4 changes: 2 additions & 2 deletions client/app/(patient)/signin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const SignIn = () => {
<p className="justify-items-end text-dark-600 xl:text-left">
© 2024 AVM Ayurveda&apos;s
</p>
<Link href={"/staff/login"} className="text-green-500">
Staff
<Link href={"/signin/otp-verification"} className="text-green-500">
OTP
</Link>
</div>
</div>
Expand Down
18 changes: 7 additions & 11 deletions client/components/models/OtpVerificationModel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import { Otptimer } from "otp-timer-ts";
import { OptModelProps } from "@/types/fromTypes";

const OtpVerificationModel = ({ returnRoute }: OptModelProps) => {
const OtpVerificationModel = ({ returnRoute,handleResend,handleVerify,timer }: OptModelProps) => {
const router = useRouter();
const [open, setOpen] = useState(true);
const [otp, setOtp] = useState("");
Expand All @@ -30,16 +30,11 @@ const OtpVerificationModel = ({ returnRoute }: OptModelProps) => {
router.push(returnRoute);
};

const handleResend = () => {
setOpen(false);
setTimeout(() => {
setOpen(true);
}, 1000);
};

return (
<AlertDialog open={open} onOpenChange={setOpen}>
<AlertDialogContent className="shad-alert-dialog">
<AlertDialog open={open} onOpenChange={setOpen} >
<form onSubmit={(e)=>handleVerify(e)}>
<AlertDialogContent className="shad-alert-dialog" >
<AlertDialogHeader>
<AlertDialogTitle className="flex items-start justify-between">
<p className="sub-header">OTP Verification</p>
Expand Down Expand Up @@ -78,14 +73,15 @@ const OtpVerificationModel = ({ returnRoute }: OptModelProps) => {
)}
</div>
<div>
<Otptimer minutes={0} seconds={30} onResend={handleResend} />
<Otptimer seconds={timer} onResend={handleResend} />
</div>
<AlertDialogFooter>
<AlertDialogAction className="shad-primary-btn w-full">
<AlertDialogAction type="submit" className="shad-primary-btn w-full">
Verify OTP
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</form>
</AlertDialog>
);
};
Expand Down
2 changes: 1 addition & 1 deletion client/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
}

.shad-alert-dialog {
@apply space-y-5 bg-dark-400 border-dark-500 outline-none !important;
@apply space-y-5 bg-dark-400 border-dark-500 outline-none backdrop-opacity-10 !important;
}

.shad-sheet-content button {
Expand Down
3 changes: 3 additions & 0 deletions client/types/fromTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,7 @@ export interface OtpFromProps {

export type OptModelProps = {
returnRoute:string;
timer:number;
handleResend:()=>void;
handleVerify:(e:FormEvent)=>void;
}

0 comments on commit 9e709d7

Please sign in to comment.