From d8bd7ff2a0e478378804bfd24e99dbc628a446ef Mon Sep 17 00:00:00 2001 From: Kacper Lisik Date: Wed, 9 Apr 2025 11:19:15 +0200 Subject: [PATCH 1/6] Course page merged with main --- my-app/src/pages/App.jsx | 27 ------ .../src/views/Components/CoursePagePopup.jsx | 30 +++++++ my-app/src/views/CourseView.jsx | 84 +++++++++---------- my-app/src/views/ListView.jsx | 17 ++++ 4 files changed, 85 insertions(+), 73 deletions(-) create mode 100644 my-app/src/views/Components/CoursePagePopup.jsx diff --git a/my-app/src/pages/App.jsx b/my-app/src/pages/App.jsx index 4906db50..baf836f2 100644 --- a/my-app/src/pages/App.jsx +++ b/my-app/src/pages/App.jsx @@ -22,33 +22,6 @@ function App() {
- - {isPopupOpen && ( -
setIsPopupOpen(false)} - > -
e.stopPropagation()} - > -
- -
- -
-
- )} ); diff --git a/my-app/src/views/Components/CoursePagePopup.jsx b/my-app/src/views/Components/CoursePagePopup.jsx new file mode 100644 index 00000000..8a5239bf --- /dev/null +++ b/my-app/src/views/Components/CoursePagePopup.jsx @@ -0,0 +1,30 @@ +import React from 'react'; +import CourseView from '../CourseView'; + +function CoursePagePopup({ isOpen, onClose, course }) { + if (!isOpen || !course) return null; // Don't render if not open or course not selected + + return ( +
+
e.stopPropagation()} + > +
+ +
+ +
+
+ ); +} + +export default CoursePagePopup; diff --git a/my-app/src/views/CourseView.jsx b/my-app/src/views/CourseView.jsx index 9debafb5..225f9f86 100644 --- a/my-app/src/views/CourseView.jsx +++ b/my-app/src/views/CourseView.jsx @@ -1,61 +1,53 @@ import React from 'react'; +// import {model} from '/src/model.js'; -export default function CourseView(props) { +export default function CourseView({ course }) { + if (!course) return null; + + return ( -
+
{/* Course Title Section */} -
-

ID1203 - Best course in the Universe

+
+

+ {course.code} - {course.name} + ({course.credits} Credits) {/* Display Credits */} +

+
+
+
{/* Description Section */} -
-

- The course is an introduction to networking, protocols and communication. - - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - We study how large international networks are constructed from the individual computers, via local area, city and national networks. We use the Internet as or working example of such a network. The aim of the course is to give insights into both the theory and practice of the area. - -The focus of the course is on the protocols and algorithms used, and we will follow how they are used and implemented into the TCP/IP-stack - the basis of the Internet.

+
+

Course Description

+
+ {/* Prerequisite Graph Tree Section */} +
+

Prerequisite Graph Tree

+

Graph tree or prerequisite info will go here...

+
{/* Reviews Section */} -
-

Reviews

- {/* Placeholder for reviews */} -

Here would be some reviews of the course...

+
+

Reviews

+

Here would be some reviews of the course...

- {/* Prerequisite Graph Tree Section */} -
-

Prerequisite Graph Tree

- {/* Placeholder for graph tree */} -

Graph tree or prerequisite info will go here...

