Skip to content

Commit 5d4bb0f

Browse files
LSKprkexanaDinoxhSailet03daDevBoat
authored
Prereq oaktree (#133)
* sidebar component add * tailwind workin, beggining page building * structure * fixed app * Main design layout * initial sidebar * courseView init * the course page initial tests * Make it run on my comuter * Tree without database integration * fixes * npm update * add to page * Biiiiig Refactoring * Broken version of prereq tree * Fixed not rendering anything. Still broken * Working v1 * handling #prereqs * Test * removed commented out code * More info expands now * More info expands now * More info expands now * Start coding on line 135 in PrereqTreePresenter Mr. PO * Prereqs colored and expands more info * added css styling * Fixed copy bug * Crash fix in PrerequisitePresenter.jsx * merge fix * Prereq tree compression, error handling, debuging, database update * Added null support (hopefully) * Bug fixes * Desplays periods * Bug finally fixed (hopefully) * Check if course exists before doing pop up * Set up for url handling * URL in progress * URL fix * Fix try 3 * URL fix again because LSK hates DNS * Update PrerequisitePresenter.jsx --------- Co-authored-by: kexana <deotsts@gmail.com> Co-authored-by: Sami Al Saati <sami.alsaati@hotmail.com> Co-authored-by: Kacper Lisik <lisik@kth.se> Co-authored-by: Elias Tosteberg <elias.tosteberg@gmail.com> Co-authored-by: Sailet03 <52610280+Sailet03@users.noreply.github.com> Co-authored-by: daDevBoat <elias.richard.naess@gmail.com> Co-authored-by: daDevBoat <113507675+daDevBoat@users.noreply.github.com>
1 parent 3bdd25f commit 5d4bb0f

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

my-app/src/model.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ export const model = {
326326

327327
handleUrlChange() {
328328
let current_url = window.location.href;
329-
let start_idx = indexOfNth(current_url, '/', 3) + 1;
329+
let start_idx = indexOfNth(current_url, '/', 3) + 2;
330330

331-
if (start_idx > 0 && start_idx < current_url.length && current_url.indexOf("#") == -1) {
331+
if (start_idx > 0 && start_idx < current_url.length) {
332332
let course_code = current_url.slice(start_idx);
333333
let course = this.getCourse(course_code);
334334
if (course) {

my-app/src/presenters/ListViewPresenter.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,15 @@ const ListViewPresenter = observer(({ model }) => {
170170

171171
model.onCoursesSet((courses) => {
172172
let current_url = window.location.href;
173+
if (current_url.indexOf("#") != -1) {return;}
173174
let course_code = "";
174-
let start_index = indexOfNth(current_url, '/', 3) + 1;
175+
let start_index = indexOfNth(current_url, '/', 3) + 2;
175176
if (start_index > 1) {
176177
course_code = current_url.slice(start_index);
177178
}
178179
if (start_index != current_url.length && course_code.length >= 6) {
179180
window.history.replaceState({}, '', '/');
180-
window.history.pushState({}, '', '/' + course_code);
181+
window.history.pushState({}, '', '/?' + course_code);
181182
}
182183
model.handleUrlChange();
183184
})

my-app/src/presenters/PrerequisitePresenter.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ export const PrerequisitePresenter = observer((props) => {
480480
let courses_taken = [];
481481
if (localStorage.getItem("completedCourses") != null) {
482482
for (let obj of localStorage.getItem("completedCourses")) {
483-
courses_taken.push(obj?.id);
483+
courses_taken.push(obj?.id);
484484
}
485485
}
486486
code_to_name = model.getCourseNames(courses_taken);

my-app/src/views/Components/FavouriteDropdown.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const FavouritesDropdown = observer((props) => {
4040
onClick={() => {
4141
props.setSelectedCourse(course);
4242
props.setIsPopupOpen(true);
43-
window.history.pushState({}, '', '/' + course.code);
43+
window.history.pushState({}, '', '/?' + course.code);
4444

4545
}}
4646
key={course.code}

my-app/src/views/ListView.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ function ListView(props) {
176176
onClick={() => {
177177
props.setSelectedCourse(course);
178178
props.setPopupOpen(true);
179-
window.history.pushState({}, '', '/' + course.code);
179+
window.history.pushState({}, '', '/?' + course.code);
180180
}}
181181
key={course.code}
182182
className="p-5 mb-3 hover:bg-blue-100 flex items-center bg-white w-full rounded-lg cursor-pointer shadow-md hover:shadow-lg transition-shadow duration-300"

0 commit comments

Comments
 (0)