Skip to content

Commit a521267

Browse files
committed
#RI-2468 - Add RI GitHub reference to the sidebar
1 parent 5d2eba8 commit a521267

File tree

8 files changed

+92
-28
lines changed

8 files changed

+92
-28
lines changed
Lines changed: 9 additions & 0 deletions
Loading

redisinsight/ui/src/components/divider/Divider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import styles from './styles.module.scss'
55

66
export interface Props {
77
color?: string
8+
colorVariable?: string
89
orientation?: 'horizontal' | 'vertical',
910
variant? : 'fullWidth' | 'middle' | 'half';
1011
className?: string;
1112
}
1213

13-
const Divider = ({ orientation, variant, className, color }: Props) => (
14+
const Divider = ({ orientation, variant, className, color, colorVariable }: Props) => (
1415
<div
1516
className={cx(
1617
styles.divider,
@@ -19,7 +20,7 @@ const Divider = ({ orientation, variant, className, color }: Props) => (
1920
className,
2021
)}
2122
>
22-
<hr style={color ? { backgroundColor: color } : {}} />
23+
<hr style={(color || colorVariable) ? { backgroundColor: color ?? `var(--${colorVariable})` } : {}} />
2324
</div>
2425
)
2526

redisinsight/ui/src/components/divider/styles.module.scss

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
display: flex;
33
align-items: center;
44
justify-content: center;
5-
margin: 8px 0;
65
hr {
76
border: none;
87
height: 1px;
@@ -11,22 +10,20 @@
1110
}
1211
&-vertical {
1312
height: auto;
14-
margin: 0 8px;
1513
hr {
1614
height: 100%;
1715
width: 1px;
1816
}
1917
}
2018

2119
&-middle {
22-
margin: 8px 6px;
20+
margin: 6px 12px;
2321
&.divider-vertical {
24-
margin: 6px 8px;
22+
margin: 12px 6px;
2523
}
2624
}
2725

2826
&-half {
29-
margin: 8px 0;
3027
hr {
3128
width: 50%;
3229
}

redisinsight/ui/src/components/navigation-menu/NavigationMenu.tsx

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from '@elastic/eui'
2020

2121
import { PageNames, Pages } from 'uiSrc/constants'
22+
import { EXTERNAL_LINKS } from 'uiSrc/constants/links'
2223
import { getRouterLinkProps } from 'uiSrc/services'
2324
import { connectedInstanceSelector } from 'uiSrc/slices/instances'
2425
import { appElectronInfoSelector, setReleaseNotesViewed, setShortcutsFlyoutState } from 'uiSrc/slices/app/info'
@@ -29,6 +30,7 @@ import BrowserSVG from 'uiSrc/assets/img/sidebar/browser.svg'
2930
import BrowserActiveSVG from 'uiSrc/assets/img/sidebar/browser_active.svg'
3031
import WorkbenchSVG from 'uiSrc/assets/img/sidebar/workbench.svg'
3132
import WorkbenchActiveSVG from 'uiSrc/assets/img/sidebar/workbench_active.svg'
33+
import GithubSVG from 'uiSrc/assets/img/sidebar/github.svg'
3234
import Divider from 'uiSrc/components/divider/Divider'
3335

3436
import { BuildType } from 'uiSrc/constants/env'
@@ -177,7 +179,7 @@ const NavigationMenu = ({ buildType }: IProps) => {
177179
<EuiLink
178180
external={false}
179181
className={styles.helpMenuItemLink}
180-
href="https://github.com/RedisInsight/RedisInsight/issues"
182+
href={EXTERNAL_LINKS.githubIssues}
181183
target="_blank"
182184
data-testid="submit-bug-btn"
183185
>
@@ -212,7 +214,7 @@ const NavigationMenu = ({ buildType }: IProps) => {
212214
external={false}
213215
className={styles.helpMenuItemLink}
214216
onClick={onClickReleaseNotes}
215-
href="https://docs.redis.com/staging/release-ri-v2.0/ri/release-notes/"
217+
href={EXTERNAL_LINKS.releaseNotes}
216218
target="_blank"
217219
data-testid="release-notes-btn"
218220
>
@@ -236,19 +238,12 @@ const NavigationMenu = ({ buildType }: IProps) => {
236238
content={buildType === BuildType.RedisStack ? 'Edit database' : 'My Redis databases'}
237239
position="right"
238240
>
239-
<span className={styles.iconLogo}>
241+
<span className={cx(styles.iconNavItem, styles.homeIcon)}>
240242
<EuiLink {...getRouterLinkProps(Pages.home)} data-test-subj="home-page-btn">
241243
<EuiIcon aria-label="redisinsight home page" type={LogoSVG} />
242244
</EuiLink>
243245
</span>
244246
</EuiToolTip>
245-
<Divider color="#465282" className="eui-hideFor--xs eui-hideFor--s" variant="middle" />
246-
<Divider
247-
color="#465282"
248-
className="eui-showFor--xs--flex eui-showFor--s--flex"
249-
variant="middle"
250-
orientation="vertical"
251-
/>
252247

253248
{connectedInstanceId && (
254249
privateRoutes.map((nav) => (
@@ -265,13 +260,6 @@ const NavigationMenu = ({ buildType }: IProps) => {
265260
)}
266261
</div>
267262
<div className={styles.bottomContainer}>
268-
<Divider color="#465282" className="eui-hideFor--xs eui-hideFor--s" variant="middle" />
269-
<Divider
270-
color="#465282"
271-
className="eui-showFor--xs--flex eui-showFor--s--flex"
272-
variant="middle"
273-
orientation="vertical"
274-
/>
275263
{HelpMenu()}
276264
{publicRoutes.map((nav) => (
277265
<EuiToolTip content={nav.tooltipText} position="right" key={nav.tooltipText}>
@@ -284,6 +272,33 @@ const NavigationMenu = ({ buildType }: IProps) => {
284272
/>
285273
</EuiToolTip>
286274
))}
275+
<Divider colorVariable="euiColorSecondary" className="eui-hideFor--xs eui-hideFor--s" variant="middle" />
276+
<Divider
277+
colorVariable="euiColorSecondary"
278+
className="eui-showFor--xs--flex eui-showFor--s--flex"
279+
variant="middle"
280+
orientation="vertical"
281+
/>
282+
<EuiToolTip
283+
content="RedisInsight repository"
284+
position="right"
285+
>
286+
<span className={cx(styles.iconNavItem, styles.githubLink)}>
287+
<EuiLink
288+
external={false}
289+
href={EXTERNAL_LINKS.githubRepo}
290+
target="_blank"
291+
data-test-subj="github-repo-btn"
292+
>
293+
<EuiIcon
294+
className={styles.githubIcon}
295+
aria-label="redis insight github repository"
296+
type={GithubSVG}
297+
data-testid="github-repo-icon"
298+
/>
299+
</EuiLink>
300+
</span>
301+
</EuiToolTip>
287302
</div>
288303
</EuiPageSideBar>
289304
)

redisinsight/ui/src/components/navigation-menu/styles.module.scss

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ $sideBarWidth: 60px;
2929

3030
&.active {
3131
background-color: var(--euiColorSuccessText) !important;
32+
transform: none;
33+
cursor: default;
3234
}
3335

3436
&.navigationButtonNotified {
@@ -56,7 +58,6 @@ $sideBarWidth: 60px;
5658

5759
.navigation {
5860
background: var(--navBackgroundColor) !important;
59-
padding: 32px 0;
6061
display: flex !important;
6162
flex-direction: column;
6263
justify-content: space-between;
@@ -74,7 +75,7 @@ $sideBarWidth: 60px;
7475
background-color: var(--navBackgroundColor);
7576
}
7677

77-
.iconLogo {
78+
.iconNavItem {
7879
display: inline-flex;
7980
height: 60px;
8081
width: 60px;
@@ -91,6 +92,43 @@ $sideBarWidth: 60px;
9192
width: 34px;
9293
height: 34px;
9394
}
95+
96+
:global(.euiLink) {
97+
display: flex;
98+
flex: 1;
99+
height: 100%;
100+
width: 100%;
101+
align-items: center;
102+
justify-content: center;
103+
}
104+
}
105+
106+
.homeIcon {
107+
height: 60px;
108+
width: 72px;
109+
@media only screen and (min-width: 768px) {
110+
height: 72px;
111+
width: 60px;
112+
}
113+
}
114+
115+
.githubLink {
116+
:global(.euiLink.euiLink--primary):focus {
117+
animation: none !important;
118+
}
119+
.githubIcon {
120+
width: 30px;
121+
height: 30px;
122+
// color of icon, no need variable here
123+
border: 2px solid #000;
124+
border-radius: 100%;
125+
transition: border-color ease .3s;
126+
}
127+
&:hover {
128+
.githubIcon {
129+
border-color: var(--euiColorSuccessText);
130+
}
131+
}
94132
}
95133

96134
.popoverWrapper {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const EXTERNAL_LINKS = {
2+
githubRepo: 'https://github.com/RedisInsight/RedisInsight',
3+
githubIssues: 'https://github.com/RedisInsight/RedisInsight/issues',
4+
releaseNotes: 'https://docs.redis.com/staging/release-ri-v2.0/ri/release-notes/',
5+
}

redisinsight/ui/src/slices/instances.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const instancesSlice = createSlice({
141141
setConnectedInstance: (state, { payload }: { payload: Instance }) => {
142142
const isRediStack = state.data?.find((db) => db.id === state.connectedInstance.id)?.isRediStack
143143
state.connectedInstance = payload
144-
state.connectedInstance.isRediStack = isRediStack || false
144+
state.connectedInstance.isRediStack = isRediStack || false
145145
},
146146

147147
// reset connected instance

redisinsight/ui/src/styles/base/_base.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ main.euiPageBody {
4343
height: 100% !important;
4444
max-height: 100% !important;
4545
flex: 0 1 0 !important;
46-
padding: 4px 0 20px !important;
4746
overflow: auto !important;
4847
}
4948
}

0 commit comments

Comments
 (0)