Skip to content

Commit

Permalink
Fix gray
Browse files Browse the repository at this point in the history
  • Loading branch information
erica-dong committed Jan 14, 2024
1 parent c0c9f9f commit c8c7e05
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ function Dashboard() {
let y = 0;

function setCourses() {
console.log(data);
tempCourses = [];
tempEdges = [];
let encounteredCodes = new Set();

for (var i = 0; i < data.Report_Entry.length; i++) {
// console.log(data.Report_Entry[i]["Course_Section_Owner"])
if (
data.Report_Entry[i]["Course_Section_Owner"] == department &&
!courseTracking.includes(data.Report_Entry[i]["Course_Title"])
Expand Down
18 changes: 11 additions & 7 deletions src/components/Dashboard/Flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const lerpColor = (h1, h2, progress) => {
}

const getLayoutedElements = (nodes, edges, colorSchema, coursesTaken, options = {}) => {
console.log("changed");
const easyColor = 125;
const hardColor = -50;
const codesLeft = new Set();
Expand All @@ -46,18 +45,21 @@ const getLayoutedElements = (nodes, edges, colorSchema, coursesTaken, options =
children: nodes.map((node) => {
const courseRating = classRatings[node.courseCode] ? classRatings[node.courseCode] : Math.round(Math.random() * 100);
const profRating = profRatings[node.professor] ? profRatings[node.professor] : Math.round(Math.random() * 100);
// shouldn't be nan so often
const projRating = 0.6 * profRating + 0.4 * courseRating;
// console.log(profRatings[node.professor] + " " + node.professor)

let gradRe = new RegExp("[A-Z]{2,3} [5-9][0-9]*")
let style = {};
switch (colorSchema) {
case "tot":
style.backgroundColor = lerpColor(hardColor, easyColor, projRating/100);
style.backgroundColor = lerpColor(hardColor, easyColor, projRating/100.0);
break;
case "prof":
style.backgroundColor = lerpColor(hardColor, easyColor, profRating/100);
style.backgroundColor = lerpColor(hardColor, easyColor, profRating/100.0);
break;
case "course":
style.backgroundColor = lerpColor(hardColor, easyColor, courseRating/100);
style.backgroundColor = lerpColor(hardColor, easyColor, courseRating/100.0);
break;
// case 'level':
// style = {
Expand All @@ -67,6 +69,10 @@ const getLayoutedElements = (nodes, edges, colorSchema, coursesTaken, options =
default:
style = {};
}
if (codesLeft.has(node.courseCode)) {
style.backgroundColor = "rgb(138, 138, 138)";
style.color = "rgb(225, 225, 225)";
}

return {
...node,
Expand Down Expand Up @@ -137,9 +143,7 @@ function FlowWithoutProvider({initialNodes, initialEdges, colorSchema, coursesTa

function onNodeClick(event, node) {
setIsModalOpen(true);
setCourseCode(node.data.label.substring(0, 8));

console.log(node.data.label.substring(0, 8));
setCourseCode(node.courseCode);
// Do something when a node is clicked

};
Expand Down

0 comments on commit c8c7e05

Please sign in to comment.