1
1
import AppMargin from "../../components/AppMargin" ;
2
- import { Box } from "@mui/material" ;
2
+ import {
3
+ Box ,
4
+ Button ,
5
+ Dialog ,
6
+ DialogActions ,
7
+ DialogContent ,
8
+ DialogContentText ,
9
+ DialogTitle ,
10
+ } from "@mui/material" ;
3
11
import classes from "./index.module.css" ;
4
12
import { useMatch } from "../../contexts/MatchContext" ;
5
13
import { USE_MATCH_ERROR_MESSAGE } from "../../utils/constants" ;
@@ -17,7 +25,17 @@ const CollabSandbox: React.FC = () => {
17
25
if ( ! match ) {
18
26
throw new Error ( USE_MATCH_ERROR_MESSAGE ) ;
19
27
}
20
- const { verifyMatchStatus, getMatchId, partner, loading, questionId } = match ;
28
+
29
+ const {
30
+ verifyMatchStatus,
31
+ getMatchId,
32
+ handleRejectEndSession,
33
+ handleConfirmEndSession,
34
+ partner,
35
+ loading,
36
+ isEndSessionModalOpen,
37
+ questionId,
38
+ } = match ;
21
39
const [ state , dispatch ] = useReducer ( reducer , initialState ) ;
22
40
const { selectedQuestion } = state ;
23
41
@@ -53,10 +71,54 @@ const CollabSandbox: React.FC = () => {
53
71
< AppMargin classname = { `${ classes . fullheight } ${ classes . flex } ` } >
54
72
{ /* <Stack spacing={2} alignItems={"center"}>
55
73
<Typography variant="h1">Successfully matched!</Typography>
56
- <Button variant="outlined" color="error" onClick={() => stopMatch()}>
57
- End Session
58
- </Button>
59
74
</Stack> */ }
75
+ < Dialog
76
+ sx = { {
77
+ "& .MuiDialog-paper" : {
78
+ padding : "20px" ,
79
+ } ,
80
+ } }
81
+ open = { isEndSessionModalOpen }
82
+ onClose = { handleRejectEndSession }
83
+ >
84
+ < DialogTitle sx = { { textAlign : "center" , fontSize : 20 } } >
85
+ { "End Session?" }
86
+ </ DialogTitle >
87
+ < DialogContent >
88
+ < DialogContentText sx = { { textAlign : "center" , fontSize : 16 } } >
89
+ Are you sure you want to end session?
90
+ < br />
91
+ You will lose your current progress.
92
+ </ DialogContentText >
93
+ </ DialogContent >
94
+ < DialogActions
95
+ sx = { {
96
+ justifyContent : "center" ,
97
+ paddingBottom : "20px" ,
98
+ } }
99
+ >
100
+ < Button
101
+ sx = { {
102
+ width : "250px" ,
103
+ } }
104
+ variant = "contained"
105
+ color = "secondary"
106
+ onClick = { handleRejectEndSession }
107
+ >
108
+ Back
109
+ </ Button >
110
+ < Button
111
+ sx = { {
112
+ width : "250px" ,
113
+ } }
114
+ variant = "contained"
115
+ onClick = { handleConfirmEndSession }
116
+ >
117
+ Confirm
118
+ </ Button >
119
+ </ DialogActions >
120
+ </ Dialog >
121
+
60
122
< Box sx = { { display : "flex" , flex : 1 } } >
61
123
< Box sx = { ( theme ) => ( { flex : 1 , marginRight : theme . spacing ( 2 ) } ) } >
62
124
< QuestionDetailComponent
0 commit comments