File tree Expand file tree Collapse file tree 5 files changed +104
-2
lines changed Expand file tree Collapse file tree 5 files changed +104
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import Home from "./pages/Home";
11
11
import SignUp from "./pages/SignUp" ;
12
12
import LogIn from "./pages/LogIn" ;
13
13
import ProtectedRoutes from "./components/ProtectedRoutes" ;
14
+ import Matching from "./pages/Matching" ;
14
15
15
16
function App ( ) {
16
17
return (
@@ -27,10 +28,13 @@ function App() {
27
28
</ Route >
28
29
</ Route >
29
30
< Route path = "profile/:userId" element = { < ProfilePage /> } />
31
+ < Route path = "match" >
32
+ < Route index element = { < Matching /> } />
33
+ </ Route >
30
34
< Route path = "*" element = { < PageNotFound /> } />
31
35
</ 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 >
34
38
</ Routes >
35
39
</ AuthProvider >
36
40
) ;
Original file line number Diff line number Diff line change
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 ;
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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 ;
You can’t perform that action at this time.
0 commit comments