Skip to content

Commit 549f16e

Browse files
committed
#RI-4768 - Change design for recommendations
1 parent c968889 commit 549f16e

File tree

5 files changed

+113
-54
lines changed

5 files changed

+113
-54
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={`snooze-${name}-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: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1+
:global(.euiAccordion__childWrapper) {
2+
background-color: var(--recommendationBgColor);
3+
}
4+
15
.recommendationAccordion {
2-
border: 1px solid var(--recommendationLiveBorderColor);
36
margin-bottom: 10px;
4-
border-radius: 4px;
7+
border-radius: 8px;
58
overflow: hidden;
69

7-
&.read {
8-
border: 1px solid var(--controlsBorderColor);
9-
}
10-
1110
.redisStackLink {
1211
margin-right: 12px;
1312
}
1413

1514
:global {
1615
.euiAccordion__button {
17-
padding: 4px 18px;
16+
padding: 6px 18px;
1817
border-bottom: 1px solid transparent;
1918
color: var(--euiTextSubduedColor) !important;
20-
background-color: var(--recommendationsBgColor) !important;
19+
background-color: var(--recommendationBgColor) !important;
2120
font-size: 14px;
2221
font-weight: 400;
2322

@@ -35,8 +34,7 @@
3534

3635
.euiAccordion.euiAccordion-isOpen {
3736
.euiAccordion__button {
38-
border-bottom-color: var(--controlsBorderColor);
39-
background-color: var(--recommendationBgColor) !important;
37+
padding: 14px 18px;
4038
color: var(--htmlColor) !important;
4139
font-weight: 500;
4240
}
@@ -49,15 +47,15 @@
4947
}
5048

5149
.euiPanel {
52-
background: var(--recommendationsBgColor) !important;
53-
padding-bottom: 0 !important;
50+
background: var(--recommendationBgColor) !important;
51+
padding: 0 18px 18px !important;
5452
}
5553

5654
.euiAccordion__iconWrapper {
5755
display: flex;
5856
justify-content: center;
5957
align-items: center;
60-
}
58+
}
6159

6260
.euiAccordion__buttonReverse .euiAccordion__icon {
6361
width: 12px;
@@ -108,32 +106,18 @@
108106
margin-top: 15px;
109107
justify-content: space-around;
110108
align-items: center;
111-
border-top: 1px solid var(--separatorColorLight);
112109
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-
}
130110
}
131111

132112
.fullWidth {
133113
width: 100%;
134114
}
135115

136116
.votingContainer {
117+
justify-content: center;
118+
border-radius: 8px;
119+
background-color: var(--recommendationsBgColor) !important;
120+
padding: 4px 0;
137121
:global {
138122
.voteContent {
139123
margin-left: 6px !important;
@@ -152,3 +136,40 @@
152136
.keyNameContainer {
153137
background-color: var(--recommendationBgColor);
154138
}
139+
140+
.snoozeBtn {
141+
svg {
142+
fill: var(--recommendationBgColor) !important;
143+
g {
144+
stroke: currentColor !important;
145+
}
146+
}
147+
}
148+
149+
.accordionContent {
150+
.btn {
151+
box-shadow: none !important;
152+
display: block;
153+
margin-top: 1px;
154+
height: 32px !important;
155+
min-width: 60px !important;
156+
border-color: var(--highlightDotColor) !important;
157+
background-color: var(--highlightDotColor) !important;
158+
margin-bottom: 12px;
159+
160+
svg path {
161+
fill: var(--euiColorEmptyShade);
162+
}
163+
164+
:global(.euiButton__content) {
165+
padding: 0 12px;
166+
}
167+
168+
:global(.euiButton__text) {
169+
color: var(--euiColorEmptyShade);
170+
font:
171+
normal normal 400 14px/17px Graphik,
172+
sans-serif !important;
173+
}
174+
}
175+
}

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)