Skip to content

Commit 02a3e61

Browse files
committed
Add functionality for "Match Me Again"
Send user to queue with the same criteria when they click match me again upon unsuccessful match
1 parent 713d939 commit 02a3e61

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Frontend/src/components/Sidebar.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ function Sidebar() {
6363
const handleMatch = () => {
6464
if (ws && difficulty && language) {
6565
setShowMatching(true);
66+
setShowUnsuccessfulMatch(false);
6667
ws.send(JSON.stringify({ userId, difficulty, language })); // Send to server
6768
} else {
6869
alert('Please select a difficulty and language.');
@@ -111,7 +112,7 @@ function Sidebar() {
111112
</Modal>
112113

113114
<Modal show={showUnsuccessfulMatch} onHide={handleCloseUnsuccessfulMatch} backdrop="static" className="custom-modal" centered>
114-
<UnsuccessfulMatch handleClose={handleCloseUnsuccessfulMatch}/>
115+
<UnsuccessfulMatch handleClose={handleCloseUnsuccessfulMatch} handleMatch={handleMatch}/>
115116
</Modal>
116117
</Stack>
117118
);

Frontend/src/components/matching/UnsuccessfulMatch.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import React, { useState } from 'react';
22
import CloseButton from 'react-bootstrap/esm/CloseButton';
33

4-
function UnsuccessfulMatch({ handleClose }) {
4+
function UnsuccessfulMatch({ handleClose, handleMatch}) {
55
return (
66
<div className="matching-container">
77
<div className="close-button" onClick={handleClose}></div>
88
<div className="matching-text">
99
<CloseButton className="close-button" onClick={handleClose}></CloseButton>
1010
<h2>Sorry, we are unable to find you a match.</h2>
11-
{/*<button className='btn btn-primary btn-sm'>Match me again</button>*/}
11+
<button className='btn btn-primary btn-sm' onClick={handleMatch}>Match me again</button>
1212
</div>
1313
</div>
1414
);

0 commit comments

Comments
 (0)