Skip to content

Commit

Permalink
Merge branch 'Counselllor:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
PranjaliBhardwaj authored Jun 15, 2024
2 parents fe8a58d + 6cf5e2e commit 898cef5
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 283 deletions.
429 changes: 213 additions & 216 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"preview": "vite preview"
},
"dependencies": {
"@iconify/react": "^5.0.0",
"@iconify/react": "^5.0.1",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"firebase": "^10.12.2",
Expand All @@ -27,8 +27,8 @@
"devDependencies": {
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.0",
"@vitejs/plugin-react": "^4.3.1",
"react-toastify": "^10.0.5",
"vite": "^5.2.12"
"vite": "^5.3.1"
}
}
7 changes: 4 additions & 3 deletions src/components/CollegePage/CollegePage.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

.content {
background-color: #5cb6f9;
background-color: rgb(26, 165, 224);
width: 50vw;
overflow: hidden;
position: relative;
Expand Down Expand Up @@ -172,9 +172,10 @@ margin-bottom: 0px;
}
.searchCourses {
border-radius: 15px;
width: 30vw;
width: 40vw;
margin-left: 5vw;
margin-top: 120px;
background-color: #c5d5d4;
color: white;
padding: 10px 20px;
font-size: 16px;
border: none;
Expand Down
4 changes: 2 additions & 2 deletions src/components/Dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Dashboard = () => {
setFilteredColleges(results);
}, [searchTerm]);

const handleSignOut = () => {
const handleSignOut = useCallback(() => {
signOut(auth)
.then(() => {
setTimeout(() => {
Expand All @@ -55,7 +55,7 @@ const Dashboard = () => {
className: "toast-message",
});
});
};
});

const handleCollegeClick = useCallback(
(college) => {
Expand Down
18 changes: 9 additions & 9 deletions src/components/ForgotPassword/ForgotPassword.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ function validEmail(email) {
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}

function onChangeEvent(event){
setEmail(event.target.value)
if (!validEmail(event.target.value)) {
setError("**Enter a valid E-mail!");
} else {
setError("");
}
}
function ForgotPassword() {

const [email, setEmail] = useState();
Expand Down Expand Up @@ -55,14 +62,7 @@ function ForgotPassword() {
<form className='fp-form' onSubmit={handleSubmit}>
<label className="forgot_text" htmlFor="Email">Please enter your email address and and we'll send you a link to get back into your account.</label>
<input type="email" value={email}
onChange={(event) => {
setEmail(event.target.value)
if (!validEmail(event.target.value)) {
setError("**Enter a valid E-mail!");
} else {
setError("");
}
}}
onChange={onChangeEvent}
placeholder="Enter your email address" className={`common-input ${error === '**Enter a valid E-mail!' ? 'error' : ''} ${error === '**Enter a E-mail!' ? 'error' : ''}`}
/>
{error === "**Enter a E-mail!" && (
Expand Down
14 changes: 8 additions & 6 deletions src/components/Home/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@ import Typewriter from 'typewriter-effect';
import MeetingPhoto from '../../assets/meeting.webp';
import Navbar from '../Navbar/Navbar';
import './Home.css';
function handleOnInit(typewriter){
typewriter.typeString("Still Confused with College Choice?")
.pauseFor(10)
.start();

}

const Home = () => {
return (
<>
<Navbar />
<div id='homeCircle'/>
<div id='homeContainer'>
<img id='meetingImg' src={MeetingPhoto} alt="Meeting Image" />
<img id='meetingImg' src={MeetingPhoto} alt="Meeting Pic" />
<div className="MainText">
<Typewriter
onInit={(typewriter) => {
typewriter.typeString("Still Confused with College Choice?")
.pauseFor(10)
.start();
}}
onInit={handleOnInit}
/>
</div>
</div>
Expand Down
30 changes: 15 additions & 15 deletions src/components/Login/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
signInWithEmailAndPassword,
signInWithPopup
} from "firebase/auth";
import React, { useEffect, useState } from "react";
import React, { useEffect, useState, useCallback} from "react";
import { Link, useNavigate } from "react-router-dom";
import meeting2 from "../../assets/meeting2.png";

Expand All @@ -29,8 +29,8 @@ export default function Login() {
password: "",
});

// Function for handelling inputs
const handleLoginInfo = (e)=>{
// Function for handling inputs
const handleLoginInfo = useCallback((e)=>{
const {name, value} = e.target;
setLoginInfo((prev)=>{
return {...prev, [name]: value}
Expand All @@ -42,13 +42,13 @@ export default function Login() {
setError((prev)=>{
return {...prev, ...errObj}
})
}
})

const passwordToggle = () => {
const passwordToggle = useCallback(() => {
if (passwordType === "password") {
setPasswordType("text");
} else setPasswordType("password");
};
});

const navigate = useNavigate();
useEffect(() => {
Expand All @@ -64,7 +64,7 @@ export default function Login() {
});
}, []);

const genrateCaptcha = ()=>
const generateCaptcha = useCallback(()=>
{
let captcha = "";
const charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Expand All @@ -74,22 +74,22 @@ export default function Login() {
captcha += charset.charAt(randomIndex);
}
setCaptchaText(captcha)
}
})

useEffect(()=>{
genrateCaptcha();
generateCaptcha();
}, [])

// if signin with EmailId/password success then navigate to /dashboard
const handleSignIn = (e) => {
const handleSignIn = useCallback((e) => {
e.preventDefault();
let submitable = true;
if(captchaVal !== captchaText){
toast.error("Wrong Captcha",{
className: "toast-message",
})
setCaptchaVal("");
genrateCaptcha();
generateCaptcha();
return;
}

Expand Down Expand Up @@ -127,9 +127,9 @@ export default function Login() {
className: "toast-message",
})
}
};
});
// Popup Google signin
const SignInGoogle = () => {
const SignInGoogle = useCallback(() => {
signInWithPopup(auth, googleAuthProvider)
.then(() => {
toast.success("Login successful !",{
Expand All @@ -142,7 +142,7 @@ export default function Login() {
.catch((err) => toast.error(err.message,{
className: "toast-message",
}));
};
});

return (
<main>
Expand Down Expand Up @@ -212,7 +212,7 @@ export default function Login() {
<div id="captcha">{captchaText}</div>
<FaSyncAlt
id="captchaIcon"
onClick={genrateCaptcha}
onClick={generateCaptcha}
/>
<div className="iconContainer">
<input
Expand Down
Loading

0 comments on commit 898cef5

Please sign in to comment.