Skip to content

Commit 2a930db

Browse files
Merge pull request #2368 from RedisInsight/fe/feature/RI-4768_Change_design_for_recommendation
#RI-4768 - Change design for recommendations
2 parents a94dc8d + e776726 commit 2a930db

File tree

5 files changed

+114
-51
lines changed

5 files changed

+114
-51
lines changed
Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 7 additions & 0 deletions
Loading

redisinsight/ui/src/components/live-time-recommendations/components/recommendation/Recommendation.tsx

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ import { IRecommendationsStatic, IRecommendationParams } from 'uiSrc/slices/inte
3030
import _content from 'uiSrc/constants/dbAnalysisRecommendations.json'
3131
import RediStackDarkMin from 'uiSrc/assets/img/modules/redistack/RediStackDark-min.svg'
3232
import RediStackLightMin from 'uiSrc/assets/img/modules/redistack/RediStackLight-min.svg'
33+
import { ReactComponent as SnoozeIcon } from 'uiSrc/assets/img/icons/snooze.svg'
34+
import { ReactComponent as StarsIcon } from 'uiSrc/assets/img/icons/stars.svg'
3335

3436
import styles from './styles.module.scss'
3537

@@ -118,9 +120,17 @@ const Recommendation = ({
118120
)
119121
}
120122

