Skip to content

Commit 661f68f

Browse files
authored
Merge pull request #99 from CS3219-AY2324S1/assignment1
Assignment-1 Submission
2 parents ca11b2c + 1c46097 commit 661f68f

File tree

11,228 files changed

+2233023
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

11,228 files changed

+2233023
-141
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.dropdown-menu select {
2+
min-width: 50px;
3+
width: fit-content;
4+
height: 35px;
5+
text-align: center;
6+
font-size: 15px;
7+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
8+
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
9+
sans-serif;
10+
background: #e0dfdf;
11+
outline: none;
12+
border: none;
13+
border-bottom: 1px solid;
14+
background: #e0dfdf;
15+
}
16+

Frontend/src/Components/QuestionList/QDifficultyDropdown.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import "./QDropdown.css";
2+
import "./QDifficultyDropdown.css";
33

44
export const QDifficultyDropdown = ({chosenDifficulty, setDifficulty}) => {
55
return (
@@ -11,4 +11,4 @@ export const QDifficultyDropdown = ({chosenDifficulty, setDifficulty}) => {
1111
</select>
1212
</div>
1313
);
14-
};
14+
};

Frontend/src/Components/QuestionList/Question.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
.q-content-contract {
137137
display: flex;
138138
flex-direction: column;
139+
margin-top: 0;
139140
gap: 20px;
140141
margin-top: -100%;
141142
transition: all 2s;
Lines changed: 15 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React, { useState } from 'react';
22
import './QuestionEdit.css';
3-
import { QDifficultyDropdown } from './QDifficultyDropdown';
4-
import { QLanguageDropdown } from './QLanguageDropdown';
5-
import { QTopicDropdown } from './QTopicDropdown';
3+
import { QDifficultyDropdown } from './QDifficultyDropdown.jsx';
64

75
import delete_icon from '../Assets/bin.png';
86

@@ -11,59 +9,10 @@ export const QuestionEdit = ({ q, index, updateQ, setEdit }) => {
119
const [difficulty, setDifficulty] = useState(q.complexity);
1210
const [topic, setTopic] = useState(q.category);
1311
const [description, setDescription] = useState(q.description);
14-
const [language, setLanguage] = useState(q.language);
1512

16-
const [isDuplicateTitle, setIsDuplicateTitle] = useState(true);
17-
const [isDuplicateDesc, setIsDuplicateDesc] = useState(false);
18-
const [isMissingField, setIsMissingField] = useState(false);
19-
20-
const [titleError, setTitleError] = useState("");
21-
const [descError, setDescError] = useState("");
22-
const [missingFieldError, setMissingFieldError] = useState("Please fill all fields!")
23-
24-
25-
const isEmpty = (str) => {
26-
return str === ""
27-
};
28-
29-
const setErrorVar = (errors) => {
30-
if('duplicateDescription' in errors) {
31-
setIsDuplicateDesc(true);
32-
setDescError(errors.duplicateDescription)
33-
} else {
34-
setIsDuplicateDesc(false);
35-
}
36-
37-
if('duplicateTitle' in errors) {
38-
setIsDuplicateTitle(true);
39-
setTitleError(errors.duplicateTitle);
40-
} else {
41-
setIsDuplicateTitle(false);
42-
}
43-
};
44-
45-
const handleSubmit = async (toggleEdit, editQ) => {
46-
// e.preventDefault();
47-
if(isEmpty(title) || isEmpty(difficulty) || isEmpty(topic) || isEmpty(description)) {
48-
setIsMissingField(true);
49-
} else {
50-
51-
setIsMissingField(false);
52-
53-
const response = await editQ(q._id, title, description, difficulty, topic, language);
54-
55-
if(response.status === 200) {
56-
toggleEdit(false);
57-
} else {
58-
let res = await response.json();
59-
setErrorVar(res.errors)
60-
}
61-
}
62-
}
63-
64-
function handleChosenDifficulty(e) {
65-
return setDifficulty(e.target.value);
66-
}
13+
function handleChosenDifficulty(e) {
14+
return setDifficulty(e.target.value);
15+
}
6716

6817
return (
6918
<div className= "form-container">
@@ -76,39 +25,33 @@ export const QuestionEdit = ({ q, index, updateQ, setEdit }) => {
7625
</div>
7726
<span> - </span>
7827
</div>
79-
80-
{isDuplicateTitle? <div className="error-text">{titleError}</div> : <div></div>}
8128

8229
<div className="q-form-content">
8330
<div className="q-form-tags-container">
8431
<div className= "q-form-tags">
8532
<QDifficultyDropdown chosenDifficulty = {difficulty} setDifficulty = {handleChosenDifficulty}/>
86-
<QTopicDropdown chosenTopic={topic} setTopic={(e) => setTopic(e.target.value)} />
87-
<QLanguageDropdown chosenLanguage={language} setLanguage={(e) => setLanguage(e.target.value)}/>
33+
<input type="text" className="q-form-tag q-form-input" defaultValue = {q.category}
34+
onChange = {(e) => {setTopic(e.target.value)}}/>
35+
36+
</div>
8837
</div>
89-
</div>
9038

91-
<textarea type="text" className="q-form-description q-form-input" defaultValue={q.description}
92-
onChange={(e) => {setDescription(e.target.value);}}/>
39+
<textarea type="text" className="q-form-description q-form-input" defaultValue={q.description}
40+
onChange={(e) => {setDescription(e.target.value);}}/>
9341

94-
{isDuplicateDesc? <div className="error-text">{descError}</div> : <div></div>}
95-
{isMissingField? <div className = "error-text">{missingFieldError}</div>: <div></div>}
96-
97-
<div className="btn-container">
42+
<div className="btn-container">
9843
<button type = "cancel" className="cancel-btn" onClick = {(e)=> {setEdit(false)}}>Cancel</button>
9944
<button className="submit-btn" onClick = {(e) => {
100-
e.preventDefault();
101-
handleSubmit(setEdit, updateQ);
102-
}}>Submit
45+
setEdit(false);
46+
updateQ(q.id, title, description, difficulty, topic)
47+
}}>Submit
10348
</button>
10449
</div>
10550
</div>
106-
107-
10851
</div>
10952
<div className="delete-btn">
11053
<img src= {delete_icon} alt="" />
11154
</div>
11255
</div>
11356
)
114-
}
57+
}

