Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
6bf9c8c
sidebar component add
kexana Mar 28, 2025
8e291f2
tailwind workin, beggining page building
kexana Mar 28, 2025
9492d09
structure
Dinoxh Mar 28, 2025
d7c45ab
fixed app
Dinoxh Mar 28, 2025
2ad2b52
Main design layout
Dinoxh Mar 28, 2025
e504235
initial sidebar
kexana Apr 2, 2025
368096f
courseView init
kexana Apr 2, 2025
bda6d94
the course page initial tests
LSKpr Apr 2, 2025
80c665a
Make it run on my comuter
Sailet03 Apr 2, 2025
6d27140
Tree without database integration
Sailet03 Apr 3, 2025
b9fbf6b
fixes
Sailet03 Apr 4, 2025
cce6da0
Merge branch 'main' of https://github.com/InferenceKTH/Find-My-Next-C…
Sailet03 Apr 9, 2025
2f64054
npm update
Sailet03 Apr 9, 2025
dc1d233
add to page
Sailet03 Apr 9, 2025
249fee8
Merge branch 'main' into prereq-tree
Sailet03 Apr 9, 2025
697a9b9
Merge branch 'main' into prereq-tree
Sailet03 Apr 9, 2025
b233d1f
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
Sailet03 Apr 9, 2025
e235a7a
Biiiiig Refactoring
Sailet03 Apr 9, 2025
266e079
Broken version of prereq tree
Sailet03 Apr 11, 2025
45f1247
Fixed not rendering anything. Still broken
Sailet03 Apr 11, 2025
abaa804
Working v1
daDevBoat Apr 11, 2025
407425e
handling #prereqs
daDevBoat Apr 11, 2025
764de1d
Merge of Prereq Tree working v1
daDevBoat Apr 11, 2025
cda4065
Test
daDevBoat Apr 11, 2025
0287df4
removed commented out code
Sailet03 Apr 11, 2025
3216309
More info expands now
daDevBoat Apr 11, 2025
a5b6909
More info expands now
daDevBoat Apr 11, 2025
30f7e76
More info expands now
daDevBoat Apr 11, 2025
e748152
Start coding on line 135 in PrereqTreePresenter Mr. PO
daDevBoat Apr 11, 2025
2f067e8
Merge remote-tracking branch 'origin/main' into prereq-oaktree
Sailet03 Apr 16, 2025
88e94f6
Prereqs colored and expands more info
daDevBoat Apr 16, 2025
47e67a8
Prereqs colored and expands more info
daDevBoat Apr 16, 2025
a8ef8ec
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
daDevBoat Apr 16, 2025
810b63f
added css styling
daDevBoat Apr 16, 2025
771b4c9
Fixed copy bug
daDevBoat Apr 16, 2025
a99b4f9
Crash fix in PrerequisitePresenter.jsx
Sailet03 Apr 17, 2025
08fc3b1
Merge remote-tracking branch 'origin/main' into prereq-oaktree
Sailet03 Apr 17, 2025
7569178
merge fix
Sailet03 Apr 17, 2025
87b872d
Prereq tree compression, error handling, debuging, database update
daDevBoat May 6, 2025
c04c5b7
Merge branch 'prereq-oaktree' of github.com:InferenceKTH/Find-My-Next…
daDevBoat May 7, 2025
2f87d3b
Added null support (hopefully)
daDevBoat May 7, 2025
6c5cda2
Merge branch 'main' into prereq-oaktree
daDevBoat May 7, 2025
737e750
Bug fixes
daDevBoat May 8, 2025
f073dd0
Merge branch 'prereq-oaktree' of github.com:InferenceKTH/Find-My-Next…
daDevBoat May 8, 2025
6e68412
Bug fixes ++
daDevBoat May 8, 2025
99b667b
Desplays periods
daDevBoat May 8, 2025
74ab271
Bug fix tree
daDevBoat May 8, 2025
c8aa99f
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
daDevBoat May 8, 2025
024fed7
Bug finally fixed (hopefully)
daDevBoat May 8, 2025
91a4676
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
daDevBoat May 8, 2025
117cbea
Check if course exists before doing pop up
daDevBoat May 8, 2025
cb246e3
Set up for url handling
daDevBoat May 8, 2025
28684bb
Merge branch 'main' into prereq-oaktree
daDevBoat May 8, 2025
c00cfc8
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
daDevBoat May 8, 2025
759be07
URL in progress
daDevBoat May 9, 2025
1be4f5f
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
daDevBoat May 9, 2025
e22cf04
Test
daDevBoat May 9, 2025
e2cb72f
URL fix
daDevBoat May 9, 2025
5ac1405
Fix 2
daDevBoat May 9, 2025
8d98a66
Fix try 3
daDevBoat May 9, 2025
5855fdf
Merge branch 'main' of github.com:InferenceKTH/Find-My-Next-Course in…
daDevBoat May 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions my-app/src/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export const model = {
this._coursesListeners.push(callback);
},

_coursesListeners: [], // internal list of listeners
urlStackPointer: 0,

onCoursesSet(callback) {
this._coursesListeners.push(callback);
},

