File tree Expand file tree Collapse file tree 1 file changed +55
-45
lines changed Expand file tree Collapse file tree 1 file changed +55
-45
lines changed Original file line number Diff line number Diff line change @@ -109,10 +109,13 @@ export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
109
109
state . pods [ id ] ?. stderr
110
110
) ;
111
111
const [ resultScroll , setResultScroll ] = useState ( false ) ;
112
+ const [ showMenu , setShowMenu ] = useState ( false ) ;
112
113
const clearResults = useStore ( store , ( state ) => state . clearResults ) ;
113
114
if ( ! hasResult ) return < > </ > ;
114
115
return (
115
116
< Box
117
+ onMouseEnter = { ( ) => setShowMenu ( true ) }
118
+ onMouseLeave = { ( ) => setShowMenu ( false ) }
116
119
// This ID is used for autolayout.
117
120
//
118
121
// TODO save result box position to DB.
@@ -199,52 +202,59 @@ export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
199
202
border = "1px"
200
203
>
201
204
{ /* FIXME result?.count is not correct, always 0 or 1. */ }
202
- { ( stdout || ( result ?. text && result ?. count > 0 ) || error ) && (
203
- < ButtonGroup
204
- sx = { [
205
- {
206
- fontSize : "0.8em" ,
207
- paddingTop : "3px" ,
208
- paddingBottom : "2px" ,
209
- lineHeight : "10px" ,
210
- zIndex : 201 ,
211
- position : "absolute" ,
212
- top : 0 ,
213
- right : 0 ,
214
- } ,
215
- ] }
216
- variant = "text"
217
- aria-label = "outlined primary button group"
218
- >
219
- < Button
220
- onClick = { ( ) => {
221
- setResultScroll ( ! resultScroll ) ;
222
- } }
223
- variant = "text"
224
- size = "small"
225
- >
226
- { resultScroll ? "Unfocus" : "Focus" }
227
- </ Button >
228
- < Button
229
- onClick = { ( ) => {
230
- setShowOutput ( ! showOutput ) ;
231
- } }
232
- variant = "text"
233
- size = "small"
234
- >
235
- Hide
236
- </ Button >
237
- < Button
238
- onClick = { ( ) => {
239
- clearResults ( id ) ;
240
- } }
241
- variant = "text"
242
- size = "small"
205
+ { ( stdout || ( result ?. text && result ?. count > 0 ) || error ) &&
206
+ showMenu && (
207
+ < ButtonGroup
208
+ sx = { [
209
+ {
210
+ fontSize : "0.8em" ,
211
+ paddingTop : "3px" ,
212
+ paddingBottom : "2px" ,
213
+ lineHeight : "10px" ,
214
+ zIndex : 201 ,
215
+ position : "absolute" ,
216
+ top : "-64.5px" ,
217
+ right : "15px" ,
218
+ "& .MuiButton-root" : {
219
+ fontSize : ".9em" ,
220
+ paddingTop : 0 ,
221
+ paddingBottom : 0 ,
222
+ } ,
223
+ } ,
224
+ ] }
225
+ variant = "outlined"
226
+ aria-label = "outlined primary button group"
227
+ orientation = "vertical"
243
228
>
244
- Clear
245
- </ Button >
246
- </ ButtonGroup >
247
- ) }
229
+ < Button
230
+ onClick = { ( ) => {
231
+ setResultScroll ( ! resultScroll ) ;
232
+ } }
233
+ variant = "text"
234
+ size = "small"
235
+ >
236
+ { resultScroll ? "Unfocus" : "Focus" }
237
+ </ Button >
238
+ < Button
239
+ onClick = { ( ) => {
240
+ setShowOutput ( ! showOutput ) ;
241
+ } }
242
+ variant = "text"
243
+ size = "small"
244
+ >
245
+ Hide
246
+ </ Button >
247
+ < Button
248
+ onClick = { ( ) => {
249
+ clearResults ( id ) ;
250
+ } }
251
+ variant = "text"
252
+ size = "small"
253
+ >
254
+ Clear
255
+ </ Button >
256
+ </ ButtonGroup >
257
+ ) }
248
258
249
259
{ stdout && (
250
260
< Box
You can’t perform that action at this time.
0 commit comments