121-
const handleDelete = () => {
123+
const handleDelete = (event: React.MouseEvent) => {
124+
event.stopPropagation()
125+
event.preventDefault()
122126
setIsLoading(true)
123-
dispatch(deleteLiveRecommendations([id], onSuccessActionDelete, () => setIsLoading(false)))
127+
dispatch(
128+
deleteLiveRecommendations(
129+
[id],
130+
onSuccessActionDelete,
131+
() => setIsLoading(false)
132+
)
133+
)
124134
}
125135

126136
const onSuccessActionDelete = () => {
@@ -149,6 +159,19 @@ const Recommendation = ({
149159

150160
const recommendationContent = () => (
151161
<EuiText>
162+
{!isUndefined(tutorial) && (
163+
<EuiButton
164+
fill
165+
iconType={StarsIcon}
166+
iconSide="right"
167+
className={styles.btn}
168+
onClick={handleRedirect}
169+
color="secondary"
170+
data-testid={`${name}-to-tutorial-btn`}
171+
>
172+
{ tutorial ? 'Start Tutorial' : 'Workbench' }
173+
</EuiButton>
174+
)}
152175
{renderRecommendationContent(
153176
recommendationsContent[name]?.content,
154177
params,
@@ -168,26 +191,6 @@ const Recommendation = ({
168191
)}
169192
<div className={styles.actions}>
170193
<RecommendationVoting live id={id} vote={vote} name={name} containerClass={styles.votingContainer} />
171-
<EuiButton
172-
isDisabled={isLoading}
173-
className={styles.btn}
174-
onClick={handleDelete}
175-
color="secondary"
176-
data-testid={`${name}-delete-btn`}
177-
>
178-
Snooze
179-
</EuiButton>
180-
{!isUndefined(tutorial) && (
181-
<EuiButton
182-
fill
183-
className={styles.btn}
184-
onClick={handleRedirect}
185-
color="secondary"
186-
data-testid={`${name}-to-tutorial-btn`}
187-
>
188-
{ tutorial ? 'Tutorial' : 'Workbench' }
189-
</EuiButton>
190-
)}
191194
</div>
192195
</EuiText>
193196
)
@@ -228,6 +231,24 @@ const Recommendation = ({
228231
<EuiFlexItem grow className="truncateText">
229232
{title}
230233
</EuiFlexItem>
234+
<EuiFlexItem grow={false}>
235+
<EuiToolTip
236+
title="Snooze recommendation"
237+
content="This recommendation will be removed from the list and displayed again when relevant."
238+
position="top"
239+
display="inlineBlock"
240+
anchorClassName="flex-row"
241+
>
242+
<EuiButtonIcon
243+
href="#"
244+
iconType={SnoozeIcon}
245+
className={styles.snoozeBtn}
246+
onClick={handleDelete}
247+
aria-label="snooze recommendation"
248+
data-testid={`${name}-delete-btn`}
249+
/>
250+
</EuiToolTip>
251+
</EuiFlexItem>
231252
<EuiFlexItem grow={false}>
232253
<EuiToolTip
233254
title={`${hide ? 'Show' : 'Hide'} recommendation`}

redisinsight/ui/src/components/live-time-recommendations/components/recommendation/styles.module.scss

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
.recommendationAccordion {
2-
border: 1px solid var(--recommendationLiveBorderColor);
32
margin-bottom: 10px;
4-
border-radius: 4px;
3+
border-radius: 8px;
54
overflow: hidden;
5+
border: 1px solid var(--recommendationLiveBorderColor);
66

77
&.read {
8-
border: 1px solid var(--controlsBorderColor);
8+
border: 1px solid var(--recommendationBgColor);
99
}
1010

1111
.redisStackLink {
1212
margin-right: 12px;
1313
}
1414

1515
:global {
16+
.euiAccordion__childWrapper {
17+
background-color: var(--recommendationBgColor) !important;
18+
}
1619
.euiAccordion__button {
17-
padding: 4px 18px;
20+
padding: 6px 18px;
1821
border-bottom: 1px solid transparent;
1922
color: var(--euiTextSubduedColor) !important;
20-
background-color: var(--recommendationsBgColor) !important;
23+
background-color: var(--recommendationBgColor) !important;
2124
font-size: 14px;
2225
font-weight: 400;
2326

@@ -35,8 +38,7 @@
3538

3639
.euiAccordion.euiAccordion-isOpen {
3740
.euiAccordion__button {
38-
border-bottom-color: var(--controlsBorderColor);
39-
background-color: var(--recommendationBgColor) !important;
41+
padding: 14px 18px;
4042
color: var(--htmlColor) !important;
4143
font-weight: 500;
4244
}
@@ -49,15 +51,15 @@
4951
}
5052

5153
.euiPanel {
52-
background: var(--recommendationsBgColor) !important;
53-
padding-bottom: 0 !important;
54+
background: var(--recommendationBgColor) !important;
55+
padding: 0 18px 18px !important;
5456
}
5557

5658
.euiAccordion__iconWrapper {
5759
display: flex;
5860
justify-content: center;
5961
align-items: center;
60-
}
62+
}
6163

6264
.euiAccordion__buttonReverse .euiAccordion__icon {
6365
width: 12px;
@@ -108,32 +110,18 @@
108110
margin-top: 15px;
109111
justify-content: space-around;
110112
align-items: center;
111-
border-top: 1px solid var(--separatorColorLight);
112113
height: 48px;
113-
114-
.btn {
115-
height: 32px !important;
116-
min-width: 60px !important;
117-
118-
:global(.euiButton__content) {
119-
padding: 0 12px;
120-
}
121-
122-
:global(.euiButton__text) {
123-
font: normal normal 400 14px/17px Graphik, sans-serif !important;
124-
}
125-
126-
&:last-of-type {
127-
margin-left: 8px !important;
128-
}
129-
}
130114
}
131115

132116
.fullWidth {
133117
width: 100%;
134118
}
135119

136120
.votingContainer {
121+
justify-content: center;
122+
border-radius: 8px;
123+
background-color: var(--recommendationsBgColor) !important;
124+
padding: 4px 0;
137125
:global {
138126
.voteContent {
139127
margin-left: 6px !important;
@@ -152,3 +140,40 @@
152140
.keyNameContainer {
153141
background-color: var(--recommendationBgColor);
154142
}
143+
144+
.snoozeBtn {
145+
svg {
146+
fill: var(--recommendationBgColor) !important;
147+
g {
148+
stroke: currentColor !important;
149+
}
150+
}
151+
}
152+
153+
.accordionContent {
154+
.btn {
155+
box-shadow: none !important;
156+
display: block;
157+
margin-top: 1px;
158+
height: 32px !important;
159+
min-width: 60px !important;
160+
border-color: var(--highlightDotColor) !important;
161+
background-color: var(--highlightDotColor) !important;
162+
margin-bottom: 12px;
163+
164+
svg path {
165+
fill: var(--euiColorEmptyShade);
166+
}
167+
168+
:global(.euiButton__content) {
169+
padding: 0 12px;
170+
}
171+
172+
:global(.euiButton__text) {
173+
color: var(--euiColorEmptyShade);
174+
font:
175+
normal normal 500 14px/17px Graphik,
176+
sans-serif !important;
177+
}
178+
}
179+
}

redisinsight/ui/src/components/recommendation-copy-component/styles.module.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
.keyName {
1414
padding: 4px 30px 4px 8px;
15-
background-color: var(--recommendationBgColor);
15+
background-color: var(--recommendationsBgColor);
1616
border: 1px dashed var(--separatorColorLight);
1717
border-radius: 4px;
1818
font: normal normal normal 13px/16px Graphik, sans-serif !important;

0 commit comments

Comments
 (0)