From 5a49a75812bc42b8a629d18ab171219f782ee1a1 Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Thu, 23 Nov 2023 19:25:31 +0530 Subject: [PATCH 01/13] test --- frontend/src/Login/ForgotPass.tsx | 59 ++++++++++++++++++++++++++++ frontend/src/Login/Login.tsx | 64 +++++++++++++++++++++++++++++++ frontend/src/Login/ResetCode.tsx | 5 +++ frontend/src/Login/Signup.tsx | 60 +++++++++++++++++++++++++++++ 4 files changed, 188 insertions(+) create mode 100644 frontend/src/Login/ForgotPass.tsx create mode 100644 frontend/src/Login/Login.tsx create mode 100644 frontend/src/Login/ResetCode.tsx create mode 100644 frontend/src/Login/Signup.tsx diff --git a/frontend/src/Login/ForgotPass.tsx b/frontend/src/Login/ForgotPass.tsx new file mode 100644 index 0000000..3a1f092 --- /dev/null +++ b/frontend/src/Login/ForgotPass.tsx @@ -0,0 +1,59 @@ +import React from 'react'; +import DocsGPT3 from '../assets/cute_docsgpt3.svg'; +import { useNavigate } from 'react-router-dom'; +export default function forgotPass() { + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log('login'); + }; + + const navigate = useNavigate(); + + return ( +
+
+ Logo +
+

Log in to

+

+ DocsGPT +

+
+
+
+

Password reset

+

+ Enter the email address associated with your account and we will + send you a link to reset your password. +

+
+ + + +
+
+

+ Don't have an account ? +

navigate('/register')} + > + Sign up +

+ +
+
+
+ ); +} diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx new file mode 100644 index 0000000..e834849 --- /dev/null +++ b/frontend/src/Login/Login.tsx @@ -0,0 +1,64 @@ +import React from 'react'; +import DocsGPT3 from '../assets/cute_docsgpt3.svg'; +import { useNavigate } from 'react-router-dom'; +export default function Login() { + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log('login'); + }; + + const navigate = useNavigate(); + + return ( +
+
+ Logo +
+

Log in to

+

+ DocsGPT +

+
+
+ + +

navigate('/Resetpass')} + > + Forgot your password? +

+ +
+

+ Don't have an account ? +

navigate('/register')} + > + Sign up +

+ +
+
+
+
+ ); +} diff --git a/frontend/src/Login/ResetCode.tsx b/frontend/src/Login/ResetCode.tsx new file mode 100644 index 0000000..aaf0f61 --- /dev/null +++ b/frontend/src/Login/ResetCode.tsx @@ -0,0 +1,5 @@ +import React from 'react'; + +export default function ResetCode() { + return
ResetCode
; +} diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx new file mode 100644 index 0000000..2b09ad3 --- /dev/null +++ b/frontend/src/Login/Signup.tsx @@ -0,0 +1,60 @@ +import React from 'react'; +import DocsGPT3 from '../assets/cute_docsgpt3.svg'; +import { useNavigate } from 'react-router-dom'; + +export default function Signup() { + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log('login'); + }; + + const navigate = useNavigate(); + + return ( +
+
+ Logo +
+

Create

+

+ DocsGPT +

+

Account

+
+
+ + + +
+

+ Already have an account ? +

navigate('/login')} + > + log in +

