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,17 @@ 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
+
57
+ console . log ( features )
58
+
48
59
useEffect ( ( ) => {
49
60
if ( loading || ! data || isEmpty ( data ) ) {
50
61
return
@@ -170,6 +181,8 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
170
181
</ div >
171
182
)
172
183
184
+ console . log ( cloudButtonHighlighting )
185
+
173
186
const CreateBtn = ( { content } : { content : ContentCreateRedis } ) => {
174
187
const { title, description, styles : stylesCss , links } = content
175
188
// @ts -ignore
@@ -205,22 +218,28 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
205
218
)
206
219
return (
207
220
< 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.
221
+ < HighlightedFeature
222
+ isHighlight = { cloudButtonHighlighting }
223
+ type = { BUILD_FEATURES ?. cloudButton ?. type }
224
+ onClick = { ( ) => dispatch ( removeFeatureFromHighlighting ( 'cloudButton' ) ) }
225
+ >
226
+ < EuiToolTip
227
+ position = "bottom"
228
+ anchorClassName = { styles . cloudSsoPromoBtnAnchor }
229
+ content = { (
230
+ < div className = { styles . cloudSsoPromoTooltip } >
231
+ < EuiIcon type = { ConfettiIcon } className = { styles . cloudSsoPromoTooltipIcon } />
232
+ < div >
233
+ New!
234
+ < br />
235
+ Now you can create a free Redis Stack database in Redis Enterprise Cloud in a few clicks.
236
+ </ div >
218
237
</ div >
219
- </ div >
220
238
) }
221
- >
222
- { promoLink }
223
- </ EuiToolTip >
239
+ >
240
+ { promoLink }
241
+ </ EuiToolTip >
242
+ </ HighlightedFeature >
224
243
</ FeatureFlagComponent >
225
244
)
226
245
}
0 commit comments