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
14 changes: 14 additions & 0 deletions FrontEnd/src/components/Proctoring/ProctorMonitor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ const ProctorMonitor = ({
requestFullscreen();
setupEventListeners();
}
} else if (!isActive) {
// When inactive (quiz finished), close modal
console.log('🔴 ProctorMonitor deactivated - closing modal');
setShowIdentityModal(false);
}
};

Expand All @@ -194,6 +198,16 @@ const ProctorMonitor = ({
};
}, [isActive, modelLoaded]);

/**
* Close modal when not active
*/
useEffect(() => {
if (!isActive && showIdentityModal) {
console.log('🔴 Closing identity modal because isActive=false');
setShowIdentityModal(false);
}
}, [isActive, showIdentityModal]);

/**
* Debug: Log camera state changes
*/
Expand Down
50 changes: 18 additions & 32 deletions FrontEnd/src/components/WatchCourse/QuizContent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ const QuizContent = ({
});
}
}}
isActive={showVerificationModal || (hasStarted && !quizResult)}
isActive={!quizResult && (showVerificationModal || hasStarted)}
>
{!hasStarted ? (
<div className="quiz-intro">
Expand Down Expand Up @@ -1025,37 +1025,23 @@ const QuizContent = ({
<span className="btn-icon">🔄</span>
Retake Quiz
</button>
{/* Only show AI explanation button if passed */}
{quizResult.passed && (
<button
className="view-detail-btn"
onClick={() => {
setShowDetailModal(true);
if (!aiExplanations) fetchAIExplanations();
}}
title={
aiExplanations
? "View cached AI explanations"
: "Fetch AI explanations"
}
>
AI Explanations
{aiExplanations && <span className="cached-badge">📦</span>}
</button>
)}
{/* Show answers only button if failed */}
{!quizResult.passed && (
<button
className="view-detail-btn"
onClick={() => {
setShowDetailModal(true);
}}
title="View correct answers"
>
<span className="btn-icon">📝</span>
View Answers
</button>
)}
{/* Always show AI explanation button */}
<button
className="view-detail-btn"
onClick={() => {
setShowDetailModal(true);
if (!aiExplanations) fetchAIExplanations();
}}
title={
aiExplanations
? "View cached AI explanations"
: "Fetch AI explanations"
}
>
<span className="btn-icon">🤖</span>
AI Explanations
{aiExplanations && <span className="cached-badge">📦</span>}
</button>
</div>
)}
</div>
Expand Down