-
); } diff --git a/my-app/src/views/ListView.jsx b/my-app/src/views/ListView.jsx index 5f6512bf..e18fb4ff 100644 --- a/my-app/src/views/ListView.jsx +++ b/my-app/src/views/ListView.jsx @@ -1,10 +1,15 @@ import React, { useState } from 'react'; import { Quantum } from 'ldrs/react'; import 'ldrs/react/Quantum.css'; +import CoursePagePopupComponent from '../views/Components/CoursePagePopup.jsx'; + function ListView(props) { const coursesToDisplay = props.searchResults.length > 0 ? props.searchResults : props.courses; const [readMoreState, setReadMoreState] = useState({}); + const [isPopupOpen, setIsPopupOpen] = useState(false); + const [selectedCourse, setSelectedCourse] = useState(null); + const toggleReadMore = (courseCode) => { setReadMoreState(prevState => ( @@ -19,12 +24,18 @@ function ListView(props) { props.addFavourite(course); } }; + return (
{coursesToDisplay.length > 0 ? ( coursesToDisplay.map((course) => (
{ + console.log('Clicked:', course); // check browser console + setSelectedCourse(course); + setIsPopupOpen(true); + }} key={course.code} className="p-5 hover:bg-blue-100 flex items-center border border-b-black border-solid w-full rounded-lg cursor-pointer" > @@ -74,6 +85,12 @@ function ListView(props) { color="#000061" /> )} + setIsPopupOpen(false)} + + course={selectedCourse} + />
); } From 1959be81a9fe95cca49eb9a1a13f65da7604b06d Mon Sep 17 00:00:00 2001 From: Kacper Lisik Date: Wed, 9 Apr 2025 15:26:59 +0200 Subject: [PATCH 2/6] some styling changes --- my-app/src/views/Components/CoursePagePopup.jsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/my-app/src/views/Components/CoursePagePopup.jsx b/my-app/src/views/Components/CoursePagePopup.jsx index 8ca557f6..ea2b5266 100644 --- a/my-app/src/views/Components/CoursePagePopup.jsx +++ b/my-app/src/views/Components/CoursePagePopup.jsx @@ -2,24 +2,24 @@ import React from 'react'; function CoursePagePopup({ isOpen, onClose, course, prerequisiteTree }) { if (!isOpen || !course) return null; // Don't render if not open or course not selected - return (
e.stopPropagation()} >
{/* Course Title Section */}
-

- {course.code} - {course.name} - ({course.credits} Credits) {/* Display Credits */} +

+ {course.code} - {course.name} + ({course.credits} Credits)

+
From 3a62c17825002566244a0a6781bef60a06b7bd07 Mon Sep 17 00:00:00 2001 From: Kacper Lisik Date: Thu, 10 Apr 2025 09:38:15 +0200 Subject: [PATCH 6/6] small fixes --- my-app/src/presenters/ListViewPresenter.jsx | 24 ++++++------------- .../src/views/Components/CoursePagePopup.jsx | 10 +------- 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/my-app/src/presenters/ListViewPresenter.jsx b/my-app/src/presenters/ListViewPresenter.jsx index f6344665..b3491d14 100644 --- a/my-app/src/presenters/ListViewPresenter.jsx +++ b/my-app/src/presenters/ListViewPresenter.jsx @@ -6,14 +6,12 @@ import CoursePagePopup from '../views/Components/CoursePagePopup.jsx'; import PrerequisitePresenter from './PrerequisitePresenter.jsx'; const ListViewPresenter = observer(({ model }) => { - -<<<<<<< HEAD - - - const [isPopupOpen, setIsPopupOpen] = useState(false); - const [selectedCourse, setSelectedCourse] = useState(null); - const preP = -======= + const addFavourite = (course) => { + model.addFavourite(course); + } + const removeFavourite = (course) => { + model.removeFavourite(course); + } const handleFavouriteClick = (course) => { if (model.favourites.some(fav => fav.code === course.code)) { model.removeFavourite(course); @@ -24,16 +22,8 @@ const ListViewPresenter = observer(({ model }) => { const [isPopupOpen, setIsPopupOpen] = useState(false); const [selectedCourse, setSelectedCourse] = useState(null); - const preP = - const popup = setIsPopupOpen(false)} course={selectedCourse} handleFavouriteClick={handleFavouriteClick} prerequisiteTree={preP}/> + const preP = ->>>>>>> a6593340b954b95fa693730a4ba199b2268736ff - const addFavourite = (course) => { - model.addFavourite(course); - } - const removeFavourite = (course) => { - model.removeFavourite(course); - } const popup =
e.stopPropagation()} > @@ -57,14 +55,13 @@ function CoursePagePopup({ favouriteCourses, addFavourite,
-