Skip to content

Commit 2f2a799

Browse files
committed
#RI-5196- add highlighting for explore panel
1 parent e4d933f commit 2f2a799

File tree

2 files changed

+42
-23
lines changed

2 files changed

+42
-23
lines changed

redisinsight/ui/src/components/insights-trigger/InsightsTrigger.tsx

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,20 @@ import { recommendationsSelector, resetRecommendationsHighlighting } from 'uiSrc
1212
import { InsightsPanelTabs } from 'uiSrc/slices/interfaces/insights'
1313
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry'
1414
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'
1519
import styles from './styles.module.scss'
1620

1721
const InsightsTrigger = () => {
1822
const { isOpen: isInsigtsOpen, tabSelected } = useSelector(insightsPanelSelector)
1923
const { isHighlighted, } = useSelector(recommendationsSelector)
2024
const { provider } = useSelector(connectedInstanceSelector)
2125

26+
const { features } = useSelector(appFeatureHighlightingSelector)
27+
const { insights: insightsHighlighting } = getHighlightingFeatures(features)
28+
2229
const dispatch = useDispatch()
2330
const { pathname } = useLocation()
2431
const { instanceId } = useParams<{ instanceId: string }>()
@@ -44,37 +51,45 @@ const InsightsTrigger = () => {
4451
source: 'overview'
4552
},
4653
})
54+
55+
dispatch(removeFeatureFromHighlighting('insights'))
4756
}
4857

4958
return (
5059
<div
5160
className={cx(styles.container, { [styles.isOpen]: isInsigtsOpen })}
5261
>
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 || {})}
5866
>
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.'}
6872
>
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"
7282
>
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>
7893
</div>
7994
)
8095
}

redisinsight/ui/src/constants/featuresHighlighting.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,9 @@ interface BuildHighlightingFeature {
1212
}
1313

1414
export const BUILD_FEATURES: Record<string, BuildHighlightingFeature> = {
15-
15+
insights: {
16+
type: 'tooltip',
17+
title: 'Try Redis Tutorials',
18+
content: 'Try our interactive Tutorials to learn how Redis can solve your use cases.',
19+
}
1620
} as const

0 commit comments

Comments
 (0)