-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from CS3219-AY2425S1/branch-MatchingServiceUI
Branch matching service UI
- Loading branch information
Showing
14 changed files
with
409 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
75 changes: 75 additions & 0 deletions
75
peerprep/frontend/src/views/MatchingServiceViews/MatchingServiceMainView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { useNavigate, Link } from "react-router-dom"; | ||
import React, { useState, useEffect } from 'react'; | ||
|
||
|
||
const MatchingServiceMainView: React.FC = () => { | ||
// State for topic and difficulty | ||
const [topic, setTopic] = useState<string>(''); | ||
const [difficulty, setDifficulty] = useState<string>(''); | ||
|
||
// Handle input changes | ||
const handleTopicChange = (e: React.ChangeEvent<HTMLSelectElement>) => { | ||
setTopic(e.target.value); | ||
}; | ||
|
||
const handleDifficultyChange = (e: React.ChangeEvent<HTMLSelectElement>) => { | ||
setDifficulty(e.target.value); | ||
}; | ||
|
||
// Handle form submission | ||
const handleSubmit = (e: React.FormEvent) => { | ||
e.preventDefault(); | ||
// Replace placeholder alert with actual matching logic | ||
alert(`Matching for Topic: ${topic}, Difficulty: ${difficulty}`); | ||
// Reset state | ||
setTopic(''); | ||
setDifficulty(''); | ||
}; | ||
|
||
return ( | ||
<div className="matching-container"> | ||
<Link to="/" className="top-left-link">Go to Login</Link> | ||
<Link to="/questions" className="top-right-link">Go to Questions</Link> | ||
<div className="matching-form"> | ||
<h2>Select a Topic and Difficulty</h2> | ||
<form onSubmit={handleSubmit}> | ||
<div className="form-section category-group"> | ||
<select | ||
name="topic" | ||
value={topic} | ||
onChange={handleTopicChange} | ||
required | ||
> | ||
<option value="">Select Topic</option> | ||
<option value="algorithms">Algorithms</option> | ||
<option value="data-structures">Data Structures</option> | ||
<option value="dynamic-programming">Dynamic Programming</option> | ||
<option value="graphs">Graphs</option> | ||
<option value="strings">Strings</option> | ||
</select> | ||
</div> | ||
|
||
<div className="form-section"> | ||
<select | ||
name="difficulty" | ||
value={difficulty} | ||
onChange={handleDifficultyChange} | ||
required | ||
> | ||
<option value="">Select Difficulty</option> | ||
<option value="easy">Easy</option> | ||
<option value="medium">Medium</option> | ||
<option value="hard">Hard</option> | ||
</select> | ||
</div> | ||
|
||
<button type="submit" className="submit-btn"> | ||
Submit | ||
</button> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MatchingServiceMainView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
peerprep/frontend/src/views/QuestionList.tsx → ...ews/QuestionServiceViews/QuestionList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.