Skip to content

Commit 0b41406

Browse files
committed
Add matched and timeout page
1 parent 120f051 commit 0b41406

File tree

10 files changed

+155
-7
lines changed

10 files changed

+155
-7
lines changed

.husky/pre-commit

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
cd ./frontend && npm run lint && npm run test
2-
cd ..
1+
cd ./frontend
2+
npm run lint
3+
npm run test -- --maxWorkers=50%
4+
cd ..
35

4-
cd ./backend/user-service && npm run lint && npm run test
5-
cd ../..
6+
cd ./backend/user-service
7+
npm run lint
8+
npm run test -- --maxWorkers=50%
9+
cd ../..
610

7-
cd ./backend/question-service && npm run lint && npm run test
11+
cd ./backend/question-service
12+
npm run lint
13+
npm run test -- --maxWorkers=50%
14+
cd ../..

backend/question-service/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ COPY . .
1010

1111
EXPOSE 3000
1212

13-
CMD ["npm", "start"]
13+
CMD ["npm", "run", "dev"]

backend/user-service/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ COPY . .
1010

1111
EXPOSE 3001
1212

13-
CMD ["npm", "start"]
13+
CMD ["npm", "run", "dev"]

docker-compose.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,25 @@ services:
22
user-service:
33
image: peerprep/user-service
44
build: ./backend/user-service
5+
environment:
6+
- CHOKIDAR_USEPOLLING=true
57
env_file: ./backend/user-service/.env
68
ports:
79
- 3001:3001
810
depends_on:
911
- mongo
1012
networks:
1113
- peerprep-network
14+
volumes:
15+
- ./backend/user-service:/user-service
16+
- /user-service/node_modules
1217
restart: on-failure
1318

1419
question-service:
1520
image: peerprep/question-service
1621
build: ./backend/question-service
22+
environment:
23+
- CHOKIDAR_USEPOLLING=true
1724
env_file: ./backend/question-service/.env
1825
ports:
1926
- 3000:3000
@@ -22,18 +29,26 @@ services:
2229
- user-service
2330
networks:
2431
- peerprep-network
32+
volumes:
33+
- ./backend/question-service:/question-service
34+
- /question-service/node_modules
2535
restart: on-failure
2636

2737
frontend:
2838
image: peerprep/frontend
2939
build: ./frontend
40+
environment:
41+
- CHOKIDAR_USEPOLLING=true
3042
ports:
3143
- 5173:5173
3244
depends_on:
3345
- user-service
3446
- question-service
3547
networks:
3648
- peerprep-network
49+
volumes:
50+
- ./frontend:/frontend
51+
- /frontend/node_modules
3752
restart: on-failure
3853

3954
mongo:

frontend/src/App.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import Landing from "./pages/Landing";
1010
import Home from "./pages/Home";
1111
import SignUp from "./pages/SignUp";
1212
import LogIn from "./pages/LogIn";
13+
import Matched from "./pages/Matched";
14+
import Timeout from "./pages/Timeout";
1315
import ProtectedRoutes from "./components/ProtectedRoutes";
1416
import Layout from "./components/Layout";
1517
import AuthProvider from "./contexts/AuthContext";
@@ -40,6 +42,11 @@ function App() {
4042
</ProfileContextProvider>
4143
}
4244
/>
45+
<Route path="matching" element={<ProtectedRoutes />}>
46+
<Route index element={<div>Matching...</div>} />
47+
<Route path="matched" element={<Matched />} />
48+
<Route path="timeout" element={<Timeout />} />
49+
</Route>
4350
<Route path="*" element={<PageNotFound />} />
4451
</Route>
4552
<Route path="/signup" element={<SignUp />}></Route>

frontend/src/assets/timeout.svg

Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.fullheight {
2+
flex: 1;
3+
}
4+
5+
.center {
6+
display: flex;
7+
flex-direction: column;
8+
align-items: center;
9+
justify-content: center;
10+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { useNavigate } from "react-router-dom";
2+
import AppMargin from "../../components/AppMargin";
3+
import { Avatar, Box, Button, Stack, Typography } from "@mui/material";
4+
import classes from "./index.module.css";
5+
6+
const Matched: React.FC = () => {
7+
const navigate = useNavigate();
8+
9+
return (
10+
<AppMargin classname={`${classes.fullheight} ${classes.center}`}>
11+
<Stack spacing={2} alignItems={"center"}>
12+
<Typography variant="h1">It's a match!</Typography>
13+
14+
<Box
15+
display="flex"
16+
alignItems="center"
17+
justifyContent="center"
18+
paddingTop={2}
19+
paddingBottom={2}
20+
>
21+
<Avatar sx={{ width: 120, height: 120 }} />
22+
23+
<Box
24+
sx={(theme) => ({
25+
width: "120px",
26+
height: "2px",
27+
backgroundColor: theme.palette.secondary.contrastText,
28+
margin: "0 10px",
29+
})}
30+
/>
31+
32+
<Avatar sx={{ width: 120, height: 120 }} />
33+
</Box>
34+
35+
<Typography variant="h3">Practice with @johnjoe?</Typography>
36+
37+
<Stack spacing={2} direction="row" paddingTop={2} width={700}>
38+
<Button
39+
variant="contained"
40+
color="secondary"
41+
fullWidth
42+
onClick={() => navigate("/matching")}
43+
>
44+
Rematch
45+
</Button>
46+
<Button variant="contained" fullWidth>
47+
Accept
48+
</Button>
49+
</Stack>
50+
</Stack>
51+
</AppMargin>
52+
);
53+
};
54+
55+
export default Matched;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.fullheight {
2+
flex: 1;
3+
}
4+
5+
.center {
6+
display: flex;
7+
flex-direction: column;
8+
align-items: center;
9+
justify-content: center;
10+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { useNavigate } from "react-router-dom";
2+
import AppMargin from "../../components/AppMargin";
3+
import { Button, Stack, Typography } from "@mui/material";
4+
import timeout from "../../assets/timeout.svg";
5+
import classes from "./index.module.css";
6+
7+
const Timeout: React.FC = () => {
8+
const navigate = useNavigate();
9+
10+
return (
11+
<AppMargin classname={`${classes.fullheight} ${classes.center}`}>
12+
<Stack spacing={2} alignItems={"center"}>
13+
<Typography variant="h1">Oops, timeout...</Typography>
14+
15+
<img src={timeout} style={{ height: 240, width: "auto" }} />
16+
17+
<Typography variant="h3">
18+
Unfortunately, we could not find a match.
19+
</Typography>
20+
21+
<Stack spacing={2} direction="row" paddingTop={2} width={700}>
22+
<Button
23+
variant="contained"
24+
color="secondary"
25+
fullWidth
26+
onClick={() => navigate("/questions")}
27+
>
28+
Exit
29+
</Button>
30+
<Button
31+
variant="contained"
32+
fullWidth
33+
onClick={() => navigate("/matching")}
34+
>
35+
Try Again
36+
</Button>
37+
</Stack>
38+
</Stack>
39+
</AppMargin>
40+
);
41+
};
42+
43+
export default Timeout;

0 commit comments

Comments
 (0)