1
- import { useEffect , useState } from " react" ;
2
- import { Lock , MagicWand , WarningOctagon } from " @phosphor-icons/react" ;
3
- import { Button } from " @components/Button" ;
4
- import { TextInput } from " @components/TextInput" ;
5
- import { supabase } from " @backend/supabaseBrowserClient" ;
6
- import type { Translations } from " src/Types" ;
7
- import { isValidEmail } from " ../validation" ;
1
+ import { useEffect , useState } from ' react' ;
2
+ import { Lock , MagicWand , WarningOctagon } from ' @phosphor-icons/react' ;
3
+ import { Button } from ' @components/Button' ;
4
+ import { TextInput } from ' @components/TextInput' ;
5
+ import { supabase } from ' @backend/supabaseBrowserClient' ;
6
+ import type { Translations } from ' src/Types' ;
7
+ import { isValidEmail } from ' ../validation' ;
8
8
9
9
export interface StateSignInFormProps {
10
10
i18n : Translations ;
@@ -17,44 +17,44 @@ export interface StateSignInFormProps {
17
17
export const StateLoginForm = ( props : StateSignInFormProps ) => {
18
18
const { t } = props . i18n ;
19
19
20
- const [ email , setEmail ] = useState ( "" ) ;
20
+ const [ email , setEmail ] = useState ( '' ) ;
21
21
22
22
const [ loading , setLoading ] = useState ( false ) ;
23
23
24
- const [ password , setPassword ] = useState ( "" ) ;
24
+ const [ password , setPassword ] = useState ( '' ) ;
25
25
26
- const [ error , setError ] = useState ( "" ) ;
26
+ const [ error , setError ] = useState ( '' ) ;
27
27
28
28
const onSignIn = ( evt : React . MouseEvent ) => {
29
29
evt . preventDefault ( ) ;
30
30
31
31
setLoading ( true ) ;
32
32
33
33
if ( ! isValidEmail ( email ) ) {
34
- setError ( t [ " Please enter a valid email address" ] ) ;
34
+ setError ( t [ ' Please enter a valid email address' ] ) ;
35
35
} else {
36
- setError ( "" ) ;
36
+ setError ( '' ) ;
37
37
38
38
supabase . auth
39
39
. signInWithPassword ( {
40
40
email,
41
41
password,
42
42
} )
43
43
. then ( ( { error } ) => {
44
- if ( error ) setError ( t [ " Invalid email or password" ] ) ;
44
+ if ( error ) setError ( t [ ' Invalid email or password' ] ) ;
45
45
} ) ;
46
46
}
47
47
} ;
48
48
49
49
useEffect ( ( ) => {
50
- document . getElementById ( " email" ) ?. focus ( ) ;
50
+ document . getElementById ( ' email' ) ?. focus ( ) ;
51
51
} , [ ] ) ;
52
52
53
53
return (
54
54
< div className = 'login' >
55
55
< main >
56
- < h1 > { t [ " Welcome Back" ] } </ h1 >
57
- < p > { t [ " Log into your account" ] } </ p >
56
+ < h1 > { t [ ' Welcome Back' ] } </ h1 >
57
+ < p > { t [ ' Log into your account' ] } </ p >
58
58
59
59
< div className = 'login-email' >
60
60
< form >
@@ -63,7 +63,7 @@ export const StateLoginForm = (props: StateSignInFormProps) => {
63
63
error = { Boolean ( error ) }
64
64
id = 'email'
65
65
name = 'email'
66
- label = { t [ " Email" ] }
66
+ label = { t [ ' Email' ] }
67
67
className = 'lg w-full'
68
68
onChange = { setEmail }
69
69
/>
@@ -72,7 +72,7 @@ export const StateLoginForm = (props: StateSignInFormProps) => {
72
72
autoComplete = { false }
73
73
id = 'password'
74
74
name = 'password'
75
- label = { t [ " Password" ] }
75
+ label = { t [ ' Password' ] }
76
76
type = 'password'
77
77
className = 'lg w-full'
78
78
onChange = { setPassword }
@@ -84,7 +84,7 @@ export const StateLoginForm = (props: StateSignInFormProps) => {
84
84
className = 'icon text-bottom'
85
85
size = { 18 }
86
86
weight = 'fill'
87
- /> { " " }
87
+ /> { ' ' }
88
88
{ error }
89
89
</ p >
90
90
) }
@@ -94,21 +94,21 @@ export const StateLoginForm = (props: StateSignInFormProps) => {
94
94
busy = { loading }
95
95
onClick = { onSignIn }
96
96
>
97
- < span > { t [ " Sign In" ] } </ span >
97
+ < span > { t [ ' Sign In' ] } </ span >
98
98
</ Button >
99
99
</ form >
100
100
101
101
< div className = 'forgot-password' >
102
102
< a href = { `/${ props . i18n . lang } /forgot-password` } >
103
- { t [ " Forgot password?" ] }
103
+ { t [ ' Forgot password?' ] }
104
104
</ a >
105
105
</ div >
106
106
</ div >
107
107
</ main >
108
108
109
109
< footer >
110
110
< p >
111
- { t [ "Don't have an account?" ] } < a href = '#' > { t [ " Sign up now." ] } </ a >
111
+ { t [ "Don't have an account?" ] } < a href = '#' > { t [ ' Sign up now.' ] } </ a >
112
112
</ p >
113
113
</ footer >
114
114
</ div >
0 commit comments