1- import { useState } from 'react' ;
2- import { useAuth } from '../../contexts/AuthContext' ;
3- import { useNavigate , Link } from 'react-router-dom' ;
4- import { Button } from '../ui/button' ;
5- import { Input } from '../ui/input' ;
6- import { Label } from '../ui/label' ;
7- import { Alert , AlertDescription } from '../ui/alert' ;
8-
9- // Icons
10- const CodeIntelLogo = ( ) => (
11- < div className = "w-10 h-10 rounded-xl bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center" >
12- < span className = "text-white font-bold text-lg" > CI</ span >
13- </ div >
14- )
15-
16- const GitHubIcon = ( ) => (
17- < svg className = "w-5 h-5" fill = "currentColor" viewBox = "0 0 24 24" >
18- < path fillRule = "evenodd" d = "M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clipRule = "evenodd" />
19- </ svg >
20- )
21-
22- const SparklesIcon = ( ) => (
23- < svg className = "w-4 h-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
24- < path strokeLinecap = "round" strokeLinejoin = "round" strokeWidth = { 2 } d = "M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z" />
25- </ svg >
26- )
1+ import { useState } from 'react'
2+ import { useAuth } from '@/contexts/AuthContext'
3+ import { useNavigate , Link } from 'react-router-dom'
4+ import { Button } from '@/components/ui/button'
5+ import { Input } from '@/components/ui/input'
6+ import { Label } from '@/components/ui/label'
7+ import { Alert , AlertDescription } from '@/components/ui/alert'
8+ import { Navbar } from '@/components/landing'
9+ import { Github , Loader2 , Mail , Lock } from 'lucide-react'
2710
2811export function LoginForm ( ) {
29- const [ email , setEmail ] = useState ( '' ) ;
30- const [ password , setPassword ] = useState ( '' ) ;
31- const [ error , setError ] = useState ( '' ) ;
32- const [ loading , setLoading ] = useState ( false ) ;
33- const { signIn } = useAuth ( ) ;
34- const navigate = useNavigate ( ) ;
12+ const [ email , setEmail ] = useState ( '' )
13+ const [ password , setPassword ] = useState ( '' )
14+ const [ error , setError ] = useState ( '' )
15+ const [ loading , setLoading ] = useState ( false )
16+ const { signIn } = useAuth ( )
17+ const navigate = useNavigate ( )
3518
3619 const handleSubmit = async ( e : React . FormEvent ) => {
37- e . preventDefault ( ) ;
38- setError ( '' ) ;
39- setLoading ( true ) ;
20+ e . preventDefault ( )
21+ setError ( '' )
22+ setLoading ( true )
4023
4124 try {
42- await signIn ( email , password ) ;
43- navigate ( '/dashboard' ) ;
25+ await signIn ( email , password )
26+ navigate ( '/dashboard' )
4427 } catch ( err : any ) {
45- setError ( err . message || 'Login failed' ) ;
28+ setError ( err . message || 'Login failed' )
4629 } finally {
47- setLoading ( false ) ;
30+ setLoading ( false )
4831 }
49- } ;
32+ }
5033
5134 return (
52- < div className = "min-h-screen bg-[#09090b] flex flex-col" >
53- { /* Navigation */ }
54- < nav className = "border-b border-white/5 bg-[#09090b]/80 backdrop-blur-xl" >
55- < div className = "max-w-6xl mx-auto px-6 h-16 flex items-center justify-between" >
56- < Link to = "/" className = "flex items-center gap-3" >
57- < CodeIntelLogo />
58- < span className = "font-semibold text-white" > CodeIntel</ span >
59- </ Link >
60- < a
61- href = "https://github.com/opencodeintel/opencodeintel"
62- target = "_blank"
63- rel = "noopener noreferrer"
64- className = "text-gray-400 hover:text-white transition-colors"
65- >
66- < GitHubIcon />
67- </ a >
68- </ div >
69- </ nav >
35+ < div className = "min-h-screen bg-background flex flex-col" >
36+ < Navbar />
7037
71- { /* Main Content */ }
7238 < div className = "flex-1 flex items-center justify-center px-6 py-12" >
73- < div className = "w-full max-w-md" >
74- { /* Header */ }
39+ < div className = "w-full max-w-sm" >
7540 < div className = "text-center mb-8" >
76- < div className = "inline-flex items-center gap-2 px-3 py-1 rounded-full bg-blue-500/10 border border-blue-500/20 mb-6" >
77- < SparklesIcon />
78- < span className = "text-sm text-blue-400" > Welcome back</ span >
79- </ div >
80- < h1 className = "text-3xl font-bold text-white mb-2" >
41+ < h1 className = "text-2xl font-semibold text-foreground mb-2" >
8142 Sign in to CodeIntel
8243 </ h1 >
83- < p className = "text-gray-400 " >
84- Continue your AI-powered code exploration
44+ < p className = "text-sm text-muted-foreground " >
45+ Enter your credentials to continue
8546 </ p >
8647 </ div >
8748
88- { /* Login Card */ }
89- < div className = "relative" >
90- < div className = "absolute inset-0 bg-gradient-to-r from-blue-500/10 to-cyan-500/10 rounded-2xl blur-xl opacity-50" />
91- < div className = "relative bg-[#111113] rounded-2xl border border-white/10 p-8" >
92- < form onSubmit = { handleSubmit } className = "space-y-6" >
93- { error && (
94- < Alert variant = "destructive" className = "bg-red-500/10 border-red-500/20 text-red-400" >
95- < AlertDescription > { error } </ AlertDescription >
96- </ Alert >
97- ) }
49+ < div className = "bg-card rounded-lg border border-border p-6" >
50+ < form onSubmit = { handleSubmit } className = "space-y-4" >
51+ { error && (
52+ < Alert variant = "destructive" className = "bg-destructive/10 border-destructive/20" >
53+ < AlertDescription > { error } </ AlertDescription >
54+ </ Alert >
55+ ) }
9856
99- < div className = "space-y-2" >
100- < Label htmlFor = "email" className = "text-gray-300" > Email</ Label >
57+ < div className = "space-y-2" >
58+ < Label htmlFor = "email" > Email</ Label >
59+ < div className = "relative" >
60+ < Mail className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
10161 < Input
10262 id = "email"
10363 type = "email"
@@ -106,17 +66,23 @@ export function LoginForm() {
10666 onChange = { ( e ) => setEmail ( e . target . value ) }
10767 required
10868 disabled = { loading }
109- className = "bg-white/5 border-white/ 10 text-white placeholder:text-gray-500 focus:border-blue-500/50 focus:ring-blue-500/20 h-12 rounded-xl "
69+ className = "pl- 10 h-10 "
11070 />
11171 </ div >
72+ </ div >
11273
113- < div className = "space-y-2" >
114- < div className = "flex items-center justify-between" >
115- < Label htmlFor = "password" className = "text-gray-300" > Password</ Label >
116- < button type = "button" className = "text-sm text-blue-400 hover:text-blue-300 transition-colors" >
117- Forgot password?
118- </ button >
119- </ div >
74+ < div className = "space-y-2" >
75+ < div className = "flex items-center justify-between" >
76+ < Label htmlFor = "password" > Password</ Label >
77+ < button
78+ type = "button"
79+ className = "text-xs text-muted-foreground hover:text-foreground transition-colors"
80+ >
81+ Forgot password?
82+ </ button >
83+ </ div >
84+ < div className = "relative" >
85+ < Lock className = "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" />
12086 < Input
12187 id = "password"
12288 type = "password"
@@ -126,59 +92,56 @@ export function LoginForm() {
12692 required
12793 minLength = { 6 }
12894 disabled = { loading }
129- className = "bg-white/5 border-white/ 10 text-white placeholder:text-gray-500 focus:border-blue-500/50 focus:ring-blue-500/20 h-12 rounded-xl "
95+ className = "pl- 10 h-10 "
13096 />
13197 </ div >
132-
133- < Button
134- type = "submit"
135- disabled = { loading }
136- className = "w-full h-12 bg-gradient-to-r from-blue-500 to-blue-600 hover:from-blue-600 hover:to-blue-700 text-white font-medium rounded-xl transition-all disabled:opacity-50"
137- >
138- { loading ? (
139- < div className = "flex items-center gap-2" >
140- < div className = "w-4 h-4 border-2 border-white/30 border-t-white rounded-full animate-spin" />
141- < span > Signing in...</ span >
142- </ div >
143- ) : (
144- 'Sign in'
145- ) }
146- </ Button >
147- </ form >
148-
149- { /* Divider */ }
150- < div className = "relative my-6" >
151- < div className = "absolute inset-0 flex items-center" >
152- < div className = "w-full border-t border-white/10" > </ div >
153- </ div >
154- < div className = "relative flex justify-center text-sm" >
155- < span className = "px-4 bg-[#111113] text-gray-500" > or continue with</ span >
156- </ div >
15798 </ div >
15899
159- { /* Social Login */ }
160100 < Button
161- type = "button"
162- variant = "outline"
163- className = "w-full h-12 bg-white/5 border-white/10 text-white hover:bg-white/10 rounded-xl"
164- disabled
101+ type = "submit"
102+ disabled = { loading }
103+ className = "w-full h-10 bg-accent hover:bg-accent/90 text-white"
165104 >
166- < GitHubIcon />
167- < span className = "ml-2" > GitHub</ span >
168- < span className = "ml-2 text-xs text-gray-500" > (Coming soon)</ span >
105+ { loading ? (
106+ < span className = "flex items-center gap-2" >
107+ < Loader2 className = "w-4 h-4 animate-spin" />
108+ Signing in...
109+ </ span >
110+ ) : (
111+ 'Sign in'
112+ ) }
169113 </ Button >
114+ </ form >
115+
116+ < div className = "relative my-6" >
117+ < div className = "absolute inset-0 flex items-center" >
118+ < div className = "w-full border-t border-border" />
119+ </ div >
120+ < div className = "relative flex justify-center text-xs" >
121+ < span className = "px-2 bg-card text-muted-foreground" > or</ span >
122+ </ div >
170123 </ div >
124+
125+ < Button
126+ type = "button"
127+ variant = "outline"
128+ className = "w-full h-10"
129+ disabled
130+ >
131+ < Github className = "w-4 h-4 mr-2" />
132+ Continue with GitHub
133+ < span className = "ml-1 text-xs text-muted-foreground" > (Soon)</ span >
134+ </ Button >
171135 </ div >
172136
173- { /* Sign up link */ }
174- < p className = "text-center text-gray-400 mt-6" >
137+ < p className = "text-center text-sm text-muted-foreground mt-6" >
175138 Don't have an account?{ ' ' }
176- < Link to = "/signup" className = "text-blue-400 hover:text-blue-300 font-medium transition-colors " >
177- Sign up for free
139+ < Link to = "/signup" className = "text-accent hover:underline " >
140+ Sign up
178141 </ Link >
179142 </ p >
180143 </ div >
181144 </ div >
182145 </ div >
183- ) ;
146+ )
184147}
0 commit comments