@@ -12,13 +12,20 @@ import { recommendationsSelector, resetRecommendationsHighlighting } from 'uiSrc
12
12
import { InsightsPanelTabs } from 'uiSrc/slices/interfaces/insights'
13
13
import { sendEventTelemetry , TelemetryEvent } from 'uiSrc/telemetry'
14
14
import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances'
15
+ import HighlightedFeature from 'uiSrc/components/hightlighted-feature/HighlightedFeature'
16
+ import { BUILD_FEATURES } from 'uiSrc/constants/featuresHighlighting'
17
+ import { appFeatureHighlightingSelector , removeFeatureFromHighlighting } from 'uiSrc/slices/app/features'
18
+ import { getHighlightingFeatures } from 'uiSrc/utils/highlighting'
15
19
import styles from './styles.module.scss'
16
20
17
21
const InsightsTrigger = ( ) => {
18
22
const { isOpen : isInsigtsOpen , tabSelected } = useSelector ( insightsPanelSelector )
19
23
const { isHighlighted, } = useSelector ( recommendationsSelector )
20
24
const { provider } = useSelector ( connectedInstanceSelector )
21
25
26
+ const { features } = useSelector ( appFeatureHighlightingSelector )
27
+ const { insights : insightsHighlighting } = getHighlightingFeatures ( features )
28
+
22
29
const dispatch = useDispatch ( )
23
30
const { pathname, search } = useLocation ( )
24
31
const { instanceId } = useParams < { instanceId : string } > ( )
@@ -54,37 +61,45 @@ const InsightsTrigger = () => {
54
61
source : 'overview'
55
62
} ,
56
63
} )
64
+
65
+ dispatch ( removeFeatureFromHighlighting ( 'insights' ) )
57
66
}
58
67
59
68
return (
60
69
< div
61
70
className = { cx ( styles . container , { [ styles . isOpen ] : isInsigtsOpen } ) }
62
71
>
63
- < EuiToolTip
64
- title = { isHighlighted ? undefined : 'Insights' }
65
- content = { isHighlighted
66
- ? 'New tips are available'
67
- : 'Open interactive tutorials to learn more about Redis or Redis Stack capabilities, or use tips to improve your database.' }
72
+ < HighlightedFeature
73
+ isHighlight = { insightsHighlighting && ! isHighlighted }
74
+ hideFirstChild = { ! isHighlighted }
75
+ { ...( BUILD_FEATURES . insights || { } ) }
68
76
>
69
- < EuiButton
70
- fill
71
- size = "s"
72
- color = "secondary"
73
- className = { styles . btn }
74
- role = "button"
75
- iconType = { TriggerIcon }
76
- onClick = { handleClickTrigger }
77
- data-testid = "insights-trigger"
77
+ < EuiToolTip
78
+ title = { isHighlighted ? undefined : 'Insights' }
79
+ content = { isHighlighted
80
+ ? 'New tips are available'
81
+ : 'Open interactive tutorials to learn more about Redis or Redis Stack capabilities, or use tips to improve your database.' }
78
82
>
79
- < EuiText className = { cx (
80
- styles . triggerText ,
81
- ) }
83
+ < EuiButton
84
+ fill
85
+ size = "s"
86
+ color = "secondary"
87
+ className = { styles . btn }
88
+ role = "button"
89
+ iconType = { TriggerIcon }
90
+ onClick = { handleClickTrigger }
91
+ data-testid = "insights-trigger"
82
92
>
83
- Insights
84
- </ EuiText >
85
- { isHighlighted && ( < span className = { styles . highlighting } /> ) }
86
- </ EuiButton >
87
- </ EuiToolTip >
93
+ < EuiText className = { cx (
94
+ styles . triggerText ,
95
+ ) }
96
+ >
97
+ Insights
98
+ </ EuiText >
99
+ { isHighlighted && ( < span className = { styles . highlighting } /> ) }
100
+ </ EuiButton >
101
+ </ EuiToolTip >
102
+ </ HighlightedFeature >
88
103
</ div >
89
104
)
90
105
}
0 commit comments