Skip to content

Commit 95c779c

Browse files
committed
Add matching page
1 parent 8bb8502 commit 95c779c

File tree

5 files changed

+104
-2
lines changed

5 files changed

+104
-2
lines changed

frontend/src/App.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import Home from "./pages/Home";
1111
import SignUp from "./pages/SignUp";
1212
import LogIn from "./pages/LogIn";
1313
import ProtectedRoutes from "./components/ProtectedRoutes";
14+
import Matching from "./pages/Matching";
1415

1516
function App() {
1617
return (
@@ -27,10 +28,13 @@ function App() {
2728
</Route>
2829
</Route>
2930
<Route path="profile/:userId" element={<ProfilePage />} />
31+
<Route path="match">
32+
<Route index element={<Matching />} />
33+
</Route>
3034
<Route path="*" element={<PageNotFound />} />
3135
</Route>
32-
<Route path="/signup" element={<SignUp />}></Route>
33-
<Route path="/login" element={<LogIn />}></Route>
36+
<Route path="signup" element={<SignUp />}></Route>
37+
<Route path="login" element={<LogIn />}></Route>
3438
</Routes>
3539
</AuthProvider>
3640
);

frontend/src/assets/matching.svg

Lines changed: 9 additions & 0 deletions
Loading
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import {
2+
Box,
3+
CircularProgress,
4+
CircularProgressProps,
5+
Typography,
6+
} from "@mui/material";
7+
8+
type TimerProps = { totalTime: number; timeLeft: number };
9+
10+
const Timer: React.FC<CircularProgressProps & TimerProps> = (props) => {
11+
const { totalTime, timeLeft } = props;
12+
const percentage = (timeLeft / totalTime) * 100;
13+
return (
14+
<Box sx={{ position: "relative", display: "inline-flex" }}>
15+
<CircularProgress
16+
variant="determinate"
17+
size={80}
18+
value={100}
19+
sx={(theme) => ({ color: theme.palette.grey[200] })}
20+
/>
21+
<CircularProgress
22+
variant="determinate"
23+
disableShrink
24+
value={percentage}
25+
size={80}
26+
sx={{ position: "absolute" }}
27+
{...props}
28+
/>
29+
<Box
30+
sx={{
31+
top: 0,
32+
bottom: 0,
33+
left: 0,
34+
right: 0,
35+
position: "absolute",
36+
display: "flex",
37+
justifyContent: "center",
38+
alignItems: "center",
39+
}}
40+
>
41+
<Typography variant="h6">{timeLeft}</Typography>
42+
</Box>
43+
</Box>
44+
);
45+
};
46+
47+
export default Timer;
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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import React, { useEffect } from "react";
2+
import AppMargin from "../../components/AppMargin";
3+
import { Stack, Typography } from "@mui/material";
4+
import matching from "../../assets/matching.svg";
5+
import classes from "./index.module.css";
6+
import Timer from "../../components/Timer";
7+
8+
const Matching: React.FC = () => {
9+
const totalTime = 30;
10+
const [timeLeft, setTimeLeft] = React.useState(totalTime);
11+
12+
useEffect(() => {
13+
const timer = setInterval(() => {
14+
setTimeLeft((prevTime) => (prevTime <= 0 ? 0 : prevTime - 1));
15+
}, 1000);
16+
return () => clearInterval(timer);
17+
}, []);
18+
19+
return (
20+
<AppMargin classname={`${classes.fullheight} ${classes.center}`}>
21+
<Stack spacing={2} alignItems={"center"}>
22+
<Typography component={"h1"} variant="h3">
23+
Finding your practice partner
24+
</Typography>
25+
<img src={matching} style={{ height: 120, width: "auto" }} />
26+
<Timer totalTime={totalTime} timeLeft={timeLeft} thickness={4} />
27+
</Stack>
28+
</AppMargin>
29+
);
30+
};
31+
32+
export default Matching;

0 commit comments

Comments
 (0)