1+ "use client" 
2+ 
3+ 
4+ import  FormContainer  from  "../../common/uiLibrary/Layouters/formContainer" ; 
5+ import  TextField  from  "../../common/uiLibrary/forms/textField" ; 
6+ import  Button  from  "../../common/uiLibrary/Button" ; 
7+ import  ContactInformation  from  "../../(home)/contactInformation" ; 
8+ import  React  from  "react" ; 
9+ import  FullPage  from  "../../common/uiLibrary/Layouters/fullPage" ; 
10+ import  { useFormState }  from  "react-dom" ; 
11+ import  { postResendConfirmationMail ,  ResendConfirmationMailRequest }  from  "./actions" ; 
12+ 
13+ const  ResendConfirmationMail  =  ( )  =>  { 
14+     const  initialState : ResendConfirmationMailRequest  =  { 
15+         success : false , 
16+     } 
17+ 
18+     const  [ state ,  formAction ]  =  useFormState ( postResendConfirmationMail ,  initialState ) ; 
19+ 
20+     const  resendForm  =  ( )  =>  { 
21+         return  ( 
22+             < > 
23+                 { ! state . success  &&  state . error  &&  errorMessage ( ) } 
24+ 
25+                 < TextField 
26+                     id = 'email' 
27+                     name = 'email' 
28+                     label = 'Email' 
29+                     type = 'email' 
30+ 31+                     required 
32+                     shadow 
33+                 /> 
34+                 < Button  type = "submit"  className = "mt-4 w-full"  filled > Submit</ Button > 
35+             </ > 
36+         ) 
37+     } 
38+     const  errorMessage  =  ( )  =>  { 
39+         return  ( 
40+             < div  className = 'flex flex-col gap-4' > 
41+                 < h3  className = "text-lg text-center font-medium text-red-700" > Oops!</ h3 > 
42+                 < p > There was an unexpected error while trying to resend the confirmation email.</ p > 
43+                 < p > Please try again later or contact us.</ p > 
44+             </ div > 
45+         ) 
46+     } 
47+ 
48+     const  successMessage  =  ( )  =>  ( 
49+         < div  className = 'flex flex-col gap-4' > 
50+             < h3  className = "text-lg text-center font-medium text-green-800" > Success!</ h3 > 
51+             < p > Your request has been processed successfully. If your account is found in our system and the email
52+                 address you provided matches our records, we have sent a confirmation email to that address.</ p > 
53+             < p > Please check your inbox for the confirmation email. If you don't receive it within a few minutes, check
54+                 your spam or junk folder. For further assistance, don't hesitate to contact us.</ p > 
55+         </ div > 
56+     ) ; 
57+ 
58+     return  ( 
59+         < FullPage > 
60+             < div  className = 'flex-grow' > 
61+                 < FormContainer  action = { formAction }  title = 'Resend password confirmation' > 
62+                     { state . success  ? successMessage ( )  : resendForm ( ) } 
63+                 </ FormContainer > 
64+             </ div > 
65+             < ContactInformation /> 
66+         </ FullPage > 
67+     ) 
68+ } ; 
69+ 
70+ export  default  ResendConfirmationMail ; 
0 commit comments