@@ -16,16 +16,18 @@ const WidgetGrid = WidthProvider(GridLayout);
16
16
17
17
function Window ( props ) {
18
18
const { title, children, sx } = props ;
19
+ const [ hidden , setHidden ] = useState ( false ) ;
20
+
19
21
return (
20
22
< Card sx = { { width : "100%" , height : "100%" , display : "flex" , flexDirection : "column" , ...sx } } >
21
23
< CardHeader className = "windowResizeHandle" sx = { {
22
24
background : theme =>
23
25
theme . palette . mode === "light"
24
26
? theme . palette . grey [ 200 ]
25
27
: theme . palette . grey [ 900 ] ,
26
- padding : "4px " ,
27
- } } subheader = { title } subheaderTypographyProps = { { typography : "overline" , marginLeft : 1 } } />
28
- < CardContent sx = { { flexGrow : "1" , padding : 1 } } > { children } </ CardContent >
28
+ padding : "0px " ,
29
+ } } subheader = { < Button onClick = { ( ) => setHidden ( hidden => ! hidden ) } > { title } </ Button > } subheaderTypographyProps = { { typography : "overline" , marginLeft : 0 , } } />
30
+ < CardContent sx = { { flexGrow : "1" , padding : 1 } } > { ! hidden ? children : null } </ CardContent >
29
31
</ Card >
30
32
) ;
31
33
}
@@ -189,18 +191,18 @@ function App() {
189
191
world : < Window title = "World" >
190
192
< World state = { realtimeState } />
191
193
</ Window > ,
192
- // tb1: <Window title="TB1 / Delta7">
193
- // <Plot name="tb1" data={[ {y: state?.layers.TB1, type: "line"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
194
- // </Window>,
195
- // cpu4: <Window title="CPU4 / PFN">
196
- // <Plot name="cpu4" data={[ {y: state?.layers.CPU4, type: "line"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
197
- // </Window>,
198
- // tn1: <Window title="TN1">
199
- // <Plot name="tn1" data={[ {y: state?.layers.TN1, type: "bar"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
200
- // </Window>,
201
- // tn2: <Window title="TN2">
202
- // <Plot name="tn2" data={[ {y: state?.layers.TN2, type: "bar"} ]} layout={{ yaxis: { range: [0, 1] } }}/>
203
- // </Window>,
194
+ tb1 : < Window title = "TB1 / Delta7" >
195
+ < Plot name = "tb1" data = { [ { y : state ?. layers . TB1 , type : "line" } ] } layout = { { yaxis : { range : [ 0 , 1 ] } } } />
196
+ </ Window > ,
197
+ cpu4 : < Window title = "CPU4 / PFN" >
198
+ < Plot name = "cpu4" data = { [ { y : state ?. layers . CPU4 , type : "line" } ] } layout = { { yaxis : { range : [ 0 , 1 ] } } } />
199
+ </ Window > ,
200
+ tn1 : < Window title = "TN1" >
201
+ < Plot name = "tn1" data = { [ { y : state ?. layers . TN1 , type : "bar" } ] } layout = { { yaxis : { range : [ 0 , 1 ] } } } />
202
+ </ Window > ,
203
+ tn2 : < Window title = "TN2" >
204
+ < Plot name = "tn2" data = { [ { y : state ?. layers . TN2 , type : "bar" } ] } layout = { { yaxis : { range : [ 0 , 1 ] } } } />
205
+ </ Window > ,
204
206
} ) , [ realtimeState , state , readyState , sendJsonMessage ] ) ;
205
207
206
208
return (
0 commit comments