Skip to content

Commit f4416a7

Browse files
authored
Merge pull request #2412 from RedisInsight/fe/feature/RI-4750-highlight-cloud-button
#RI-4750 - highlight cloud button
2 parents 185627b + f9062eb commit f4416a7

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed

redisinsight/ui/src/constants/featuresHighlighting.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ interface BuildHighlightingFeature {
1212
}
1313

1414
export const BUILD_FEATURES: Record<string, BuildHighlightingFeature> = {
15-
[PageNames.triggeredFunctions]: {
16-
type: 'tooltip',
17-
title: 'Triggers and Functions',
18-
content: 'Triggers and Functions can execute server-side functions triggered by events or data operations to decrease latency and react in real time to database events.',
19-
page: PageNames.triggeredFunctions,
20-
asPageFeature: true
15+
cloudButton: {
16+
type: 'plain'
2117
}
2218
} as const

redisinsight/ui/src/pages/home/components/HomeHeader/HomeHeader.tsx

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
EuiToolTip,
1010
} from '@elastic/eui'
1111
import { isEmpty } from 'lodash'
12-
import { useSelector } from 'react-redux'
12+
import { useDispatch, useSelector } from 'react-redux'
1313
import cx from 'classnames'
1414
import { FeatureFlagComponent, ImportDatabasesDialog, OAuthSsoHandlerDialog } from 'uiSrc/components'
1515
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
@@ -24,6 +24,10 @@ import { instancesSelector } from 'uiSrc/slices/instances/instances'
2424
import { OAuthSocialSource } from 'uiSrc/slices/interfaces'
2525
import { FeatureFlags } from 'uiSrc/constants'
2626
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'
2731
import SearchDatabasesList from '../SearchDatabasesList'
2832

2933
import styles from './styles.module.scss'
@@ -41,10 +45,15 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
4145
const { theme } = useContext(ThemeContext)
4246
const { data: instances } = useSelector(instancesSelector)
4347
const { loading, data } = useSelector(contentSelector)
48+
const { features } = useSelector(appFeatureHighlightingSelector)
49+
const { cloudButton: cloudButtonHighlighting } = getHighlightingFeatures(features)
50+
4451
const [promoData, setPromoData] = useState<ContentCreateRedis>()
4552
const [guides, setGuides] = useState<IHelpGuide[]>([])
4653
const [isImportDialogOpen, setIsImportDialogOpen] = useState<boolean>(false)
4754

55+
const dispatch = useDispatch()
56+
4857
useEffect(() => {
4958
if (loading || !data || isEmpty(data)) {
5059
return
@@ -170,6 +179,8 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
170179
</div>
171180
)
172181

182+
console.log(cloudButtonHighlighting)
183+
173184
const CreateBtn = ({ content }: { content: ContentCreateRedis }) => {
174185
const { title, description, styles: stylesCss, links } = content
175186
// @ts-ignore
@@ -205,22 +216,28 @@ const HomeHeader = ({ onAddInstance, direction, welcomePage = false }: Props) =>
205216
)
206217
return (
207218
<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>
218235
</div>
219-
</div>
220236
)}
221-
>
222-
{promoLink}
223-
</EuiToolTip>
237+
>
238+
{promoLink}
239+
</EuiToolTip>
240+
</HighlightedFeature>
224241
</FeatureFlagComponent>
225242
)
226243
}

redisinsight/ui/src/pages/home/components/HomeHeader/styles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
.cloudSsoPromoBtnAnchor {
170170
position: relative;
171171
display: flex !important;
172-
width: 260px;
172+
max-width: 348px;
173173
}
174174
.cloudSsoPromoTooltip {
175175
display: flex;

0 commit comments

Comments
 (0)