Skip to content

Commit

Permalink
Merge pull request #96 from CS3219-AY2324S1/match-popup-notsuccess
Browse files Browse the repository at this point in the history
match not success output
  • Loading branch information
aishh12 authored Nov 15, 2023
2 parents 478b66d + 8f28948 commit 3b29015
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Frontend/src/Components/Matching/MatchPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import './MatchPopup.css'; // Ensure this path is correct
import { LoadPopup } from './LoadPopup';
import { getUserId } from '../../User/UserState';
import { useNavigate } from 'react-router-dom';
import { NotSuccessOutput } from './NotSuccessOutput';

const MatchPopup = ({ isOpen, isClose }) => {
const [goToLoadPopup, setGoToLoadPopup] = useState(false);
const [showSuccessOutput, setShowSuccessOutput] = useState(false);
const [collaboratorId, setCollaboratorId] = useState(null);
const navigate = useNavigate();
const [showNotSuccessOutput, setShowNotSuccessOutput] = useState(false);

// States for the matching criteria
const [chosenDifficulty, setChosenDifficulty] = useState("None");
Expand Down Expand Up @@ -56,12 +58,15 @@ const MatchPopup = ({ isOpen, isClose }) => {
} else {
console.log("No match found");
setShowSuccessOutput(false); // SuccessOutput popup does not show
setShowNotSuccessOutput(true); // Triggers the NotSuccessOutput popup

}
// setGoToLoadPopup(false); // Close the loading popup
})
.catch(error => {
console.error("Error finding a match: ", error);
setGoToLoadPopup(false); // Close the loading popup
setShowNotSuccessOutput(true); // Triggers the NotSuccessOutput popup

});
};
Expand Down Expand Up @@ -120,6 +125,8 @@ const MatchPopup = ({ isOpen, isClose }) => {

{showSuccessOutput &&
<SuccessOutput isOpen={true} isClose={() => setShowSuccessOutput(false)} />}
{showNotSuccessOutput &&
<NotSuccessOutput isOpen={true} isClose={() => setShowNotSuccessOutput(false)} />}
</div>
);
}
Expand Down
22 changes: 22 additions & 0 deletions Frontend/src/Components/Matching/NotSuccessOutput.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from 'react';
import './Output.css';
import error_icon from '../Assets/cross.png';

export const NotSuccessOutput = ({ isOpen, isClose }) => {
if (isOpen) {
return (
<div className="output-overlay">
<div className="output-popup">
<h3>Not Match Found!</h3>
<img src={error_icon} className="image" alt="Error icon" />
<p>Try Again!</p>
<div>
<button onClick={isClose} className="complete-matching">Okay</button>
</div>
</div>
</div>
);
}
return null;
};

0 comments on commit 3b29015

Please sign in to comment.