generated from kir-dev/next-nest-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Login page 4 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Login page 4 #13
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d0fba6a
proba1
pem00 f1545de
m
pem00 3003f09
login page #4
pem00 c526402
Delete .env
pem00 d0fb63e
jav
pem00 745ff43
jav2
pem00 820725f
Merge branch 'login-page-4' of https://github.com/kir-dev/chatbot int…
pem00 781b9cf
megint egy jav
pem00 f3b2b2a
Merge branch 'main' into login-page-4
pem00 3832e1c
checks
pem00 0007ea1
Merge branch 'login-page-4' of https://github.com/kir-dev/chatbot int…
pem00 6964760
Delete bash.exe.stackdump
pem00 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,5 @@ yarn-error.log* | |
.yarn | ||
|
||
/generated/prisma | ||
|
||
/generated/prisma |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,70 @@ | ||
export default function Home() { | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
|
||
export default function LoginPage() { | ||
const [username, setUsername] = useState(''); | ||
const [isFocused, setIsFocused] = useState(false); | ||
|
||
const handleLogin = () => { | ||
if (!username.trim()) { | ||
alert('Please enter a username'); | ||
return; | ||
} | ||
|
||
fetch(`http://localhost:3001/user/login?username=${encodeURIComponent(username)}`) | ||
.then((response) => { | ||
if (response.ok) { | ||
return response.json(); | ||
} | ||
throw new Error('Login failed'); | ||
}) | ||
.then(() => { | ||
window.location.href = `/chat?username=${encodeURIComponent(username)}`; | ||
}) | ||
.catch((error) => { | ||
console.error('Error:', error); | ||
alert('Login failed: ' + error.message); | ||
}); | ||
}; | ||
|
||
return ( | ||
<div className='flex items-center justify-center h-screen my-auto'> | ||
<a href='/chat' className='p-12 bg-black rounded-xl text-5xl'> | ||
Login | ||
</a> | ||
<div className='flex items-center justify-center min-h-screen bg-gradient-to-br from-gray-900 to-black'> | ||
<div className='relative bg-gray-800/50 p-8 rounded-2xl w-full max-w-md backdrop-blur-sm border border-gray-700 shadow-2xl transition-all duration-300 hover:shadow-emerald-500/10'> | ||
<div className='absolute -inset-1 rounded-2xl bg-gradient-to-r from-green-400 to-emerald-600 opacity-20 blur-sm transition-all duration-500' /> | ||
<div className='relative z-10 space-y-6'> | ||
<div className='text-center'> | ||
<h1 className='text-3xl font-bold text-transparent bg-clip-text bg-gradient-to-r from-green-400 to-emerald-600 mb-2'> | ||
Welcome | ||
</h1> | ||
<p className='text-gray-400'>Enter your username to continue</p> | ||
</div> | ||
|
||
<div> | ||
<label htmlFor='username' className='block text-sm font-medium text-gray-300 mb-2'> | ||
Username | ||
</label> | ||
<input | ||
type='text' | ||
id='username' | ||
value={username} | ||
onChange={(e) => setUsername(e.target.value)} | ||
onFocus={() => setIsFocused(true)} | ||
onBlur={() => setIsFocused(false)} | ||
className={`w-full px-4 py-3 bg-gray-700/50 text-white rounded-lg border ${isFocused ? 'border-emerald-500 shadow-md shadow-emerald-500/20' : 'border-gray-600'} focus:outline-none focus:ring-2 focus:ring-emerald-500/30 transition-all duration-200`} | ||
placeholder='Enter your username' | ||
onKeyDown={(e) => e.key === 'Enter' && handleLogin()} | ||
/> | ||
</div> | ||
|
||
<button | ||
onClick={handleLogin} | ||
className='w-full py-3 px-4 bg-gradient-to-r from-green-500 to-emerald-600 text-white font-medium rounded-lg hover:shadow-lg hover:shadow-emerald-500/20 focus:outline-none focus:ring-2 focus:ring-emerald-500/50 transition-all duration-300 hover:scale-[1.02] active:scale-[0.98]' | ||
> | ||
Login | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's advised to add the FRONTEND_URL env var to the
.env.example
file just so other people know that it needs to be set