Skip to content

Commit ec2d906

Browse files
committed
Fix sidebar external links
1 parent 8bdc2f6 commit ec2d906

File tree

3 files changed

+45
-18
lines changed

3 files changed

+45
-18
lines changed

src/components/Sidebar/SidebarStructure.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ const structure = [
227227
{ id: 14, type: 'divider' },
228228
{ id: 15, type: 'title', label: 'HELP' },
229229
{ id: 16, label: 'Library', link: 'https://flatlogic.com/templates/', icon: <LibraryIcon />, ext: true },
230-
{ id: 17, label: 'Support', link: 'https://flatlogic.com/forum/', icon: <SupportIcon /> },
231-
{ id: 18, label: 'FAQ', link: 'https://flatlogic.com/forum/', icon: <FAQIcon /> },
230+
{ id: 17, label: 'Support', link: 'https://flatlogic.com/forum/', icon: <SupportIcon />, ext: true },
231+
{ id: 18, label: 'FAQ', link: 'https://flatlogic.com/forum/', icon: <FAQIcon />, ext: true },
232232
{ id: 19, type: 'divider' },
233233
{ id: 20, type: 'title', label: 'PROJECTS' },
234234
{

src/components/Sidebar/components/SidebarLink/SidebarLink.js

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ import useStyles2 from '../../styles';
2424

2525
// components
2626
import Dot from '../Dot';
27-
import { Button, Badge } from '../../../Wrappers';
27+
import {Button, Badge, Link as LinkMaterial} from '../../../Wrappers';
2828

2929
export default function SidebarLink({
3030
link,
31+
ext,
3132
icon,
3233
label,
3334
children,
@@ -87,6 +88,47 @@ export default function SidebarLink({
8788
setAnchorEl(null);
8889
};
8990

91+
if (!children && ext)
92+
return (
93+
<>
94+
<ListItem
95+
onClick={(e) => {
96+
if (click) {
97+
return click(e, addSectionClick, onLogin);
98+
}
99+
return toggleDrawer(e);
100+
}}
101+
onKeyPress={toggleDrawer}
102+
component={link ? LinkMaterial : null}
103+
href={link}
104+
className={classes.link}
105+
classes={{
106+
root: classnames(classes.link, {
107+
[classes.linkActive]: isLinkActive && !nested,
108+
[classes.linkNested]: nested,
109+
}),
110+
}}
111+
>
112+
<ListItemIcon
113+
className={classnames(classes.linkIcon, {
114+
[classes.linkIconActive]: isLinkActive,
115+
})}
116+
style={{ margin: nested && -11 }}
117+
>
118+
{nested ? <Dot color={isLinkActive && 'primary'} /> : icon}
119+
</ListItemIcon>
120+
<ListItemText
121+
classes={{
122+
primary: classnames(classes.linkText, {
123+
[classes.linkTextActive]: isLinkActive,
124+
[classes.linkTextHidden]: !isSidebarOpened,
125+
}),
126+
}}
127+
primary={label}
128+
/>
129+
</ListItem>
130+
</>
131+
);
90132
if (!children)
91133
return (
92134
<>

src/pages/CRUD/Users/table/UsersTable.js

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { uniqueId } from 'lodash';
99

1010
import { makeStyles } from '@mui/styles';
1111
import { DataGrid } from '@mui/x-data-grid';
12-
import { Link as LinkMaterial } from '../../../../components/Wrappers';
1312

1413
import MenuItem from '@mui/material/MenuItem';
1514

@@ -405,20 +404,6 @@ const UsersTable = () => {
405404
autoHeight
406405
/>
407406
</div>
408-
409-
<div>
410-
<LinkMaterial
411-
color={'primary'}
412-
target={'_blank'}
413-
href={
414-
process.env.NODE_ENV === 'production'
415-
? window.location.origin + '/api-docs/#/Users'
416-
: 'http://localhost:8080/api-docs/#/Users'
417-
}
418-
>
419-
API documentation for users
420-
</LinkMaterial>
421-
</div>
422407
</Widget>
423408

424409
<Dialog

0 commit comments

Comments
 (0)