-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added private routes in App.jsx with logic in handleRedirections.js, …
…introduced variable colors for dark & light modes, added media queries for input chips, and set isWidgetVisible in navbar to show only when user is logged in.
- Loading branch information
1 parent
f3db20a
commit e3681b7
Showing
12 changed files
with
261 additions
and
157 deletions.
There are no files selected for viewing
This file contains 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,49 +1,79 @@ | ||
import React from "react"; | ||
import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; | ||
import NotFound from "./pages/Page404/Page404" | ||
import { | ||
BrowserRouter as Router, | ||
Routes, | ||
Route, | ||
Navigate, | ||
} from "react-router-dom"; | ||
import NotFound from "./pages/Page404/Page404"; | ||
import Home from "./pages/Home/Home"; | ||
import About from "./pages/About/About"; | ||
import Services from "./pages/Services/Services"; | ||
import Help from "./pages/Help/Help"; | ||
import Contact from "./pages/Contact/Contact"; | ||
import Signup from "./pages/Signup/Signup"; | ||
import Login from "./pages/Login/Login"; | ||
import ForgotPassword from "./pages/Forgot/Forgot" | ||
import ForgotPassword from "./pages/Forgot/Forgot"; | ||
import MyAccount from "./pages/MyAccount/MyAccount"; | ||
import EditAccountInfo from "./pages/EditAccountInfo/EditAccountInfo"; | ||
import Explore from "./pages/Explore/Explore"; | ||
import ThemeProvider from "./context/ThemeProvider/ThemeProvider"; | ||
import { getConfig } from "./utility/envHelper/envHelper"; | ||
import Layout from "./Layout"; | ||
import { isLoggedIn } from "./utility/userPersistence"; | ||
// import { handleNavigate } from "./utility/handleRedirections"; | ||
|
||
export const Config = getConfig(); | ||
|
||
function App() { | ||
const PrivateRoute = ({ element, ...rest }) => { | ||
return isLoggedIn() ? element : <Navigate to="/login" />; | ||
}; | ||
|
||
const RedirectIfLoggedIn = ({ element, ...rest }) => { | ||
return isLoggedIn() ? <Navigate to="/explore" /> : element; | ||
}; | ||
|
||
const App = () => { | ||
return ( | ||
<Router> | ||
<ThemeProvider> | ||
<Layout> | ||
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/about" element={<About />} /> | ||
<Route path="/services" element={<Services />} /> | ||
<Route path="/help" element={<Help />} /> | ||
<Route path="/contact" element={<Contact />} /> | ||
<Route path="/signup" element={<Signup />} /> | ||
<Route path="/login" element={<Login />} /> | ||
<Route path="/forgotpassword" element={<ForgotPassword />} /> | ||
<Route path="/myAccount" element={<MyAccount />} /> | ||
<Route | ||
path="/editAccountInfo" | ||
element={<EditAccountInfo />} | ||
/> | ||
<Route path="/explore" element={<Explore />} /> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes> | ||
</Layout> | ||
</ThemeProvider> | ||
</Router> | ||
<ThemeProvider> | ||
<Layout> | ||
<Routes> | ||
<Route | ||
path="/" | ||
element={isLoggedIn() ? <Navigate to="/explore" /> : <Home />} | ||
/> | ||
<Route path="/about" element={<About />} /> | ||
<Route path="/services" element={<Services />} /> | ||
<Route path="/help" element={<Help />} /> | ||
<Route path="/contact" element={<Contact />} /> | ||
<Route | ||
path="/signup" | ||
element={<RedirectIfLoggedIn element={<Signup />} />} | ||
/> | ||
<Route | ||
path="/login" | ||
element={<RedirectIfLoggedIn element={<Login />} />} | ||
/> | ||
<Route path="/forgotpassword" element={<ForgotPassword />} /> | ||
<Route | ||
path="/myAccount" | ||
element={<PrivateRoute element={<MyAccount />} />} | ||
/> | ||
<Route | ||
path="/editAccountInfo" | ||
element={<PrivateRoute element={<EditAccountInfo />} />} | ||
/> | ||
<Route | ||
path="/explore" | ||
element={<PrivateRoute element={<Explore />} />} | ||
/> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes> | ||
</Layout> | ||
</ThemeProvider> | ||
</Router> | ||
); | ||
} | ||
}; | ||
|
||
export default App; |
This file contains 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 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
92 changes: 46 additions & 46 deletions
92
frontend/src/components/Form/EducationInfo/EducationInfo.jsx
This file contains 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,48 +1,48 @@ | ||
import styles from '../Form.module.css' | ||
import { handleChange } from '../formHelperFunc' | ||
import styles from "../Form.module.css"; | ||
import { handleChange } from "../formHelperFunc"; | ||
|
||
const EducationInfo = ({education, setEducation}) => { | ||
return( | ||
<div className={styles.educationInfo}> | ||
<h3>Education</h3> | ||
<div className={styles.inputRow}> | ||
<input | ||
type="text" | ||
placeholder="Highest Degree Attained" | ||
name='highestDegreeAttained' | ||
value={education.highestDegreeAttained} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
<input | ||
type="text" | ||
placeholder="University/Institution Name" | ||
name='uniInsName' | ||
value={education.uniInsName} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
</div> | ||
<div className={styles.inputRow}> | ||
<input | ||
type="text" | ||
placeholder="Field of Study" | ||
name='fieldOfStudy' | ||
value={education.fieldOfStudy} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
<input | ||
type="number" | ||
placeholder="Graduation Year" | ||
name='graduationYear' | ||
value={education.graduationYear} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
</div> | ||
</div> | ||
) | ||
} | ||
const EducationInfo = ({ education, setEducation }) => { | ||
return ( | ||
<div className={styles.educationInfo}> | ||
<h3>Education</h3> | ||
<div className={styles.inputRow}> | ||
<input | ||
type="text" | ||
placeholder="Highest Degree Attained" | ||
name="highestDegreeAttained" | ||
value={education.highestDegreeAttained} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
<input | ||
type="text" | ||
placeholder="University/Institution Name" | ||
name="uniInsName" | ||
value={education.uniInsName} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
</div> | ||
<div className={styles.inputRow}> | ||
<input | ||
type="text" | ||
placeholder="Field of Study" | ||
name="fieldOfStudy" | ||
value={education.fieldOfStudy} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
<input | ||
type="number" | ||
placeholder="Graduation Year" | ||
name="graduationYear" | ||
value={education.graduationYear} | ||
onChange={(e) => handleChange(e, setEducation)} | ||
className={styles.inputField} | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EducationInfo | ||
export default EducationInfo; |
This file contains 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 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
Oops, something went wrong.