22
33import { Field , FieldProps , Form , Formik } from 'formik' ;
44import { CircleAlert , Eye , EyeOff } from 'lucide-react' ;
5+ import { useLocale } from 'next-intl' ;
56import React , { useState } from 'react' ;
67import { object as YupObject , string as YupString } from 'yup' ;
78
@@ -22,7 +23,27 @@ const MAX_USERNAME_CHARS = 64;
2223const MIN_PASSWORD_CHARS = 4 ;
2324const MAX_PASSWORD_CHARS = 64 ;
2425
26+ const MOCK : { [ key : string ] : { loginHint : string ; username : string ; password : string } } = {
27+ en : {
28+ loginHint : 'To sign in to the demo, you can use the following credentials:' ,
29+ username : 'Username' ,
30+ password : 'Password' ,
31+ } ,
32+ de : {
33+ loginHint : 'Um sich beim Demo anzumelden, können Sie die folgenden Anmeldedaten verwenden:' ,
34+ username : 'Benutzername' ,
35+ password : 'Passwort' ,
36+ } ,
37+ pl : {
38+ loginHint : 'To sign in to the demo, you can use the following credentials:' ,
39+ username : 'Username' ,
40+ password : 'Password' ,
41+ } ,
42+ } ;
43+
2544export const SignInForm : React . FC < SignInFormProps > = ( { providers, labels, onSignIn } ) => {
45+ const locale = useLocale ( ) ;
46+
2647 const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
2748 const [ passwordVisible , setPasswordVisible ] = useState ( false ) ;
2849
@@ -60,11 +81,11 @@ export const SignInForm: React.FC<SignInFormProps> = ({ providers, labels, onSig
6081 </ div >
6182
6283 < Alert variant = "destructive" className = "flex flex-col gap-2" >
63- To sign in to the demo, you can use the following credentials:
84+ { ( MOCK [ locale ] || MOCK . en ) ! . loginHint }
6485 < Typography variant = "small" >
65- username: jane@example.com
86+ { ( MOCK [ locale ] || MOCK . en ) ! . username } : jane@example.com
6687 < br />
67- password: admin
88+ { ( MOCK [ locale ] || MOCK . en ) ! . password } : admin
6889 </ Typography >
6990 </ Alert >
7091
0 commit comments