5
5
Col ,
6
6
Input ,
7
7
Layout ,
8
+ Modal ,
8
9
Row ,
9
10
Select ,
10
11
Tabs ,
@@ -66,6 +67,9 @@ export default function CollaborationPage(props: CollaborationProps) {
66
67
undefined
67
68
) ;
68
69
70
+ // Modal state
71
+ const [ isModalOpen , setIsModalOpen ] = useState < boolean > ( false ) ;
72
+
69
73
// Stops the session duration stopwatch
70
74
const stopStopwatch = ( ) => {
71
75
if ( stopwatchRef . current ) {
@@ -168,14 +172,14 @@ export default function CollaborationPage(props: CollaborationProps) {
168
172
// Remove localstorage variable for stored session duration
169
173
localStorage . removeItem ( "session-duration" ) ; // TODO: Remove this after collaboration backend data stored
170
174
171
- // // Remove localstorage variables for collaboration
172
- // localStorage.removeItem("user");
173
- // localStorage.removeItem("matchedUser");
174
- // localStorage.removeItem("collaId");
175
- // localStorage.removeItem("docRefId");
175
+ // Remove localstorage variables for collaboration
176
+ localStorage . removeItem ( "user" ) ;
177
+ localStorage . removeItem ( "matchedUser" ) ;
178
+ localStorage . removeItem ( "collaId" ) ;
179
+ localStorage . removeItem ( "docRefId" ) ;
176
180
177
- // // Redirect back to matching page
178
- // router.push("/matching");
181
+ // Redirect back to matching page
182
+ router . push ( "/matching" ) ;
179
183
} ;
180
184
181
185
return (
@@ -251,15 +255,6 @@ export default function CollaborationPage(props: CollaborationProps) {
251
255
Submit
252
256
</ Button >
253
257
</ div >
254
- { /* <div className="code-second-container">
255
- <div className="code-language">Select Language:</div>
256
- <Select
257
- className="language-select"
258
- defaultValue={selectedLanguage}
259
- options={ProgrammingLanguageOptions}
260
- onSelect={(val) => setSelectedLanguage(val)}
261
- />
262
- </div> */ }
263
258
{ collaborationId && currentUser && selectedLanguage && (
264
259
< CollaborativeEditor
265
260
user = { currentUser }
@@ -278,10 +273,24 @@ export default function CollaborationPage(props: CollaborationProps) {
278
273
< ClockCircleOutlined className = "title-icons" />
279
274
Session Details
280
275
</ div >
281
- { /* TODO: End the collaboration session, cleanup the localstorage variables */ }
276
+ < Modal
277
+ height = { 500 }
278
+ title = { "End Session" }
279
+ okText = { "End" }
280
+ okButtonProps = { { danger : true } }
281
+ onOk = { handleCloseCollaboration }
282
+ open = { isModalOpen }
283
+ onCancel = { ( ) => setIsModalOpen ( false ) }
284
+ width = { 400 }
285
+ >
286
+ < p className = "modal-description" >
287
+ Are you sure you want to quit the existing collaboration
288
+ session?
289
+ </ p >
290
+ </ Modal >
282
291
< Button
283
292
danger
284
- onClick = { handleCloseCollaboration }
293
+ onClick = { ( ) => setIsModalOpen ( true ) }
285
294
className = "session-end-button"
286
295
>
287
296
End
0 commit comments