@@ -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 } = useLocation ( )
24
31
const { instanceId } = useParams < { instanceId : string } > ( )
@@ -44,37 +51,45 @@ const InsightsTrigger = () => {
44
51
source : 'overview'
45
52
} ,
46
53
} )
54
+
55
+ dispatch ( removeFeatureFromHighlighting ( 'insights' ) )
47
56
}
48
57
49
58
return (
50
59
< div
51
60
className = { cx ( styles . container , { [ styles . isOpen ] : isInsigtsOpen } ) }
52
61
>
53
- < EuiToolTip
54
- title = { isHighlighted ? undefined : 'Insights' }
55
- content = { isHighlighted
56
- ? 'New recommendations are available'
57
- : 'Open interactive tutorials to learn more about Redis or Redis Stack capabilities, or use recommendations to improve your database.' }
62
+ < HighlightedFeature
63
+ isHighlight = { insightsHighlighting && ! isHighlighted }
64
+ hideFirstChild = { ! isHighlighted }
65
+ { ...( BUILD_FEATURES . insights || { } ) }
58
66
>
59
- < EuiButton
60
- fill
61
- size = "s"
62
- color = "secondary"
63
- className = { styles . btn }
64
- role = "button"
65
- iconType = { TriggerIcon }
66
- onClick = { handleClickTrigger }
67
- data-testid = "insights-trigger"
67
+ < EuiToolTip
68
+ title = { isHighlighted ? undefined : 'Insights' }
69
+ content = { isHighlighted
70
+ ? 'New recommendations are available'
71
+ : 'Open interactive tutorials to learn more about Redis or Redis Stack capabilities, or use recommendations to improve your database.' }
68
72
>
69
- < EuiText className = { cx (
70
- styles . triggerText ,
71
- ) }
73
+ < EuiButton
74
+ fill
75
+ size = "s"
76
+ color = "secondary"
77
+ className = { styles . btn }
78
+ role = "button"
79
+ iconType = { TriggerIcon }
80
+ onClick = { handleClickTrigger }
81
+ data-testid = "insights-trigger"
72
82
>
73
- Insights
74
- </ EuiText >
75
- { isHighlighted && ( < span className = { styles . highlighting } /> ) }
76
- </ EuiButton >
77
- </ EuiToolTip >
83
+ < EuiText className = { cx (
84
+ styles . triggerText ,
85
+ ) }
86
+ >
87
+ Insights
88
+ </ EuiText >
89
+ { isHighlighted && ( < span className = { styles . highlighting } /> ) }
90
+ </ EuiButton >
91
+ </ EuiToolTip >
92
+ </ HighlightedFeature >
78
93
</ div >
79
94
)
80
95
}
0 commit comments