Skip to content

Commit

Permalink
Merge branch 'dev' into temp-dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenss-m authored Apr 26, 2024
2 parents 881a6d1 + a53e6bc commit 0e61a6c
Show file tree
Hide file tree
Showing 16 changed files with 224 additions and 42 deletions.
4 changes: 2 additions & 2 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"rules": "database.rules.json"
},
"hosting": {
"public": "frontend",
"public": "frontend/build",
"ignore": [
"firebase.json",
"**/.*",
Expand All @@ -41,7 +41,7 @@
"port": 9000
},
"hosting": {
"port": 5000
"port": 3000
},
"pubsub": {
"port": 8085
Expand Down
37 changes: 27 additions & 10 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,38 @@

import React from "react";
// import styles from "./App.module.css";
import { useState } from "react";
import { Navigate, Route, Routes } from 'react-router-dom';

import { Route, Routes } from 'react-router-dom';

import Courses from './pages/Courses';
import Login from "./pages/Login";
import Graduation from './pages/Graduation';
import Courses from './pages/Courses';
import Majors from './pages/Majors';

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={<Graduation/>}/>
<Route path="/courses" element={<Courses/>}/>
<Route path="/majors" element={<Majors/>}/>
</Routes>
<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/>}/>
</Routes>
</div>
);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Graduation from "./pages/Graduation";

