1
- import React , { useState } from 'react' ;
2
- import { Paper , Typography , TextField , MenuItem , Button } from '@mui/material' ;
1
+ import React , { useState } from "react" ;
2
+ import { Paper , Typography , TextField , MenuItem , Button } from "@mui/material" ;
3
+ import { Link } from "react-router-dom" ;
4
+
3
5
import Editor from "@monaco-editor/react" ;
4
6
5
- const languages : string [ ] = [ ' C++' , ' Java' , ' JavaScript' , ' Python' ] ;
7
+ const languages : string [ ] = [ " C++" , " Java" , " JavaScript" , " Python" ] ;
6
8
7
9
function ProblemSolverRight ( ) {
8
- const [ selectedLanguage , setSelectedLanguage ] = useState < string > ( 'JavaScript' ) ;
10
+ const [ selectedLanguage , setSelectedLanguage ] =
11
+ useState < string > ( "JavaScript" ) ;
9
12
// const [code, setCode] = useState<string>('class Solution:');
10
- const code = "class Solution:"
11
- const handleLanguageChange = ( event : React . ChangeEvent < { value : unknown } > ) => {
13
+ const code = "class Solution:" ;
14
+ const handleLanguageChange = (
15
+ event : React . ChangeEvent < { value : unknown } >
16
+ ) => {
12
17
setSelectedLanguage ( event . target . value as string ) ;
13
18
} ;
14
19
@@ -22,7 +27,10 @@ function ProblemSolverRight() {
22
27
} ;
23
28
24
29
return (
25
- < Paper elevation = { 3 } style = { { flex : 1 , padding : 16 , display : 'flex' , flexDirection : 'column' } } >
30
+ < Paper
31
+ elevation = { 3 }
32
+ style = { { flex : 1 , padding : 16 , display : "flex" , flexDirection : "column" } }
33
+ >
26
34
< Typography variant = "h6" gutterBottom >
27
35
Select a Language:
28
36
</ Typography >
@@ -31,33 +39,34 @@ function ProblemSolverRight() {
31
39
fullWidth
32
40
value = { selectedLanguage }
33
41
onChange = { handleLanguageChange }
34
- style = { { width : ' 50%' } }
42
+ style = { { width : " 50%" } }
35
43
>
36
44
{ languages . map ( ( language , index ) => (
37
45
< MenuItem key = { index } value = { language } >
38
46
{ language }
39
47
</ MenuItem >
40
48
) ) }
41
49
</ TextField >
42
- < Typography variant = "h6" gutterBottom style = { { marginTop : ' 16px' } } >
50
+ < Typography variant = "h6" gutterBottom style = { { marginTop : " 16px" } } >
43
51
Code Editor:
44
52
</ Typography >
45
53
< Editor
46
- height = "900px"
47
- language = { selectedLanguage . toLowerCase ( ) }
48
- theme = "vs-dark"
49
- value = { code }
50
-
51
- />
52
- < Button
53
- variant = "contained"
54
- color = "primary"
55
- fullWidth
56
- onClick = { handleSubmit }
57
- style = { { marginTop : '16px' } }
58
- >
59
- Submit
60
- </ Button >
54
+ height = "900px"
55
+ language = { selectedLanguage . toLowerCase ( ) }
56
+ theme = "vs-dark"
57
+ value = { code }
58
+ />
59
+ < Link to = { `/home` } style = { { textDecoration : "none" } } >
60
+ < Button
61
+ variant = "contained"
62
+ color = "primary"
63
+ fullWidth
64
+ onClick = { handleSubmit }
65
+ style = { { marginTop : "16px" } }
66
+ >
67
+ Submit
68
+ </ Button >
69
+ </ Link >
61
70
</ Paper >
62
71
) ;
63
72
}
0 commit comments