setUser(user) {
if (!this.user)
this.user = user;
Expand Down Expand Up @@ -297,14 +304,10 @@ export const model = {
},

setPopupOpen(isOpen) {
if (isOpen) {
window.history.pushState({}, '', '/' + this.selectedCourse.code);
}
if (!isOpen) {
let current_url = window.location.href;
console.log(current_url);
let end_idx = indexOfNth(current_url, '/', 3);
if (end_idx >= 0 && end_idx < current_url.length - 1 && current_url.indexOf("#") == -1) {
let end_index = indexOfNth(current_url, '/', 3);
if (end_index + 1 != current_url.length) {
window.history.back();
}
}
Expand All @@ -324,23 +327,18 @@ export const model = {
handleUrlChange() {
let current_url = window.location.href;
let start_idx = indexOfNth(current_url, '/', 3) + 1;
console.log(current_url)

if (start_idx > 0 && start_idx < current_url.length && current_url.indexOf("#") == -1) {
let course_code = current_url.slice(start_idx);
let course = this.getCourse(course_code);
console.log(course_code)
if (course) {
console.log("ACTIVE")
this.setSelectedCourse(course);
this.setPopupOpen(true);
}
console.log("Forward");
} else {
console.log("Back")
this.urlStackPointer++;
} else if (start_idx > 0){
this.setPopupOpen(false);
}
//console.log("back");
}

};
Expand Down
27 changes: 13 additions & 14 deletions my-app/src/presenters/ListViewPresenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,7 @@ const ListViewPresenter = observer(({ model }) => {
setSortedCourses(sorted);
}, [model.currentSearch, sortBy, sortDirection]);


window.addEventListener('popstate', () => {
model.handleUrlChange();
});


function indexOfNth(string, char, n) {
let count = 0;
for (let i = 0; i < string.length; i++) {
Expand All @@ -168,19 +164,22 @@ const ListViewPresenter = observer(({ model }) => {
return -1;
}

window.addEventListener('popstate', () => {
model.handleUrlChange();
});

model.onCoursesSet((courses) => {
let current_url = window.location.href;
if (indexOfNth(current_url, '/', 3) != current_url.length - 1) {
let course_code = "";
let start_index = indexOfNth(current_url, '/', 3) + 1;
if (start_index > 1) {
course_code = current_url.slice(start_index);
}
if (start_index != current_url.length && course_code.length >= 6) {
window.history.replaceState({}, '', '/');
/*
setTimeout(() => {
const newPath = '/' + current_url.slice(indexOfNth(current_url, '/', 3) + 1);
window.history.pushState({}, '', newPath);
}, 50);
}
*/
model.handleUrlChange();
window.history.pushState({}, '', '/' + course_code);
}
model.handleUrlChange();
})

const preP = <PrerequisitePresenter
Expand Down
9 changes: 3 additions & 6 deletions my-app/src/presenters/PrerequisitePresenter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,6 @@ export const PrerequisitePresenter = observer((props) => {
type: node_type,
data: { label: name },
style: {
//padding: 0,
//maxWidth: "100px",
//display: 'inline-block',
//justifyContent: 'center',
//alignItems: 'center',
zIndex: 0
},
position,
Expand Down Expand Up @@ -484,7 +479,9 @@ export const PrerequisitePresenter = observer((props) => {
let copy = JSON.parse(JSON.stringify(props.selectedCourse.prerequisites));
let courses_taken = [];
if (localStorage.getItem("completedCourses") != null) {
courses_taken = localStorage.getItem("completedCourses");
for (let obj of localStorage.getItem("completedCourses")) {
courses_taken.push(obj?.id);
}
}
code_to_name = model.getCourseNames(courses_taken);

Expand Down
5 changes: 2 additions & 3 deletions my-app/src/views/Components/FavouriteDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ const FavouritesDropdown = observer((props) => {
onClick={() => {
props.setSelectedCourse(course);
props.setIsPopupOpen(true);
window.history.pushState({}, '', '/' + course.code);

}}
key={course.code}
className="p-3 hover:bg-indigo-400/50 cursor-pointer flex justify-between items-center w-full border-b border-solid border-violet-400"
Expand Down Expand Up @@ -95,9 +97,6 @@ const FavouritesDropdown = observer((props) => {
</div>

{/* Optional course popup */}
<div className="relative z-50">
{props.isPopupOpen && props.popup}
</div>
</div>
);
});
Expand Down
2 changes: 1 addition & 1 deletion my-app/src/views/ListView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function ListView(props) {
onClick={() => {
props.setSelectedCourse(course);
props.setPopupOpen(true);
//window.history.pushState({}, '', '/' + course.code);
window.history.pushState({}, '', '/' + course.code);
}}
key={course.code}
className="p-5 mb-3 hover:bg-blue-100 flex items-center border border-b-black border-solid w-full rounded-lg cursor-pointer"
Expand Down
4 changes: 3 additions & 1 deletion my-app/src/views/SearchbarView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ function SearchbarView(props) {
{showFavourites && (
<FavouritesDropdown
{...props}
onClick={(e) => e.stopPropagation()}
onClick={
(e) => e.stopPropagation()
}
/>
)}
</div>
Expand Down