+ +
+
+
+
+ ); +} From e0b26251c8d9c73a116ddc065c17514e2ae2f96b Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Thu, 23 Nov 2023 19:34:40 +0530 Subject: [PATCH 02/13] Final_Major_Commit --- frontend/package-lock.json | 16 ++++++++-------- frontend/package.json | 4 ++-- frontend/src/App.tsx | 21 +++++++++++++++++---- frontend/src/Login/ForgotPass.tsx | 2 +- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 419a1f1..0f72134 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -21,8 +21,8 @@ "remark-gfm": "^3.0.0" }, "devDependencies": { - "@types/react": "^18.0.27", - "@types/react-dom": "^18.0.10", + "@types/react": "^18.2.38", + "@types/react-dom": "^18.2.17", "@types/react-syntax-highlighter": "^15.5.6", "@typescript-eslint/eslint-plugin": "^5.51.0", "@typescript-eslint/parser": "^5.51.0", @@ -1255,9 +1255,9 @@ "integrity": "sha512-JCB8C6SnDoQf0cNycqd/35A7MjcnK+ZTqE7judS6o7utxUCg6imJg3QK2qzHKszlTjcj2cn+NwMB2i96ubpj7w==" }, "node_modules/@types/react": { - "version": "18.0.27", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.27.tgz", - "integrity": "sha512-3vtRKHgVxu3Jp9t718R9BuzoD4NcQ8YJ5XRzsSKxNDiDonD2MXIT1TmSkenxuCycZJoQT5d2vE8LwWJxBC1gmA==", + "version": "18.2.38", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.38.tgz", + "integrity": "sha512-cBBXHzuPtQK6wNthuVMV6IjHAFkdl/FOPFIlkd81/Cd1+IqkHu/A+w4g43kaQQoYHik/ruaQBDL72HyCy1vuMw==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -1265,9 +1265,9 @@ } }, "node_modules/@types/react-dom": { - "version": "18.0.10", - "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.0.10.tgz", - "integrity": "sha512-E42GW/JA4Qv15wQdqJq8DL4JhNpB3prJgjgapN3qJT9K2zO5IIAQh4VXvCEDupoqAwnz0cY4RlXeC/ajX5SFHg==", + "version": "18.2.17", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.17.tgz", + "integrity": "sha512-rvrT/M7Df5eykWFxn6MYt5Pem/Dbyc1N8Y0S9Mrkw2WFCRiqUgw9P7ul2NpwsXCSM1DVdENzdG9J5SreqfAIWg==", "devOptional": true, "dependencies": { "@types/react": "*" diff --git a/frontend/package.json b/frontend/package.json index bb7b6db..f67ed47 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -32,8 +32,8 @@ "remark-gfm": "^3.0.0" }, "devDependencies": { - "@types/react": "^18.0.27", - "@types/react-dom": "^18.0.10", + "@types/react": "^18.2.38", + "@types/react-dom": "^18.2.17", "@types/react-syntax-highlighter": "^15.5.6", "@typescript-eslint/eslint-plugin": "^5.51.0", "@typescript-eslint/parser": "^5.51.0", diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index fdf86dd..3dc29ad 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,7 +1,12 @@ -import { Routes, Route } from 'react-router-dom'; +import { Routes, Route, useLocation } from 'react-router-dom'; import Navigation from './Navigation'; import Conversation from './conversation/Conversation'; import About from './About'; +import Login from './Login/Login'; +import Signup from './Login/Signup'; +import ResetCode from './Login/ResetCode'; +import ForgotPass from './Login/ForgotPass'; + import PageNotFound from './PageNotFound'; import { inject } from '@vercel/analytics'; import { useMediaQuery } from './hooks'; @@ -13,20 +18,28 @@ inject(); export default function App() { const { isMobile } = useMediaQuery(); const [navOpen, setNavOpen] = useState(!isMobile); + const location = useLocation(); + + // Checking for the login page + const isLogin = location.pathname === '/login'; return (
- + {!isLogin && }
} /> } /> + } /> + } /> + } /> + } /> } /> } /> diff --git a/frontend/src/Login/ForgotPass.tsx b/frontend/src/Login/ForgotPass.tsx index 3a1f092..501bb7e 100644 --- a/frontend/src/Login/ForgotPass.tsx +++ b/frontend/src/Login/ForgotPass.tsx @@ -1,7 +1,7 @@ import React from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import { useNavigate } from 'react-router-dom'; -export default function forgotPass() { +export default function ForgotPass() { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); console.log('login'); From f60b2282ed4e172be12d2fe2049bdb21931881fd Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Thu, 23 Nov 2023 20:08:28 +0530 Subject: [PATCH 03/13] Login_connect_done --- frontend/src/Login/ForgotPass.tsx | 2 +- frontend/src/Login/Login.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/Login/ForgotPass.tsx b/frontend/src/Login/ForgotPass.tsx index 501bb7e..e4a33b0 100644 --- a/frontend/src/Login/ForgotPass.tsx +++ b/frontend/src/Login/ForgotPass.tsx @@ -44,7 +44,7 @@ export default function ForgotPass() {

- Don't have an account ? + Don't have an account ?

navigate('/register')} diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index e834849..a845220 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -48,7 +48,7 @@ export default function Login() {

- Don't have an account ? + Don't have an account ?

navigate('/register')} From 05c7912376aa614038f85b29536b6e3e9ae278e7 Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Thu, 23 Nov 2023 20:08:57 +0530 Subject: [PATCH 04/13] Testing_done --- frontend/src/conversation/ConversationBubble.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/conversation/ConversationBubble.tsx b/frontend/src/conversation/ConversationBubble.tsx index 1d7c856..9289567 100644 --- a/frontend/src/conversation/ConversationBubble.tsx +++ b/frontend/src/conversation/ConversationBubble.tsx @@ -244,8 +244,8 @@ const ConversationBubble = forwardRef< ? 'rgba(125, 84, 209, 0.3)' : '#EEEEEE' : isLikeClicked - ? 'rgba(125, 84, 209, 0.3)' - : '#ffffff', + ? 'rgba(125, 84, 209, 0.3)' + : '#ffffff', }} > Date: Thu, 23 Nov 2023 20:09:49 +0530 Subject: [PATCH 05/13] Minor_Hero_update --- frontend/src/Hero.tsx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontend/src/Hero.tsx b/frontend/src/Hero.tsx index cb55ca1..9b58722 100644 --- a/frontend/src/Hero.tsx +++ b/frontend/src/Hero.tsx @@ -1,8 +1,10 @@ import { useMediaQuery } from './hooks'; import DocsGPT3 from './assets/cute_docsgpt3.svg'; +import { useNavigate } from 'react-router-dom'; export default function Hero({ className = '' }: { className?: string }) { // const isMobile = window.innerWidth <= 768; + const navigate = useNavigate(); const { isMobile } = useMediaQuery(); return (
@@ -166,6 +168,20 @@ export default function Hero({ className = '' }: { className?: string }) {

+
+ + +
); } From 7c297f476407b25567ea581bb7420adae1babaa9 Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Thu, 23 Nov 2023 21:29:35 +0530 Subject: [PATCH 06/13] Minor_changes --- frontend/src/App.tsx | 6 +++++- frontend/src/Hero.tsx | 14 -------------- frontend/src/Login/Login.tsx | 2 +- frontend/src/conversation/Conversation.tsx | 3 ++- 4 files changed, 8 insertions(+), 17 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 3dc29ad..05362c6 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -21,7 +21,11 @@ export default function App() { const location = useLocation(); // Checking for the login page - const isLogin = location.pathname === '/login'; + const isLogin = + location.pathname === '/login' || + location.pathname === '/register' || + location.pathname === '/Forgot' || + location.pathname === '/ResetPassword'; return (
diff --git a/frontend/src/Hero.tsx b/frontend/src/Hero.tsx index 9b58722..97ee5c3 100644 --- a/frontend/src/Hero.tsx +++ b/frontend/src/Hero.tsx @@ -168,20 +168,6 @@ export default function Hero({ className = '' }: { className?: string }) {
-
- - -
); } diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index a845220..b5985bb 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -39,7 +39,7 @@ export default function Login() { />

navigate('/Resetpass')} + onClick={() => navigate('/Forgot')} > Forgot your password?

diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index fcef240..96415c1 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -133,7 +133,7 @@ export default function Conversation() { {queries.length > 0 && (
- {queries.map((query, index) => { + {queries.map((query: Query, index: number) => { return ( )}
+

This is a chatbot that uses the GPT-3, Faiss and LangChain to answer questions. From e67d13e4a70cb70ded967aac59e06ee966d72beb Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Sat, 25 Nov 2023 19:49:53 +0530 Subject: [PATCH 07/13] Final_first_changes --- frontend/src/Login/ForgotPass.tsx | 13 +++- frontend/src/Login/Login.tsx | 73 ++++++++++++++++++++-- frontend/src/Login/ResetCode.tsx | 62 +++++++++++++++++- frontend/src/Login/Signup.tsx | 15 +++-- frontend/src/conversation/Conversation.tsx | 18 ++++++ 5 files changed, 165 insertions(+), 16 deletions(-) diff --git a/frontend/src/Login/ForgotPass.tsx b/frontend/src/Login/ForgotPass.tsx index e4a33b0..fe0cb3d 100644 --- a/frontend/src/Login/ForgotPass.tsx +++ b/frontend/src/Login/ForgotPass.tsx @@ -12,7 +12,9 @@ export default function ForgotPass() { return (

- Logo +
navigate('/')}> + Logo +

Log in to

@@ -38,7 +40,12 @@ export default function ForgotPass() { // onChange={onchange} /> - @@ -46,7 +53,7 @@ export default function ForgotPass() {

Don't have an account ?

navigate('/register')} > Sign up diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index b5985bb..55fe99e 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -1,10 +1,60 @@ -import React from 'react'; +import React, { useState } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import { useNavigate } from 'react-router-dom'; export default function Login() { + const [showalert, setshowalert] = useState(''); + const [email, setemail] = useState(''); + const [password, setpassword] = useState(''); + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - console.log('login'); + + //email validation + if (email.length === 0 || password.length === 0) { + if (password.length === 0) { + setshowalert('Password is required'); + return; + } else { + setshowalert('Email is required'); + } + return; + } else { + setshowalert(''); + } + if (password.length === 0) { + setshowalert('Password is required'); + return; + } + + // const response = await fetch(`http://localhost:5000/api/auth/login`, { + // method: "POST", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify({ + // Email: user.Email, + // Password: user.Password, + // }), + // }); + // const json = await response.json(); + // console.log(json); + // if (json.Check) { + // localStorage.setItem("token", json.authtoken); + // if (json?.status) + // { + // localStorage.setItem("isadmin" , true); + // } + // navigate("/"); + // } + // else if (!json.Check) + // { + // alert("Invalid Login Credentials") + // console.log("Invalid Login Cred") + // } + + alert('Login Successful '); + + navigate('/'); }; const navigate = useNavigate(); @@ -12,7 +62,9 @@ export default function Login() { return (
- Logo +
navigate('/')}> + Logo +

Log in to

@@ -27,6 +79,9 @@ export default function Login() { type="email" name="Name" placeholder="Email" + onChange={(e) => { + setemail(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" // onChange={onchange} /> @@ -34,23 +89,29 @@ export default function Login() { type="password" name="Name" placeholder="Password" + onChange={(e) => { + setpassword(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" // onChange={onchange} />

navigate('/Forgot')} > Forgot your password?

- + {showalert.length > 0 && ( +
{showalert}
+ )}

Don't have an account ?

navigate('/register')} > Sign up diff --git a/frontend/src/Login/ResetCode.tsx b/frontend/src/Login/ResetCode.tsx index aaf0f61..6b15b82 100644 --- a/frontend/src/Login/ResetCode.tsx +++ b/frontend/src/Login/ResetCode.tsx @@ -1,5 +1,63 @@ import React from 'react'; - +import DocsGPT3 from '../assets/cute_docsgpt3.svg'; +import { useNavigate } from 'react-router-dom'; export default function ResetCode() { - return
ResetCode
; + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + console.log('login'); + }; + + const navigate = useNavigate(); + return ( +
+
+
navigate('/')}> + Logo +
+
+

Log in to

+

+ DocsGPT +

+
+
+
+

+ We've sent you instructions to reset your password. Please + check your inbox. +

+

+ If you haven't received an email in 5 minutes, check your + spam, resend, or try a different email. +

+
+ + + +
+
+

+ Don't have an account ? +

navigate('/register')} + > + Sign up +

+

+
+
+
+ ); } diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index 2b09ad3..dae3dd8 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -5,7 +5,10 @@ import { useNavigate } from 'react-router-dom'; export default function Signup() { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - console.log('login'); + + alert('Signup Successful '); + + navigate('/login'); }; const navigate = useNavigate(); @@ -13,7 +16,9 @@ export default function Signup() { return (
- Logo +
navigate('/')}> + Logo +

Create

@@ -39,17 +44,17 @@ export default function Signup() { className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" // onChange={onchange} /> -

Already have an account ?

navigate('/login')} > - log in + Log in

diff --git a/frontend/src/conversation/Conversation.tsx b/frontend/src/conversation/Conversation.tsx index 96415c1..c797d65 100644 --- a/frontend/src/conversation/Conversation.tsx +++ b/frontend/src/conversation/Conversation.tsx @@ -1,6 +1,7 @@ import { Fragment, useEffect, useRef, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import Hero from '../Hero'; +import { useNavigate } from 'react-router-dom'; import { AppDispatch } from '../store'; import ConversationBubble from './ConversationBubble'; import { @@ -115,6 +116,8 @@ export default function Conversation() { document.execCommand('insertText', false, text); }; + const navigate = useNavigate(); + return (
{queries.length > 0 && !hasScrolledToLast && ( @@ -152,8 +155,23 @@ export default function Conversation() { {queries.length === 0 && ( )} +
+
+ + +
Date: Sat, 25 Nov 2023 19:54:00 +0530 Subject: [PATCH 08/13] testing_for_pr --- frontend/src/Login/Signup.tsx | 40 +++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index dae3dd8..b39802f 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -1,11 +1,32 @@ -import React from 'react'; +import React, { useState } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import { useNavigate } from 'react-router-dom'; export default function Signup() { + const [showalert, setshowalert] = useState(''); + const [email, setemail] = useState(''); + const [password, setpassword] = useState(''); + const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); + //email validation + if (email.length === 0 || password.length === 0) { + if (password.length === 0) { + setshowalert('Password is required'); + return; + } else { + setshowalert('Email is required'); + } + return; + } else { + setshowalert(''); + } + if (password.length === 0) { + setshowalert('Password is required'); + return; + } + alert('Signup Successful '); navigate('/login'); @@ -34,27 +55,34 @@ export default function Signup() { type="email" name="Name" placeholder="Email" + onChange={(e) => { + setemail(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" - // onChange={onchange} /> { + setpassword(e.target.value); + }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" - // onChange={onchange} /> - + {showalert.length > 0 && ( +
{showalert}
+ )}

Already have an account ?

navigate('/login')} > - Log in + log in

From 8c1ee02e2d456e8330064163b795c5428d5696d7 Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Sat, 25 Nov 2023 20:06:55 +0530 Subject: [PATCH 09/13] Final_PR_Push --- frontend/src/Login/Signup.tsx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index b39802f..a69621a 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -10,23 +10,18 @@ export default function Signup() { const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); - //email validation if (email.length === 0 || password.length === 0) { - if (password.length === 0) { - setshowalert('Password is required'); - return; - } else { - setshowalert('Email is required'); - } + setshowalert('Both fields are required'); return; - } else { - setshowalert(''); } - if (password.length === 0) { - setshowalert('Password is required'); + + //email validation + if (!email.match(/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/)) { + setshowalert('Please enter a valid email address'); return; } + setshowalert(''); alert('Signup Successful '); navigate('/login'); @@ -69,7 +64,7 @@ export default function Signup() { }} className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" /> - {showalert.length > 0 && ( @@ -79,7 +74,7 @@ export default function Signup() {

Already have an account ?

navigate('/login')} > log in From f42d4d3efda32419bd7a2845e7221e50632bca83 Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Sun, 26 Nov 2023 11:15:39 +0530 Subject: [PATCH 10/13] Made_Some_responsiver_changes --- frontend/src/Login/Login.tsx | 6 +++--- frontend/src/Login/Signup.tsx | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index 55fe99e..4bc4d31 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -65,9 +65,9 @@ export default function Login() {
navigate('/')}> Logo
-
-

Log in to

-

+
+

Log in to

+

DocsGPT

diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index a69621a..afec670 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -31,16 +31,16 @@ export default function Signup() { return (
-
+
navigate('/')}> Logo
-
-

Create

-

+
+

Create

+

DocsGPT

-

Account

+

Account

Date: Mon, 27 Nov 2023 17:49:19 +0530 Subject: [PATCH 11/13] Second_final_changes --- frontend/src/Login/ForgotPass.tsx | 2 +- frontend/src/Login/Login.tsx | 23 +++++++++++++---------- frontend/src/Login/ResetCode.tsx | 2 +- frontend/src/Login/Signup.tsx | 24 +++++++++++++----------- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/frontend/src/Login/ForgotPass.tsx b/frontend/src/Login/ForgotPass.tsx index fe0cb3d..486a550 100644 --- a/frontend/src/Login/ForgotPass.tsx +++ b/frontend/src/Login/ForgotPass.tsx @@ -51,7 +51,7 @@ export default function ForgotPass() {

- Don't have an account ? + Don't have an account?

navigate('/register')} diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index 4bc4d31..e885e5c 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -61,13 +61,15 @@ export default function Login() { return (
-
-
navigate('/')}> +
+
navigate('/')}> Logo
-

Log in to

-

+

+ Log in to +

+

DocsGPT

@@ -82,9 +84,10 @@ export default function Login() { onChange={(e) => { setemail(e.target.value); }} - className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" + className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" // onChange={onchange} /> +
{ setpassword(e.target.value); }} - className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" + className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" // onChange={onchange} />

navigate('/Forgot')} > Forgot your password?

- {showalert.length > 0 && ( @@ -109,9 +112,9 @@ export default function Login() { )}

- Don't have an account ? + Don't have an account?

navigate('/register')} > Sign up diff --git a/frontend/src/Login/ResetCode.tsx b/frontend/src/Login/ResetCode.tsx index 6b15b82..f69f5a8 100644 --- a/frontend/src/Login/ResetCode.tsx +++ b/frontend/src/Login/ResetCode.tsx @@ -48,7 +48,7 @@ export default function ResetCode() {

- Don't have an account ? + Don't have an account?

navigate('/register')} diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index afec670..4d249fe 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -31,20 +31,22 @@ export default function Signup() { return (
-
+
navigate('/')}> Logo
-

Create

-

+

Create

+

DocsGPT

-

Account

+

+ Account +

{ setemail(e.target.value); }} - className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" + className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" /> { setpassword(e.target.value); }} - className="w-full rounded-lg border-none bg-[#2B2B2B] p-4 text-sm font-medium text-white focus:outline-none md:min-w-[25vw]" + className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" /> - {showalert.length > 0 && ( @@ -72,12 +74,12 @@ export default function Signup() { )}

- Already have an account ? + Already have an account?

navigate('/login')} > - log in + Log in

From b6b3e455dea8c486a35a7a17ade2e04ed18f874f Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Mon, 27 Nov 2023 18:15:28 +0530 Subject: [PATCH 12/13] Final_changes_maded --- frontend/package-lock.json | 9 ++++ frontend/package.json | 1 + frontend/src/Login/Login.tsx | 85 +++++++++++++++++++++++++++--------- 3 files changed, 75 insertions(+), 20 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0f72134..9e9afa8 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -14,6 +14,7 @@ "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", + "react-icons": "^4.12.0", "react-markdown": "^8.0.7", "react-redux": "^8.0.5", "react-router-dom": "^6.8.1", @@ -6411,6 +6412,14 @@ "react": ">= 16.8 || 18.0.0" } }, + "node_modules/react-icons": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz", + "integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==", + "peerDependencies": { + "react": "*" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/frontend/package.json b/frontend/package.json index f67ed47..c43abf6 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -25,6 +25,7 @@ "react-copy-to-clipboard": "^5.1.0", "react-dom": "^18.2.0", "react-dropzone": "^14.2.3", + "react-icons": "^4.12.0", "react-markdown": "^8.0.7", "react-redux": "^8.0.5", "react-router-dom": "^6.8.1", diff --git a/frontend/src/Login/Login.tsx b/frontend/src/Login/Login.tsx index e885e5c..5d036f6 100644 --- a/frontend/src/Login/Login.tsx +++ b/frontend/src/Login/Login.tsx @@ -1,14 +1,16 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; import { useNavigate } from 'react-router-dom'; +import { IoEye } from 'react-icons/io5'; +import { IoMdEyeOff } from 'react-icons/io'; export default function Login() { const [showalert, setshowalert] = useState(''); const [email, setemail] = useState(''); const [password, setpassword] = useState(''); + const [isVisible, setisVisible] = useState(false); + const [ispasswordVisible, setispasswordVisible] = useState(false); - const handleSubmit = (e: React.FormEvent) => { - e.preventDefault(); - + const handleSubmit = () => { //email validation if (email.length === 0 || password.length === 0) { if (password.length === 0) { @@ -59,6 +61,27 @@ export default function Login() { const navigate = useNavigate(); + // Toogle Password + + const togglePassword = () => { + setispasswordVisible(!ispasswordVisible); + + const el = document.getElementById('password') as HTMLInputElement; + if (el.type === 'password') { + el.type = 'text'; + } else { + el.type = 'password'; + } + }; + + useEffect(() => { + if (password) { + setisVisible(true); + } else { + setisVisible(false); + } + }, [password]); + return (
@@ -73,10 +96,7 @@ export default function Login() { DocsGPT

- + -
- { - setpassword(e.target.value); - }} - className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" - // onChange={onchange} - /> +
+ { + setpassword(e.target.value); + }} + className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" + // onChange={onchange} + /> + {isVisible && + (!ispasswordVisible ? ( + + ) : ( + + ))} +
+

navigate('/Forgot')} > Forgot your password?

- {showalert.length > 0 && ( From 98a0bb24bd3b11789379223c38cef24b0770c21c Mon Sep 17 00:00:00 2001 From: Hemant2335 Date: Mon, 27 Nov 2023 18:20:15 +0530 Subject: [PATCH 13/13] Minor_update --- frontend/src/Login/Signup.tsx | 67 +++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 10 deletions(-) diff --git a/frontend/src/Login/Signup.tsx b/frontend/src/Login/Signup.tsx index 4d249fe..fde032b 100644 --- a/frontend/src/Login/Signup.tsx +++ b/frontend/src/Login/Signup.tsx @@ -1,11 +1,15 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import DocsGPT3 from '../assets/cute_docsgpt3.svg'; +import { IoEye } from 'react-icons/io5'; +import { IoMdEyeOff } from 'react-icons/io'; import { useNavigate } from 'react-router-dom'; export default function Signup() { const [showalert, setshowalert] = useState(''); const [email, setemail] = useState(''); const [password, setpassword] = useState(''); + const [isVisible, setisVisible] = useState(false); + const [ispasswordVisible, setispasswordVisible] = useState(false); const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); @@ -29,6 +33,27 @@ export default function Signup() { const navigate = useNavigate(); + // Toogle Password + + const togglePassword = () => { + setispasswordVisible(!ispasswordVisible); + + const el = document.getElementById('password') as HTMLInputElement; + if (el.type === 'password') { + el.type = 'text'; + } else { + el.type = 'password'; + } + }; + + useEffect(() => { + if (password) { + setisVisible(true); + } else { + setisVisible(false); + } + }, [password]); + return (
@@ -57,15 +82,37 @@ export default function Signup() { }} className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" /> - { - setpassword(e.target.value); - }} - className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" - /> +
+ { + setpassword(e.target.value); + }} + className="w-[90vw] cursor-pointer rounded-lg border-red-400 bg-[#2B2B2B] p-4 text-sm font-medium text-white hover:bg-[#383838] focus:border-2 focus:border-[#715c9d] focus:outline-none md:w-full md:min-w-[25vw]" + // onChange={onchange} + /> + {isVisible && + (!ispasswordVisible ? ( + + ) : ( + + ))} +