-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from YaleComputerSociety/clickable-classes
Clickable classes
- Loading branch information
Showing
19 changed files
with
352 additions
and
126 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,22 @@ | ||
|
||
import { useState } from "react"; | ||
import { Navigate, Route, Routes } from 'react-router-dom'; | ||
|
||
import Login from "./pages/Login"; | ||
import Graduation from './pages/Graduation'; | ||
import Courses from './pages/Courses'; | ||
import Majors from './pages/Majors'; | ||
import About from "./pages/OtherPages/About/About"; | ||
import FAQ from "./pages/OtherPages/FAQ/FAQ"; | ||
import Globals from './Globals'; | ||
import Router from './Router'; | ||
import CourseModal from './commons/components/courses/CourseModal'; | ||
|
||
import { CGSC, CPSC, ECON, HIST } from "./commons/mock/MockProgram"; | ||
|
||
function App() { | ||
|
||
const [auth] = useState(true); | ||
|
||
const programs = [CGSC, CPSC, ECON, HIST]; | ||
const strPrograms = JSON.stringify(programs); | ||
localStorage.setItem("programList", strPrograms); | ||
|
||
return ( | ||
<div> | ||
<Routes> | ||
{/* <Route path="/" element={auth ? <Navigate to="/graduation"/> : <Navigate to="/login"/>}/> | ||
<Route path="/login" element={auth ? <Navigate to="/graduation"/> : <Login/>}/> | ||
<Route path="/graduation" element={auth ? <Graduation/> : <Navigate to="/login"/>}/> | ||
<Route path="/courses" element={auth ? <Courses/> : <Navigate to="/login"/>}/> | ||
<Route path="/majors" element={auth ? <Majors/> : <Navigate to="/login"/>}/> */} | ||
<Route path="/" element={<Navigate to="/login"/>}/> | ||
<Route path="/login" element={<Login />}/> | ||
|
||
<Route path="/graduation" element={<Graduation/>}/> | ||
<Route path="/courses" element={<Courses/>}/> | ||
<Route path="/majors" element={<Majors/>}/> | ||
|
||
<Route path="/about" element={<About/>}/> | ||
<Route path="/faq" element={<FAQ/>}/> | ||
</Routes> | ||
</div> | ||
<div> | ||
<Globals> | ||
<Router /> | ||
<CourseModal /> | ||
</Globals> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ModalProvider } from "./hooks/modalContext"; | ||
|
||
function Globals({ children }: { readonly children: React.ReactNode }) { | ||
return ( | ||
<ModalProvider> | ||
<div>{children}</div> | ||
</ModalProvider> | ||
); | ||
} | ||
|
||
export default Globals; |
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,36 +1,31 @@ | ||
import { createBrowserRouter, RouterProvider } from "react-router-dom"; | ||
import "./index.css"; | ||
import Courses from "./pages/Courses"; | ||
import Majors from "./pages/Majors"; | ||
import Graduation from "./pages/Graduation"; | ||
import FAQ from "./pages/OtherPages/FAQ/FAQ"; | ||
import About from "./pages/OtherPages/About/About"; | ||
import React, { useState } from 'react'; | ||
import { Navigate, Route, Routes } from 'react-router-dom'; | ||
|
||
const router = createBrowserRouter([ | ||
{ | ||
path: "/graduation", | ||
element: <Graduation />, | ||
}, | ||
{ | ||
path: "/courses", | ||
element: <Courses />, | ||
}, | ||
{ | ||
path: "/majors", | ||
element: <Majors />, | ||
}, | ||
{ | ||
path: "/faq", | ||
element: <FAQ />, | ||
}, | ||
{ | ||
path: "/about", | ||
element: <About />, | ||
}, | ||
]); | ||
import Login from "./pages/Login"; | ||
import Graduation from './pages/Graduation'; | ||
import Courses from './pages/Courses'; | ||
import Majors from './pages/Majors'; | ||
import About from './pages/OtherPages/About/About'; | ||
import FAQ from './pages/OtherPages/FAQ/FAQ'; | ||
|
||
function Router() { | ||
return <RouterProvider router={router} />; | ||
const [auth] = useState(true); | ||
|
||
return ( | ||
<div> | ||
<Routes> | ||
<Route path="/" element={auth ? <Navigate to="/graduation"/> : <Navigate to="/login"/>}/> | ||
<Route path="/login" element={auth ? <Navigate to="/graduation"/> : <Login/>}/> | ||
|
||
<Route path="/graduation" element={auth ? <Graduation/> : <Navigate to="/login"/>}/> | ||
<Route path="/courses" element={auth ? <Courses/> : <Navigate to="/login"/>}/> | ||
<Route path="/majors" element={auth ? <Majors/> : <Navigate to="/login"/>}/> | ||
|
||
<Route path="/about" element={<About/>}/> | ||
<Route path="/FAQ" element={<FAQ/>}/> | ||
</Routes> | ||
</div> | ||
); | ||
} | ||
|
||
export default Router; | ||
export default Router; |
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.