Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion my-app/src/styles.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "tailwindcss";
@import "tailwindcss";
42 changes: 38 additions & 4 deletions my-app/src/views/Components/CoursePagePopup.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
import React from 'react';
import React, { useEffect, useRef } from 'react'

function CoursePagePopup({ isOpen, onClose, course, prerequisiteTree }) {

const treeRef = useRef(null);
useEffect(() => {
const handleKeyDown = (event) => {
if (event.key === 'Escape') {
onClose();
}
};

if (isOpen) {
window.addEventListener('keydown', handleKeyDown);
}

return () => {
window.removeEventListener('keydown', handleKeyDown);
};
}, [isOpen, onClose]);

const handleTreeClick = () => {
if (treeRef.current) {
treeRef.current.focus(); // gives it focus
}
};

if (!isOpen || !course) return null; // Don't render if not open or course not selected
return (
<div
Expand Down Expand Up @@ -43,16 +67,26 @@ function CoursePagePopup({ isOpen, onClose, course, prerequisiteTree }) {
className="text-lg leading-8 text-[#2e2e4f] font-semibold tracking-wide prose prose-slate max-w-full"
dangerouslySetInnerHTML={{ __html: course.description }}
/>

</div>

{/* Prerequisite Graph Tree Section */}
<div>
<h3 className="text-2xl font-semibold text-[#2e2e4f] mb-0.5">Prerequisite Graph Tree</h3>

<h3 className="text-2xl font-semibold text-[#2e2e4f] mb-0.5">
Prerequisite Graph Tree
</h3>
<div className="mb-4 h-0.5 w-full bg-violet-500"></div>
<div className="bg-indigo-300/50">
<div
className="bg-indigo-300/50 outline-none focus:outline-none focus:ring-2 focus:ring-violet-600 rounded-lg transition-shadow"
ref={treeRef}
onClick={handleTreeClick}
tabIndex={0} // allows the div to receive focus
>
{prerequisiteTree}
</div>


</div>
{/* Reviews Section */}
<div>
Expand Down