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 }) {
109109 state . pods [ id ] ?. stderr
110110 ) ;
111111 const [ resultScroll , setResultScroll ] = useState ( false ) ;
112+ const [ showMenu , setShowMenu ] = useState ( false ) ;
112113 const clearResults = useStore ( store , ( state ) => state . clearResults ) ;
113114 if ( ! hasResult ) return < > </ > ;
114115 return (
115116 < Box
117+ onMouseEnter = { ( ) => setShowMenu ( true ) }
118+ onMouseLeave = { ( ) => setShowMenu ( false ) }
116119 // This ID is used for autolayout.
117120 //
118121 // TODO save result box position to DB.
@@ -199,52 +202,59 @@ export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
199202 border = "1px"
200203 >
201204 { /* 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"
243228 >
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+ ) }
248258
249259 { stdout && (
250260 < Box
You can’t perform that action at this time.
0 commit comments