const router = createBrowserRouter([
{
path: "",
path: "/graduation",
element: <Graduation />,
},
{
Expand Down
Binary file added frontend/src/commons/images/reallycoolguy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 18 additions & 6 deletions frontend/src/commons/mock/MockStudent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,20 @@ import { Course, StudentCourse } from "./../types/TypeCourse";
import { Student } from "./../types/TypeStudent";


const DRST001: Course = { code: "DRST 001", title: "Directed Studies: Literature", seasons: ["FALL", "SPRING"], evaluation: { rating: 4.1, workload: 4.2, professor: 5}, distribution: ["Hu", "WR"] };
const StudentDRST001: StudentCourse = { course: DRST001, enrollmentStatus: "COMPLETED", season: "FALL", year: "2022-2023" };
const ENGL253: Course = { code: "ENGL 253", title: "Reading Ulysses: Modernist Classic and Postcolonial Epic", seasons: ["FALL"], evaluation: { rating: 0, workload: 0, professor: 5 }, distribution: ["Hu"] };
const StudentENGL253: StudentCourse = { course: ENGL253, enrollmentStatus: "COMPLETED", season: "FALL", year: "2022-2023" };

const ENGL419: Course = { code: "ENGL 419", title: "Writing about Contemporary Figurative Art", seasons: ["FALL"], evaluation: { rating: 4.8, workload: 4.5, professor: 5 }, distribution: ["WR", "Hu"] };
const StudentENGL419: StudentCourse = { course: ENGL419, enrollmentStatus: "COMPLETED", season: "FALL", year: "2022-2023" };

const GMAN233: Course = { code: "GMAN 233", title: "Karl Marx's Capital", seasons: ["FALL"], evaluation: { rating: 0, workload: 0, professor: 5 }, distribution: ["Hu"] };
const StudentGMAN233: StudentCourse = { course: GMAN233, enrollmentStatus: "COMPLETED", season: "FALL", year: "2022-2023" };

const SDS238: Course = { code: "S&DS 238", title: "Probability and Bayesian Statistics", seasons: ["FALL"], evaluation: { rating: 3.8, workload: 4.0, professor: 5 }, distribution: ["QR"] };
const StudentSDS238: StudentCourse = { course: SDS238, enrollmentStatus: "COMPLETED", season: "FALL", year: "2022-2023" };

const PLSC204: Course = { code: "PLSC 204", title: "Election Fundamentals and Forecasting", seasons: ["FALL"], evaluation: { rating: 0, workload: 0, professor: 5 }, distribution: ["So"] };
const StudentPLSC204: StudentCourse = { course: PLSC204, enrollmentStatus: "COMPLETED", season: "FALL", year: "2022-2023" };

const DRST003: Course = { code: "DRST 003", title: "Directed Studies: Philosophy", seasons: ["FALL", "SPRING"], evaluation: { rating: 4.1, workload: 4.2, professor: 5}, distribution: ["Hu", "WR"] };
const StudentDRST003: StudentCourse = { course: DRST003, enrollmentStatus: "COMPLETED", season: "SPRING", year: "2022-2023" };
Expand All @@ -16,7 +28,7 @@ export const MockStudent: Student = {
grade: "First-Year",
calendarYear: "2022-2023",
fall: {
courses: [StudentDRST001, StudentDRST001, StudentDRST001, StudentDRST001]
courses: [StudentENGL419]
},
spring: {
courses: [StudentDRST003, StudentDRST003, StudentDRST003, StudentDRST003, StudentDRST003]
Expand All @@ -26,7 +38,7 @@ export const MockStudent: Student = {
grade: "Sophomore",
calendarYear: "2023-2024",
fall: {
courses: [StudentDRST001, StudentDRST001, StudentDRST001, StudentDRST001, StudentDRST001]
courses: [StudentENGL419]
},
spring: {
courses: [StudentDRST003, StudentDRST003, StudentDRST003, StudentDRST003]
Expand All @@ -37,7 +49,7 @@ export const MockStudent: Student = {
grade: "Junior",
calendarYear: "2024-2025",
fall: {
courses: [StudentDRST001, StudentDRST001, StudentDRST001, StudentDRST001, StudentDRST001]
courses: [StudentENGL253, StudentENGL419, StudentGMAN233, StudentSDS238, StudentPLSC204]
},
spring: {
courses: [StudentDRST003, StudentDRST003, StudentDRST003, StudentDRST003, StudentDRST003]
Expand All @@ -47,7 +59,7 @@ export const MockStudent: Student = {
grade: "Senior",
calendarYear: "2025-2026",
fall: {
courses: [StudentDRST001, StudentDRST001, StudentDRST001]
courses: [StudentENGL419]
},
spring: {
courses: [StudentDRST003, StudentDRST003]
Expand Down
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions frontend/src/navbar/PageLinks.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

import React from "react";
import styles from "./NavBar.module.css";

import { NavLink } from "react-router-dom";

function PageLinks() {
return (
<div style={{ display: "flex", flexDirection: "row", marginRight: "20px" }}>
<NavLink to="/graduation" className={({ isActive }) => isActive ? styles.activeLink : styles.dormantLink }>
Graduation
</NavLink>
<NavLink to="/courses" className={({ isActive }) => isActive ? styles.activeLink : styles.dormantLink }>
Courses
</NavLink>
<NavLink to="/majors" className={({ isActive }) => isActive ? styles.activeLink : styles.dormantLink }>
Majors
</NavLink>
</div>
);
}

export default PageLinks;
4 changes: 1 addition & 3 deletions frontend/src/pages/Courses/Courses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MockStudent } from "./../../commons/mock/MockStudent";
import MeDropdown from "../../navbar/account/MeDropdown";
import nav_styles from "./../../commons/components/navbar/NavBar.module.css";
import img_logo from "./../../commons/images/ma_logo.png";
import { NavLink } from "react-router-dom";
import PageLinks from "../../navbar/PageLinks";

function NavBar() {
return (
Expand Down Expand Up @@ -162,6 +162,4 @@ function Courses() {
);
}

// {/* <Settings displaySetting={displaySetting} updateDisplaySetting={updateDisplaySetting}/> */}

export default Courses;
3 changes: 1 addition & 2 deletions frontend/src/pages/Graduation/Graduation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { CPSC } from "./../../commons/mock/MockProgram";
import MeDropdown from "../../navbar/account/MeDropdown";
import nav_styles from "./../../commons/components/navbar/NavBar.module.css";
import img_logo from "./../../commons/images/ma_logo.png";
import { NavLink } from "react-router-dom";
import PageLinks from "../../navbar/PageLinks";

function NavBar() {
return (
Expand All @@ -20,7 +20,6 @@ function NavBar() {
style={{ width: "150px", height: "auto", marginRight: "10px" }}
/>
</div>

<div className={nav_styles.row} style={{ marginRight: "20px" }}>
<NavLink
to="/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from "./../Graduation.module.css";

import DistributionBox from "../../../commons/components/courses/DistributionBoxLarge";
import CourseBoxSmall from "../../../commons/components/courses/CourseBoxSmall";
import InfoButton from "../../../commons/components/InfoButton";
import InfoButton from "../../../navbar/InfoButton";

import { StudentCourse, ClassLists } from "../../../commons/types/TypeCourse";
import { MockStudentCourses } from "../../../commons/mock/MockCourses";
Expand Down
59 changes: 59 additions & 0 deletions frontend/src/pages/Login/Login.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
.centerDiv {
min-height: 100vh;
text-align: center;
max-width: 1000px;
margin-left: auto;
margin-right: auto;
justify-content: center;
align-items: center;
padding: 1rem;
display: flex;
flex-wrap: wrap;
}

.featureListStyle {
list-style: none;
display: flex;
flex-direction: column;
gap: .5rem;
margin: 0;
padding: 0;
}

.featureItemStyle {
font-weight: 500;
transition: transform .3s;
cursor: default;
text-align: left;
}

.featureItemStyle:hover {
transform: translateX(7px);
}

.loginButtons {
display: flex;
margin-left: auto;
margin-right: auto;
margin-top: 3px;
justify-content: start;
justify-content: center;
}

.btn {
padding: 8px 24px;
border-radius: 10px;
font-weight: 500;
color: black;
background-color: lightblue;
transition:
transform 0.3s,
filter 0.3s;
margin-top: 8px;
}

.btn:hover {
text-decoration: none;
transform: translateY(-5px);
filter: brightness(90%);
}
62 changes: 62 additions & 0 deletions frontend/src/pages/Login/Login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import styles from "./Login.module.css";

import navStyles from "../../navbar/NavBar.module.css";
import logo from "../../commons/images/ma_logo.png";
import loginPageImage from "../../commons/images/reallycoolguy.jpg";

function NavBar() {
return (
<div className={navStyles.NavBar}>
<div style={{ marginLeft: "20px" }}>
<img
src={logo}
alt=""
style={{ width: "150px", height: "auto", marginRight: "10px" }}
/>
</div>
{/* <PageLinks />
<MeDropdown /> */}
</div>
);
}

function Login() {
return (
<div>
<NavBar />
<div className={styles.centerDiv}>
<div style={{width: "450px"}}>
<h1>The best place to explore and plan your major at Yale</h1>
<ul className={styles.featureListStyle}>
<li className={styles.featureItemStyle}>Explore all 80+ majors at Yale</li>
<li className={styles.featureItemStyle}>Check all your distributional requirements are satisfied</li>
<li className={styles.featureItemStyle}>Plan out all your courses in the traditional four-year plan</li>
<li className={styles.featureItemStyle}>Look at this really cool guy to the right</li>
</ul>
<div className={styles.loginButtons}>
{/* <a
href={`${API_ENDPOINT}/api/auth/cas?redirect=${window.location.origin}/catalog`}
className={clsx(styles.btn, styles.login, 'me-2')}
>
Login with CAS
</a> */}
<Link to="/graduation" className={styles.btn} style={{marginRight: "8px"}}>
Login with CAS
</Link>
<Link to="/courses" className={styles.btn} style={{marginRight: "8px"}}>
About Us
</Link>
<Link to="/majors" className={styles.btn}>
Guest
</Link>
</div>
</div>
<img alt="Landing page" src={loginPageImage} width="450"/>
</div>
</div>
);
}

export default Login;
2 changes: 2 additions & 0 deletions frontend/src/pages/Login/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Login from "./Login";
export default Login;
Loading

0 comments on commit 0e61a6c

Please sign in to comment.