README.md

Lines changed: 17 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,33 @@
1-
# Getting Started
1+
# PeerPrep App
22

3-
## Prerequisites
3+
## Prerequisites
4+
1. Have [Node and NPM installed](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)
45

5-
Install [Docker](https://www.docker.com/)
6+
## To Run the App
67

7-
## Cloning the Repository
8-
9-
1. Open Terminal and navigate to the directory of your choice
8+
1. Open Terminal or Powershell.
109

10+
2. Navigate to directory of your choice
1111
```
12-
cd path/to/directory
12+
cd <directory of your choice>
1313
```
1414

15-
2. Clone the repository into that directory
16-
15+
3. Clone this repository into your system
1716
```
1817
git clone https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16.git
1918
```
2019

21-
## Build and Run on Local Docker Environment
22-
23-
Ensure that Docker and Docker Engine is up and running in your system.
24-
25-
1. Run the following command to build the containers.
26-
27-
```
28-
docker-compose build
29-
```
30-
31-
2. Run the following command to start the various services and frontend
32-
20+
4. Navigate into the Repository directory
3321
```
34-
docker-compose up
22+
cd ay2324s1-course-assessment-g16
3523
```
3624

37-
3. Now you can access the frontend of the application at `http://localhost:3001/`
38-
39-
4. For subsequent starts, you may skip the building step and run the `docker-compose up` command
40-
41-
5. To shut down the application, open a new Terminal and run the following command to graciously shut down these containers.
42-
25+
5. In this Repository directory, navigate into `peer-prep` directory
4326
```
44-
docker-compose down
27+
cd peer-prep
4528
```
46-
47-
# Service Status
48-
49-
## Overall Build
50-
51-
![Overall Build](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_master_docker_services.yaml/badge.svg)
52-
53-
## Collaboration Service Build and Test
54-
55-
![Collaboration Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_collaboration_service.yaml/badge.svg)
56-
57-
## Matching Service Build and Test
58-
59-
![Matching Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_matching_service.yaml/badge.svg)
60-
61-
## Question Service Build and Test
62-
63-
![Question Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_question_service.yaml/badge.svg)
64-
65-
## User Service Build and Test
66-
67-
![User Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_user_service.yaml/badge.svg)
68-
69-
## Communication Service Build and Test
70-
71-
![Communication Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_communication_service.yaml/badge.svg)
72-
73-
## GPT Service Build and Test
74-
75-
![Communication Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_gpt_service.yaml/badge.svg)
76-
77-
## History Service Build and Test
78-
79-
![Communication Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_history_service.yaml/badge.svg)
80-
81-
## Frontend Client Build and Test
82-
83-
![Communication Service Build and Test](https://github.com/CS3219-AY2324S1/ay2324s1-course-assessment-g16/actions/workflows/build_and_test_master_frontend_client.yaml/badge.svg)
29+
6. Run the command `npm i` to install dependencies.
30+
31+
7. Run the command `npm start` to start the app.
32+
33+
8. Open browser of your choice and access `http://localhost:3000/`, and you can use the app.

UserService/node_modules/.bin/mime

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UserService/node_modules/.bin/nodemon

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UserService/node_modules/.bin/nodetouch

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UserService/node_modules/.bin/nopt

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UserService/node_modules/.bin/semver

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)