Skip to content

Commit 2a23b3e

Browse files
committed
small fixes: prereq tree edges, now you have to click the tree to interact with it
1 parent 0ab7cb2 commit 2a23b3e

3 files changed

Lines changed: 31 additions & 15 deletions

File tree

my-app/src/presenters/PrerequisitePresenter.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export const PrerequisitePresenter = observer((props) => {
9797
);
9898

9999
return (
100-
<div style={{ width: "100%", height: "500px" }}>
100+
<div className="w-full h-[500px] rounded-lg">
101101
<ReactFlow
102102
nodes={nodes}
103103
edges={edges}
@@ -106,7 +106,7 @@ export const PrerequisitePresenter = observer((props) => {
106106
onConnect={onConnect}
107107
connectionLineType={ConnectionLineType.SmoothStep}
108108
fitView
109-
style={{ backgroundColor: '#F7F9FB' }}
109+
style={{ backgroundColor: 'white', borderRadius: '10px'}}
110110
nodesDraggable={false}
111111
nodesConnectable={false}
112112
elementsSelectable={true}

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

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect, useRef } from 'react';
1+
import React, { useEffect, useRef, useState } from 'react';
22

33
function CoursePagePopup({
44
favouriteCourses,
@@ -10,6 +10,7 @@ function CoursePagePopup({
1010
reviewPresenter,
1111
}) {
1212
const treeRef = useRef(null);
13+
const [showOverlay, setShowOverlay] = useState(true);
1314

1415
useEffect(() => {
1516
const handleKeyDown = (event) => {
@@ -40,7 +41,10 @@ function CoursePagePopup({
4041
>
4142
<div
4243
className="bg-indigo-300/75 backdrop-blur-lg h-full w-3/4 flex flex-col overflow-auto"
43-
onClick={(e) => e.stopPropagation()}
44+
onClick={(e) => {
45+
e.stopPropagation();
46+
setShowOverlay(true);
47+
}}
4448
>
4549
<div className="flex-1">
4650
<div className="px-10 py-10 md:px-20 md:py-16 text-slate-900 space-y-12 font-sans">
@@ -97,15 +101,27 @@ function CoursePagePopup({
97101
{/* Prerequisite Graph Tree Section */}
98102
<div>
99103
<h3 className="text-2xl font-semibold text-[#2e2e4f] mb-0.5">Prerequisite Graph Tree</h3>
100-
<div className="mb-4 h-0.5 w-full bg-violet-500"></div>
101-
<div
102-
className="bg-indigo-300/50 outline-none focus:outline-none focus:ring-2 focus:ring-violet-600 rounded-lg transition-shadow"
103-
ref={treeRef}
104-
onClick={handleTreeClick}
105-
tabIndex={0}
106-
>
107-
{prerequisiteTree}
108-
</div>
104+
<div className="mb-4 h-0.5 w-full bg-violet-500 rounded-lg"></div>
105+
<div className="relative rounded-lg">
106+
{showOverlay && (
107+
<div
108+
className="absolute inset-0 z-10 bg-indigo-200/10 rounded-lg cursor-pointer flex items-center justify-center z-51"
109+
onClick={(e) => {
110+
e.stopPropagation();
111+
setShowOverlay(false);
112+
}}
113+
>
114+
</div>
115+
)}
116+
<div
117+
className="bg-indigo-300/50 outline-none focus:outline-none focus:ring-2 focus:ring-violet-600 rounded-lg transition-shadow"
118+
ref={treeRef}
119+
onClick={handleTreeClick}
120+
tabIndex={0}
121+
>
122+
{prerequisiteTree}
123+
</div>
124+
</div>
109125
</div>
110126
{/* Reviews Section (optional) */}
111127
{reviewPresenter && (

my-app/src/views/PrerequisiteTreeView.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from "react";
22
import ReactFlow, { MiniMap, Controls, Background } from "reactflow";
33
import "reactflow/dist/style.css";
44

5-
function PrerequisiteTreeView(props){
5+
function PrerequisiteTreeView(props) {
66
return (
7-
<div style={{ width: "100%", height: "500px" }}>
7+
<div className="w-full h-[500px] rounded-lg">
88
<ReactFlow nodes={props.initialNodes} edges={props.initialEdges} fitView>
99
<MiniMap />
1010
<Controls />

0 commit comments

Comments
 (0)