From c10ed3c4beb3023a29c0f0d09730db89c862d2b2 Mon Sep 17 00:00:00 2001 From: "Jiaqi (Jacky) Wang" Date: Tue, 26 Dec 2023 12:07:22 -0800 Subject: [PATCH 01/10] fix: incorrect time zone for last updated time --- manifests/prod/cronjob.yml | 2 +- static/js/redux/ui/Semesterly.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/prod/cronjob.yml b/manifests/prod/cronjob.yml index e65523c0f2..64182c0ea1 100644 --- a/manifests/prod/cronjob.yml +++ b/manifests/prod/cronjob.yml @@ -14,7 +14,7 @@ spec: containers: - image: semesterly.azurecr.io/semesterly:Version name: gunicorn-cron - command: ["/bin/bash","/code/run_parser.sh"] + command: ["/bin/bash", "/code/run_parser.sh"] workingDir: /code envFrom: - secretRef: diff --git a/static/js/redux/ui/Semesterly.tsx b/static/js/redux/ui/Semesterly.tsx index 592f413d7e..c7282c1dcf 100644 --- a/static/js/redux/ui/Semesterly.tsx +++ b/static/js/redux/ui/Semesterly.tsx @@ -128,7 +128,7 @@ const Semesterly = () => { // DataLastUpdated Input example- 2021-05-02 14:42 UTC // Params: How the backend sends a timestamp // dateString: of the form yyyy-mm-dd hh:mm - const dateString = dataLastUpdated.toString().slice(0, -4); // exclude UTC + const dateString = dataLastUpdated.toString(); if (!dateString || dateString.length === 0) return ""; From 15e098e05773790a24475a550def9fa3f3f9c6a8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Jan 2024 11:55:15 -0500 Subject: [PATCH 02/10] newsmodal: added 'any' type declaration to timetablenameinput and coursemodalbody. added default values for NewsModal title and body. --- static/js/redux/ui/TimetableNameInput.tsx | 4 ++-- static/js/redux/ui/modals/CourseModalBody.tsx | 2 +- static/js/redux/ui/modals/NewsModal.tsx | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/static/js/redux/ui/TimetableNameInput.tsx b/static/js/redux/ui/TimetableNameInput.tsx index 5c8ae8d8c5..d2d9a68394 100644 --- a/static/js/redux/ui/TimetableNameInput.tsx +++ b/static/js/redux/ui/TimetableNameInput.tsx @@ -14,7 +14,7 @@ GNU General Public License for more details. import React, { useState, useEffect, useCallback, useRef } from "react"; import classnames from "classnames"; -import { useSelector } from "react-redux"; +import { AnyIfEmpty, useSelector } from "react-redux"; import { useActions } from "../hooks"; import { signupModalActions } from "../state/slices/signupModalSlice"; import { RootState } from "../state/index"; @@ -46,7 +46,7 @@ const TimetableNameInput = () => { }; const handleEnterKeyPressed = useCallback( - (e) => { + (e: any) => { // save course when user pressed enter if (inputRef && e.key === "Enter") { setTimetableName(); diff --git a/static/js/redux/ui/modals/CourseModalBody.tsx b/static/js/redux/ui/modals/CourseModalBody.tsx index 44d27e0ecf..b9506b7bc4 100644 --- a/static/js/redux/ui/modals/CourseModalBody.tsx +++ b/static/js/redux/ui/modals/CourseModalBody.tsx @@ -107,7 +107,7 @@ const CourseModalBody = (props: CourseModalBodyProps) => { }); const handleKeyPress = useCallback( - (e) => { + (e: any) => { if (e.key === "ArrowRight") { setCurrentHoveredSection((prevSection) => prevSection < sectionList.length - 1 ? prevSection + 1 : prevSection diff --git a/static/js/redux/ui/modals/NewsModal.tsx b/static/js/redux/ui/modals/NewsModal.tsx index d3cc098762..ad57a255ac 100644 --- a/static/js/redux/ui/modals/NewsModal.tsx +++ b/static/js/redux/ui/modals/NewsModal.tsx @@ -27,6 +27,7 @@ const NewsModal = () => { useEffect(() => { const tutorialData = JSON.parse(localStorage.getItem("tutorial")); if (!tutorialData || !tutorialData.modalTutShown || isSigningUp) { + console.log("NOT FETCHING"); return; } @@ -41,11 +42,13 @@ const NewsModal = () => { localStorage.setItem("lastViewedNewsDate", new Date(Date.now()).toISOString()); } - setNewsTitle(data.title); - setNewsBody(data.body); + setNewsTitle(data.title === "" ? "No news at the moment!" : data.title); + setNewsBody(data.body === "" ? "Please check back again later." : data.body); }; fetchData(); + + console.log("FETCHED NEWS"); }, []); const modalHeader = ( From 95a1212a2c2cde698a92ad125f114a295a456edf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Jan 2024 12:06:32 -0500 Subject: [PATCH 03/10] newsmodal: fetch data regardless of tutorial status, but only display modal via appropriate criteria --- static/js/redux/ui/modals/NewsModal.tsx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/static/js/redux/ui/modals/NewsModal.tsx b/static/js/redux/ui/modals/NewsModal.tsx index ad57a255ac..39d758d687 100644 --- a/static/js/redux/ui/modals/NewsModal.tsx +++ b/static/js/redux/ui/modals/NewsModal.tsx @@ -26,17 +26,14 @@ const NewsModal = () => { useEffect(() => { const tutorialData = JSON.parse(localStorage.getItem("tutorial")); - if (!tutorialData || !tutorialData.modalTutShown || isSigningUp) { - console.log("NOT FETCHING"); - return; - } + const displayCriteria = tutorialData && tutorialData.modalTutShown && !isSigningUp; const fetchData = async () => { const response = await fetch(getNewsEndpoint()); const data = await response.json(); // Only display modal if the news was posted after the last viewed time - if (data.date && new Date(data.date) > lastViewedTime) { + if (data.date && new Date(data.date) > lastViewedTime && displayCriteria) { dispatch(newsModalActions.showNewsModal()); // Set to current date and time localStorage.setItem("lastViewedNewsDate", new Date(Date.now()).toISOString()); @@ -47,8 +44,6 @@ const NewsModal = () => { }; fetchData(); - - console.log("FETCHED NEWS"); }, []); const modalHeader = ( From 97f42b44918ab4f0d7054183b450d361f7fd0aa5 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Jan 2024 12:37:51 -0500 Subject: [PATCH 04/10] newsmodal: reverted bad changes --- package-lock.json | 24 ++++++++++++++----- static/js/redux/ui/TimetableNameInput.tsx | 2 +- static/js/redux/ui/modals/CourseModalBody.tsx | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index fffa5f1efa..323b983d93 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7205,6 +7205,7 @@ "version": "1.5.0", "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, "requires": { "file-uri-to-path": "1.0.0" } @@ -8122,6 +8123,7 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "optional": true, "requires": { "bindings": "^1.5.0", "nan": "^2.12.1" @@ -8130,7 +8132,8 @@ "nan": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==" + "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "optional": true } } }, @@ -12986,7 +12989,8 @@ "fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==" + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "optional": true }, "function-bind": { "version": "1.1.0", @@ -18639,6 +18643,7 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "optional": true, "requires": { "bindings": "^1.5.0", "nan": "^2.12.1" @@ -18647,7 +18652,8 @@ "nan": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==" + "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "optional": true } } }, @@ -28414,6 +28420,7 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "optional": true, "requires": { "bindings": "^1.5.0", "nan": "^2.12.1" @@ -28422,7 +28429,8 @@ "nan": { "version": "2.18.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==" + "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "optional": true } } }, @@ -32625,6 +32633,7 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "optional": true, "requires": { "bindings": "^1.5.0", "nan": "^2.12.1" @@ -32777,7 +32786,8 @@ "nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "optional": true }, "pako": { "version": "1.0.11", @@ -33967,6 +33977,7 @@ "version": "1.2.13", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", + "optional": true, "requires": { "bindings": "^1.5.0", "nan": "^2.12.1" @@ -34147,7 +34158,8 @@ "nan": { "version": "2.15.0", "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", - "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==" + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "optional": true }, "negotiator": { "version": "0.6.2", diff --git a/static/js/redux/ui/TimetableNameInput.tsx b/static/js/redux/ui/TimetableNameInput.tsx index d2d9a68394..c5a5a07c8b 100644 --- a/static/js/redux/ui/TimetableNameInput.tsx +++ b/static/js/redux/ui/TimetableNameInput.tsx @@ -46,7 +46,7 @@ const TimetableNameInput = () => { }; const handleEnterKeyPressed = useCallback( - (e: any) => { + (e) => { // save course when user pressed enter if (inputRef && e.key === "Enter") { setTimetableName(); diff --git a/static/js/redux/ui/modals/CourseModalBody.tsx b/static/js/redux/ui/modals/CourseModalBody.tsx index b9506b7bc4..44d27e0ecf 100644 --- a/static/js/redux/ui/modals/CourseModalBody.tsx +++ b/static/js/redux/ui/modals/CourseModalBody.tsx @@ -107,7 +107,7 @@ const CourseModalBody = (props: CourseModalBodyProps) => { }); const handleKeyPress = useCallback( - (e: any) => { + (e) => { if (e.key === "ArrowRight") { setCurrentHoveredSection((prevSection) => prevSection < sectionList.length - 1 ? prevSection + 1 : prevSection From 2e15771a571bc50cc407740fcd4ab977819cf74c Mon Sep 17 00:00:00 2001 From: root Date: Thu, 4 Jan 2024 12:39:57 -0500 Subject: [PATCH 05/10] newsmodal: removed accidental import statement in TimetableNameInput.tsx --- static/js/redux/ui/TimetableNameInput.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/redux/ui/TimetableNameInput.tsx b/static/js/redux/ui/TimetableNameInput.tsx index c5a5a07c8b..5c8ae8d8c5 100644 --- a/static/js/redux/ui/TimetableNameInput.tsx +++ b/static/js/redux/ui/TimetableNameInput.tsx @@ -14,7 +14,7 @@ GNU General Public License for more details. import React, { useState, useEffect, useCallback, useRef } from "react"; import classnames from "classnames"; -import { AnyIfEmpty, useSelector } from "react-redux"; +import { useSelector } from "react-redux"; import { useActions } from "../hooks"; import { signupModalActions } from "../state/slices/signupModalSlice"; import { RootState } from "../state/index"; From 41571becb04bed233c5fff6796893dda7e8a0668 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Jan 2024 00:04:58 -0500 Subject: [PATCH 06/10] date readability: reformatted 'date last updated' to be more user-friendly --- static/js/redux/ui/Semesterly.tsx | 35 +++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/static/js/redux/ui/Semesterly.tsx b/static/js/redux/ui/Semesterly.tsx index 592f413d7e..9602d1df9d 100644 --- a/static/js/redux/ui/Semesterly.tsx +++ b/static/js/redux/ui/Semesterly.tsx @@ -133,8 +133,39 @@ const Semesterly = () => { if (!dateString || dateString.length === 0) return ""; // Convert given datetime to local datetime of user - // in form yyyy-mm-dd hh:mm TZ (Timezone full name) - return new Date(dateString).toString(); + // in form (month) dd, yyyy + + const curDate: Date = new Date(dateString); + + const months = [ + 'January', 'February', 'March', 'April', + 'May', 'June', 'July', 'August', + 'September', 'October', 'November', 'December' + ]; + + let dayEnding: String; + const curDay = curDate.getDay(); + if (curDay >= 11 && curDay <= 13) { + dayEnding = 'th'; + } + + switch (curDay % 10) { + case 1: + dayEnding = 'st'; + break; + case 2: + dayEnding = 'nd'; + break; + case 3: + dayEnding = 'rd'; + break; + default: + dayEnding = 'th'; + } + + const monthIndex: number= curDate.getMonth(); + + return `${months[monthIndex]} ${curDate.getUTCDate()}${dayEnding}, ${curDate.getFullYear()}`; }; const mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( From 98737c6b3fe70c4eef885805e388f05919686faa Mon Sep 17 00:00:00 2001 From: root Date: Fri, 5 Jan 2024 00:09:22 -0500 Subject: [PATCH 07/10] date readadbility: ran prettier --- static/js/redux/ui/Semesterly.tsx | 33 ++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/static/js/redux/ui/Semesterly.tsx b/static/js/redux/ui/Semesterly.tsx index 9602d1df9d..cc8c3b3cee 100644 --- a/static/js/redux/ui/Semesterly.tsx +++ b/static/js/redux/ui/Semesterly.tsx @@ -138,34 +138,45 @@ const Semesterly = () => { const curDate: Date = new Date(dateString); const months = [ - 'January', 'February', 'March', 'April', - 'May', 'June', 'July', 'August', - 'September', 'October', 'November', 'December' + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December", ]; let dayEnding: String; const curDay = curDate.getDay(); if (curDay >= 11 && curDay <= 13) { - dayEnding = 'th'; + dayEnding = "th"; } - + switch (curDay % 10) { case 1: - dayEnding = 'st'; + dayEnding = "st"; break; case 2: - dayEnding = 'nd'; + dayEnding = "nd"; break; case 3: - dayEnding = 'rd'; + dayEnding = "rd"; break; default: - dayEnding = 'th'; + dayEnding = "th"; } - const monthIndex: number= curDate.getMonth(); + const monthIndex: number = curDate.getMonth(); - return `${months[monthIndex]} ${curDate.getUTCDate()}${dayEnding}, ${curDate.getFullYear()}`; + return `${ + months[monthIndex] + } ${curDate.getUTCDate()}${dayEnding}, ${curDate.getFullYear()}`; }; const mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( From 1b73d67548e263e41552e76b70d38929a64c7ee3 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 7 Jan 2024 12:28:45 -0500 Subject: [PATCH 08/10] sidebar hotfix: update logic to change hoveredCourse to -1 when user clicks out --- static/js/redux/ui/SideBar.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/static/js/redux/ui/SideBar.tsx b/static/js/redux/ui/SideBar.tsx index 643702c3dc..f33432204b 100644 --- a/static/js/redux/ui/SideBar.tsx +++ b/static/js/redux/ui/SideBar.tsx @@ -79,6 +79,10 @@ const SideBar = () => { const hideDropdown = () => { setShowDropdown(false); + + // * Set hoveredCourse to -1 if user clicks out + setHoveredCourse(-1); + console.log(`hovered course index: ${hoveredCourse}`); }; const toggleDropdown = () => { @@ -91,6 +95,8 @@ const SideBar = () => { callback(); }; + console.log(`hovered course index: ${hoveredCourse}`); + const mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ); @@ -184,6 +190,7 @@ const SideBar = () => { ) { // i.e. a course was removed and last course was hovered setHoveredCourse((prevIndex) => prevIndex - 1); + console.log(`hovered course index: ${hoveredCourse}`); } setMasterSlotListLength(masterSlotList.length); }, [masterSlotList]); @@ -194,15 +201,18 @@ const SideBar = () => { if (e.key === "ArrowUp") { if (hoveredCourse > -1) { setHoveredCourse((prevHoveredCourse) => prevHoveredCourse - 1); + console.log(`hovered course index: ${hoveredCourse}`); } } else if (e.key === "ArrowDown") { if (hoveredCourse < masterSlotListLength - 1) { setHoveredCourse((prevHoveredCourse) => prevHoveredCourse + 1); + console.log(`hovered course index: ${hoveredCourse}`); } } else if (e.key === "Enter" && hoveredCourse > -1) { dispatch(fetchCourseInfo(masterSlotList[hoveredCourse])); } else if (e.key === "Backspace" && hoveredCourse > -1) { dispatch(addOrRemoveCourse(masterSlotList[hoveredCourse])); + console.log(`hovered course index: ${hoveredCourse}`); } }, [hoveredCourse, masterSlotListLength] From 65f3c8a9f9b8272cdc69419df27ad78933e43c06 Mon Sep 17 00:00:00 2001 From: root Date: Sun, 7 Jan 2024 12:30:23 -0500 Subject: [PATCH 09/10] sidebar hotfix: remove console.log statements --- static/js/redux/ui/SideBar.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/static/js/redux/ui/SideBar.tsx b/static/js/redux/ui/SideBar.tsx index f33432204b..ae479ddada 100644 --- a/static/js/redux/ui/SideBar.tsx +++ b/static/js/redux/ui/SideBar.tsx @@ -82,7 +82,6 @@ const SideBar = () => { // * Set hoveredCourse to -1 if user clicks out setHoveredCourse(-1); - console.log(`hovered course index: ${hoveredCourse}`); }; const toggleDropdown = () => { @@ -95,8 +94,6 @@ const SideBar = () => { callback(); }; - console.log(`hovered course index: ${hoveredCourse}`); - const mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test( navigator.userAgent ); @@ -190,7 +187,6 @@ const SideBar = () => { ) { // i.e. a course was removed and last course was hovered setHoveredCourse((prevIndex) => prevIndex - 1); - console.log(`hovered course index: ${hoveredCourse}`); } setMasterSlotListLength(masterSlotList.length); }, [masterSlotList]); @@ -201,18 +197,15 @@ const SideBar = () => { if (e.key === "ArrowUp") { if (hoveredCourse > -1) { setHoveredCourse((prevHoveredCourse) => prevHoveredCourse - 1); - console.log(`hovered course index: ${hoveredCourse}`); } } else if (e.key === "ArrowDown") { if (hoveredCourse < masterSlotListLength - 1) { setHoveredCourse((prevHoveredCourse) => prevHoveredCourse + 1); - console.log(`hovered course index: ${hoveredCourse}`); } } else if (e.key === "Enter" && hoveredCourse > -1) { dispatch(fetchCourseInfo(masterSlotList[hoveredCourse])); } else if (e.key === "Backspace" && hoveredCourse > -1) { dispatch(addOrRemoveCourse(masterSlotList[hoveredCourse])); - console.log(`hovered course index: ${hoveredCourse}`); } }, [hoveredCourse, masterSlotListLength] From 75199de1c8b3a86a33ca6cdd4009e7ca8342c48a Mon Sep 17 00:00:00 2001 From: root Date: Mon, 12 Feb 2024 21:51:09 -0500 Subject: [PATCH 10/10] edited showNewsModal reducer to log last time user saw news --- static/js/redux/state/slices/newsModalSlice.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/static/js/redux/state/slices/newsModalSlice.ts b/static/js/redux/state/slices/newsModalSlice.ts index 029997d31b..82bdda7f9d 100644 --- a/static/js/redux/state/slices/newsModalSlice.ts +++ b/static/js/redux/state/slices/newsModalSlice.ts @@ -16,6 +16,7 @@ const newsModalSlice = createSlice({ state.isVisible = false; }, showNewsModal: (state) => { + localStorage.setItem("lastViewedNewsDate", new Date(Date.now()).toISOString()); // ! state.isVisible = true; }, },