1- import React , { useCallback } from 'react' ;
1+ import React , { useCallback , useState } from 'react' ;
22
33import { useTranslations } from 'next-intl' ;
44
@@ -27,22 +27,26 @@ export const WfoCodeViewSelector = ({
2727
2828 const isSelected = ( buttonView : CodeView ) : boolean =>
2929 buttonView === codeView ;
30+ const [ showTooltips , setShowTooltips ] = useState ( true ) ;
3031
3132 const codeViewOptions = [
3233 {
3334 id : CodeView . JSON ,
3435 label : t ( 'codeView.json' ) ,
36+ onMouseLeave : ( ) => setShowTooltips ( true ) ,
3537 iconType : ( ) => (
36- < WfoBracketSquare
37- color = {
38- isSelected ( CodeView . JSON )
39- ? theme . colors . ghost
40- : theme . colors . textPrimary
41- }
42- />
38+ < div onClick = { ( ) => setShowTooltips ( false ) } >
39+ < WfoBracketSquare
40+ color = {
41+ isSelected ( CodeView . JSON )
42+ ? theme . colors . ghost
43+ : theme . colors . textPrimary
44+ }
45+ />
46+ </ div >
4347 ) ,
4448 'data-test-id' : 'jsonCodeViewButton' ,
45- toolTipContent : t ( 'codeView.json' ) ,
49+ toolTipContent : showTooltips ? t ( 'codeView.json' ) : undefined ,
4650 style : {
4751 backgroundColor : isSelected ( CodeView . JSON )
4852 ? theme . colors . textPrimary
@@ -52,17 +56,20 @@ export const WfoCodeViewSelector = ({
5256 {
5357 id : CodeView . TABLE ,
5458 label : t ( 'codeView.table' ) ,
59+ onMouseLeave : ( ) => setShowTooltips ( true ) ,
5560 iconType : ( ) => (
56- < WfoTableCells
57- color = {
58- isSelected ( CodeView . TABLE )
59- ? theme . colors . ghost
60- : theme . colors . textPrimary
61- }
62- />
61+ < div onClick = { ( ) => setShowTooltips ( false ) } >
62+ < WfoTableCells
63+ color = {
64+ isSelected ( CodeView . TABLE )
65+ ? theme . colors . ghost
66+ : theme . colors . textPrimary
67+ }
68+ />
69+ </ div >
6370 ) ,
6471 'data-test-id' : 'tableCodeViewButton' ,
65- toolTipContent : t ( 'codeView.table' ) ,
72+ toolTipContent : showTooltips ? t ( 'codeView.table' ) : undefined ,
6673 style : {
6774 backgroundColor : isSelected ( CodeView . TABLE )
6875 ? theme . colors . textPrimary
@@ -72,17 +79,20 @@ export const WfoCodeViewSelector = ({
7279 {
7380 id : CodeView . RAW ,
7481 label : t ( 'codeView.raw' ) ,
82+ onMouseLeave : ( ) => setShowTooltips ( true ) ,
7583 iconType : ( ) => (
76- < WfoCommandLine
77- color = {
78- isSelected ( CodeView . RAW )
79- ? theme . colors . ghost
80- : theme . colors . textPrimary
81- }
82- />
84+ < div onClick = { ( ) => setShowTooltips ( false ) } >
85+ < WfoCommandLine
86+ color = {
87+ isSelected ( CodeView . RAW )
88+ ? theme . colors . ghost
89+ : theme . colors . textPrimary
90+ }
91+ />
92+ </ div >
8393 ) ,
8494 'data-test-id' : 'rawCodeViewButton' ,
85- toolTipContent : t ( 'codeView.raw' ) ,
95+ toolTipContent : showTooltips ? t ( 'codeView.raw' ) : undefined ,
8696 style : {
8797 backgroundColor : isSelected ( CodeView . RAW )
8898 ? theme . colors . textPrimary
0 commit comments