@@ -14,6 +14,7 @@ import {
14
14
Menu ,
15
15
MenuItem ,
16
16
Paper ,
17
+ Tooltip ,
17
18
Typography ,
18
19
} from "@mui/material" ;
19
20
import { ChangeEvent , useCallback , useEffect , useState } from "react" ;
@@ -24,7 +25,6 @@ import {
24
25
getIdFromLink ,
25
26
getNearestFutureDate ,
26
27
getUser ,
27
- appHost ,
28
28
ProjectDetail ,
29
29
} from "./CourseUtils" ;
30
30
import {
@@ -39,6 +39,7 @@ import { timeDifference } from "../../utils/date-utils";
39
39
import { authenticatedFetch } from "../../utils/authenticated-fetch" ;
40
40
import i18next from "i18next" ;
41
41
import { Me } from "../../types/me" ;
42
+ import ContentCopyIcon from "@mui/icons-material/ContentCopy" ;
42
43
43
44
interface UserUid {
44
45
uid : string ;
@@ -179,9 +180,17 @@ export function CourseDetailTeacher(): JSX.Element {
179
180
return (
180
181
< >
181
182
< Title title = { course . name } > </ Title >
182
- < Grid container direction = { "row" } spacing = { 2 } margin = "1rem" >
183
- < Grid item xs = { 5 } >
184
- < Paper style = { { height : "90%" , maxHeight : "90vh" } } >
183
+ < Grid
184
+ container
185
+ direction = { "row" }
186
+ spacing = { 2 }
187
+ margin = "1rem"
188
+ style = { { height : "80vh" } }
189
+ >
190
+ < Grid item xs = { 5 } height = "100%" >
191
+ < Paper
192
+ style = { { height : "100%" , maxHeight : "100%" , overflow : "auto" } }
193
+ >
185
194
< div style = { { padding : "1rem" } } >
186
195
< Typography variant = "h5" > { t ( "projects" ) } :</ Typography >
187
196
< EmptyOrNotProjects projects = { projects } />
@@ -191,19 +200,12 @@ export function CourseDetailTeacher(): JSX.Element {
191
200
< Button > { t ( "newProject" ) } </ Button >
192
201
</ Link >
193
202
</ Grid >
194
- < Grid item xs = { 6 } >
195
- < Grid
196
- container
197
- direction = { "column" }
198
- spacing = { 2 }
199
- style = { {
200
- height : "100%" ,
201
- } }
202
- >
203
+ < Grid item xs = { 5 } height = "100%" >
204
+ < Grid container direction = { "column" } spacing = { 2 } height = { "100%" } >
203
205
< Grid
204
206
item
205
207
style = { {
206
- height : "45.9 %" ,
208
+ height : "50 %" ,
207
209
} }
208
210
>
209
211
< Paper
@@ -239,7 +241,7 @@ export function CourseDetailTeacher(): JSX.Element {
239
241
< Grid
240
242
item
241
243
style = { {
242
- height : "45.9 %" ,
244
+ height : "50 %" ,
243
245
} }
244
246
>
245
247
< Paper
@@ -255,22 +257,6 @@ export function CourseDetailTeacher(): JSX.Element {
255
257
handleCheckboxChange = { handleCheckboxChange }
256
258
/>
257
259
</ Paper >
258
-
259
- < IconButton
260
- style = { { position : "absolute" , bottom : 0 , left : 0 } }
261
- onClick = { ( ) =>
262
- handleDeleteStudent (
263
- navigate ,
264
- course . course_id ,
265
- selectedStudents
266
- )
267
- }
268
- >
269
- < ClearIcon />
270
- < Typography variant = "body1" > { t ( "deleteSelected" ) } </ Typography >
271
- </ IconButton >
272
- </ Grid >
273
- < Grid item >
274
260
< Grid container >
275
261
< Grid item >
276
262
< Button onClick = { handleClickCodes } > { t ( "joinCodes" ) } </ Button >
@@ -291,6 +277,20 @@ export function CourseDetailTeacher(): JSX.Element {
291
277
</ Button >
292
278
</ Grid >
293
279
</ Grid >
280
+
281
+ < IconButton
282
+ style = { { position : "absolute" , bottom : 0 , left : 0 } }
283
+ onClick = { ( ) =>
284
+ handleDeleteStudent (
285
+ navigate ,
286
+ course . course_id ,
287
+ selectedStudents
288
+ )
289
+ }
290
+ >
291
+ < ClearIcon />
292
+ < Typography variant = "body1" > { t ( "deleteSelected" ) } </ Typography >
293
+ </ IconButton >
294
294
</ Grid >
295
295
</ Grid >
296
296
</ Grid >
@@ -486,7 +486,10 @@ function JoinCodeMenu({
486
486
} ;
487
487
488
488
const handleCopyToClipboard = ( join_code : string ) => {
489
- navigator . clipboard . writeText ( `${ appHost } /join-course?code=${ join_code } ` ) ;
489
+ const host = window . location . host ;
490
+ navigator . clipboard . writeText (
491
+ `${ host } /${ i18next . language } /courses/join?code=${ join_code } `
492
+ ) ;
490
493
} ;
491
494
492
495
const getCodes = useCallback ( ( ) => {
@@ -560,6 +563,9 @@ function JoinCodeMenu({
560
563
vertical : "bottom" ,
561
564
horizontal : "center" ,
562
565
} }
566
+ style = { {
567
+ width : "25vw" ,
568
+ } }
563
569
>
564
570
< MenuItem disabled >
565
571
< Typography variant = "h6" > { t ( "joinCodes" ) } </ Typography >
@@ -568,25 +574,33 @@ function JoinCodeMenu({
568
574
elevation = { 0 }
569
575
style = { {
570
576
margin : "1rem" ,
577
+ width : "100%" ,
578
+ maxHeight : "20vh" ,
579
+ height : "20vh" ,
580
+ overflowY : "auto" ,
571
581
} }
572
582
>
573
583
{ codes . map ( ( code : JoinCode ) => (
574
- < MenuItem
575
- onClick = { ( ) => handleCopyToClipboard ( code . join_code ) }
576
- key = { code . join_code }
577
- >
584
+ < MenuItem style = { { width : "100%" } } key = { code . join_code } >
578
585
< Grid container direction = { "row" } >
579
- < Grid marginRight = { "1rem" } item >
580
- < Typography variant = "body1" >
581
- { code . expiry_time
582
- ? timeDifference ( code . expiry_time )
583
- : t ( "noExpiryDate" ) }
584
- </ Typography >
585
- </ Grid >
586
- < Grid item >
587
- < Typography variant = "body1" >
588
- { code . for_admins ? t ( "forAdmins" ) : t ( "forStudents" ) }
589
- </ Typography >
586
+ < Grid item flexGrow = { 1 } >
587
+ < Box display = "flex" gap = "1rem" >
588
+ < Typography variant = "body1" >
589
+ { code . expiry_time
590
+ ? timeDifference ( code . expiry_time )
591
+ : t ( "noExpiryDate" ) }
592
+ </ Typography >
593
+ < Typography variant = "body1" >
594
+ { code . for_admins ? t ( "forAdmins" ) : t ( "forStudents" ) }
595
+ </ Typography >
596
+ < Tooltip title = { t ( "copyToClipboard" ) } >
597
+ < IconButton
598
+ onClick = { ( ) => handleCopyToClipboard ( code . join_code ) }
599
+ >
600
+ < ContentCopyIcon />
601
+ </ IconButton >
602
+ </ Tooltip >
603
+ </ Box >
590
604
</ Grid >
591
605
< Grid item >
592
606
< IconButton onClick = { ( ) => handleDeleteCode ( code . join_code ) } >
0 commit comments