@@ -10,7 +10,6 @@ import {
10
10
Grid2 ,
11
11
Tab ,
12
12
Tabs ,
13
- Typography ,
14
13
} from "@mui/material" ;
15
14
import classes from "./index.module.css" ;
16
15
import { useMatch } from "../../contexts/MatchContext" ;
@@ -26,6 +25,31 @@ import QuestionDetailComponent from "../../components/QuestionDetail";
26
25
import { Navigate } from "react-router-dom" ;
27
26
import Chat from "../../components/Chat" ;
28
27
import TabPanel from "../../components/TabPanel" ;
28
+ import TestCase from "../../components/TestCase" ;
29
+
30
+ // hardcode for now...
31
+
32
+ type TestCase = {
33
+ input : string ;
34
+ output : string ;
35
+ stdout : string ;
36
+ result : string ;
37
+ } ;
38
+
39
+ const testcases : TestCase [ ] = [
40
+ {
41
+ input : "1 2 3 4" ,
42
+ output : "1 2 3 4" ,
43
+ stdout : "1\n2\n3\n4" ,
44
+ result : "1 2 3 4" ,
45
+ } ,
46
+ {
47
+ input : "5 6 7 8" ,
48
+ output : "5 6 7 8" ,
49
+ stdout : "5\n6\n7\n8" ,
50
+ result : "5 6 7 8" ,
51
+ } ,
52
+ ] ;
29
53
30
54
const CollabSandbox : React . FC = ( ) => {
31
55
const [ showErrorScreen , setShowErrorScreen ] = useState < boolean > ( false ) ;
@@ -48,6 +72,7 @@ const CollabSandbox: React.FC = () => {
48
72
const [ state , dispatch ] = useReducer ( reducer , initialState ) ;
49
73
const { selectedQuestion } = state ;
50
74
const [ selectedTab , setSelectedTab ] = useState < "tests" | "chat" > ( "tests" ) ;
75
+ const [ selectedTestcase , setSelectedTestcase ] = useState ( 0 ) ;
51
76
52
77
useEffect ( ( ) => {
53
78
if ( ! partner ) {
@@ -193,7 +218,29 @@ const CollabSandbox: React.FC = () => {
193
218
< Tab label = "Chat" value = "chat" />
194
219
</ Tabs >
195
220
< TabPanel selected = { selectedTab } value = "tests" >
196
- < Typography > Tests</ Typography >
221
+ < Box sx = { ( theme ) => ( { margin : theme . spacing ( 2 , 0 ) } ) } >
222
+ { [ ...Array ( testcases . length ) ]
223
+ . map ( ( _ , index ) => index + 1 )
224
+ . map ( ( i ) => (
225
+ < Button
226
+ key = { i }
227
+ variant = "contained"
228
+ color = {
229
+ selectedTestcase === i - 1 ? "primary" : "secondary"
230
+ }
231
+ onClick = { ( ) => setSelectedTestcase ( i - 1 ) }
232
+ sx = { ( theme ) => ( { margin : theme . spacing ( 0 , 1 ) } ) }
233
+ >
234
+ Testcase { i }
235
+ </ Button >
236
+ ) ) }
237
+ </ Box >
238
+ < TestCase
239
+ input = { testcases [ selectedTestcase ] . input }
240
+ output = { testcases [ selectedTestcase ] . output }
241
+ stdout = { testcases [ selectedTestcase ] . stdout }
242
+ result = { testcases [ selectedTestcase ] . result }
243
+ />
197
244
</ TabPanel >
198
245
< TabPanel selected = { selectedTab } value = "chat" >
199
246
< Chat isActive = { selectedTab === "chat" } />
0 commit comments