9
9
EuiToolTip ,
10
10
} from '@elastic/eui'
11
11
import { isEmpty } from 'lodash'
12
- import { useSelector } from 'react-redux'
12
+ import { useDispatch , useSelector } from 'react-redux'
13
13
import cx from 'classnames'
14
14
import { FeatureFlagComponent , ImportDatabasesDialog , OAuthSsoHandlerDialog } from 'uiSrc/components'
15
15
import { sendEventTelemetry , TelemetryEvent } from 'uiSrc/telemetry'
@@ -24,6 +24,10 @@ import { instancesSelector } from 'uiSrc/slices/instances/instances'
24
24
import { OAuthSocialSource } from 'uiSrc/slices/interfaces'
25
25
import { FeatureFlags } from 'uiSrc/constants'
26
26
import { ReactComponent as ConfettiIcon } from 'uiSrc/assets/img/oauth/confetti.svg'
27
+ import HighlightedFeature from 'uiSrc/components/hightlighted-feature/HighlightedFeature'
28
+ import { appFeatureHighlightingSelector , removeFeatureFromHighlighting } from 'uiSrc/slices/app/features'
29
+ import { getHighlightingFeatures } from 'uiSrc/utils/highlighting'
30
+ import { BUILD_FEATURES } from 'uiSrc/constants/featuresHighlighting'
27
31
import SearchDatabasesList from '../SearchDatabasesList'
28
32
29
33
import styles from './styles.module.scss'
@@ -41,10 +45,15 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
41
45
const { theme } = useContext ( ThemeContext )
42
46
const { data : instances } = useSelector ( instancesSelector )
43
47
const { loading, data } = useSelector ( contentSelector )
48
+ const { features } = useSelector ( appFeatureHighlightingSelector )
49
+ const { cloudButton : cloudButtonHighlighting } = getHighlightingFeatures ( features )
50
+
44
51
const [ promoData , setPromoData ] = useState < ContentCreateRedis > ( )
45
52
const [ guides , setGuides ] = useState < IHelpGuide [ ] > ( [ ] )
46
53
const [ isImportDialogOpen , setIsImportDialogOpen ] = useState < boolean > ( false )
47
54
55
+ const dispatch = useDispatch ( )
56
+
48
57
useEffect ( ( ) => {
49
58
if ( loading || ! data || isEmpty ( data ) ) {
50
59
return
@@ -170,6 +179,8 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
170
179
</ div >
171
180
)
172
181
182
+ console . log ( cloudButtonHighlighting )
183
+
173
184
const CreateBtn = ( { content } : { content : ContentCreateRedis } ) => {
174
185
const { title, description, styles : stylesCss , links } = content
175
186
// @ts -ignore
@@ -205,22 +216,28 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
205
216
)
206
217
return (
207
218
< FeatureFlagComponent name = { FeatureFlags . cloudSso } otherwise = { promoLink } >
208
- < EuiToolTip
209
- position = "bottom"
210
- anchorClassName = { styles . cloudSsoPromoBtnAnchor }
211
- content = { (
212
- < div className = { styles . cloudSsoPromoTooltip } >
213
- < EuiIcon type = { ConfettiIcon } className = { styles . cloudSsoPromoTooltipIcon } />
214
- < div >
215
- New!
216
- < br />
217
- Now you can create a free Redis Stack database in Redis Enterprise Cloud in a few clicks.
219
+ < HighlightedFeature
220
+ isHighlight = { cloudButtonHighlighting }
221
+ type = { BUILD_FEATURES ?. cloudButton ?. type }
222
+ onClick = { ( ) => dispatch ( removeFeatureFromHighlighting ( 'cloudButton' ) ) }
223
+ >
224
+ < EuiToolTip
225
+ position = "bottom"
226
+ anchorClassName = { styles . cloudSsoPromoBtnAnchor }
227
+ content = { (
228
+ < div className = { styles . cloudSsoPromoTooltip } >
229
+ < EuiIcon type = { ConfettiIcon } className = { styles . cloudSsoPromoTooltipIcon } />
230
+ < div >
231
+ New!
232
+ < br />
233
+ Now you can create a free Redis Stack database in Redis Enterprise Cloud in a few clicks.
234
+ </ div >
218
235
</ div >
219
- </ div >
220
236
) }
221
- >
222
- { promoLink }
223
- </ EuiToolTip >
237
+ >
238
+ { promoLink }
239
+ </ EuiToolTip >
240
+ </ HighlightedFeature >
224
241
</ FeatureFlagComponent >
225
242
)
226
243
}
0 commit comments