mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 01:20:24 +03:00
Simplified AsideMenu component removing unneeded checks
This commit is contained in:
parent
073703ef5b
commit
86eb963176
1 changed files with 7 additions and 13 deletions
|
@ -1,18 +1,13 @@
|
||||||
import listIcon from '@fortawesome/fontawesome-free-solid/faBars';
|
import listIcon from '@fortawesome/fontawesome-free-solid/faBars'
|
||||||
import createIcon from '@fortawesome/fontawesome-free-solid/faPlus';
|
import createIcon from '@fortawesome/fontawesome-free-solid/faPlus'
|
||||||
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
|
import FontAwesomeIcon from '@fortawesome/react-fontawesome'
|
||||||
import React from 'react';
|
import React from 'react'
|
||||||
import { NavLink } from 'react-router-dom';
|
import { NavLink } from 'react-router-dom'
|
||||||
import DeleteServerButton from '../servers/DeleteServerButton';
|
import DeleteServerButton from '../servers/DeleteServerButton'
|
||||||
import './AsideMenu.scss';
|
import './AsideMenu.scss'
|
||||||
|
|
||||||
export default function AsideMenu({ selectedServer, history }) {
|
export default function AsideMenu({ selectedServer, history }) {
|
||||||
const serverId = selectedServer ? selectedServer.id : '';
|
const serverId = selectedServer ? selectedServer.id : '';
|
||||||
const isListShortUrlsActive = (match, { pathname }) => {
|
|
||||||
// FIXME. Should use the 'match' params, but they are not being properly resolved. Investigate
|
|
||||||
const serverIdFromPathname = pathname.split('/')[2];
|
|
||||||
return serverIdFromPathname === serverId && pathname.indexOf('list-short-urls') !== -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside className="aside-menu col-lg-2 col-md-3">
|
<aside className="aside-menu col-lg-2 col-md-3">
|
||||||
|
@ -21,7 +16,6 @@ export default function AsideMenu({ selectedServer, history }) {
|
||||||
className="aside-menu__item"
|
className="aside-menu__item"
|
||||||
activeClassName="aside-menu__item--selected"
|
activeClassName="aside-menu__item--selected"
|
||||||
to={`/server/${serverId}/list-short-urls/1`}
|
to={`/server/${serverId}/list-short-urls/1`}
|
||||||
isActive={isListShortUrlsActive}
|
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon={listIcon} />
|
<FontAwesomeIcon icon={listIcon} />
|
||||||
<span className="aside-menu__item-text">List short URLs</span>
|
<span className="aside-menu__item-text">List short URLs</span>
|
||||||
|
|
Loading…
Reference in a new issue