Added shlink versions to side menu

This commit is contained in:
Alejandro Celaya
2020-03-05 11:11:26 +01:00
parent b02dcf6c53
commit 1e949b3a22
13 changed files with 110 additions and 101 deletions

View File

@@ -24,7 +24,7 @@ const propTypes = {
showOnMobile: PropTypes.bool,
};
const AsideMenu = (DeleteServerButton, ShlinkVersions) => {
const AsideMenu = (DeleteServerButton) => {
const AsideMenu = ({ selectedServer, className, showOnMobile }) => {
const serverId = selectedServer ? selectedServer.id : '';
const asideClass = classNames('aside-menu', className, {
@@ -49,7 +49,6 @@ const AsideMenu = (DeleteServerButton, ShlinkVersions) => {
<span className="aside-menu__item-text">Manage tags</span>
</AsideMenuItem>
<ShlinkVersions />
<DeleteServerButton className="aside-menu__item aside-menu__item--danger" server={selectedServer} />
</nav>
</aside>

View File

@@ -61,15 +61,17 @@ const MenuLayout = (TagsList, ShortUrls, AsideMenu, CreateShortUrl, ShortUrlVisi
<div className="row menu-layout__swipeable-inner">
<AsideMenu className="col-lg-2 col-md-3" selectedServer={selectedServer} showOnMobile={showSideBar} />
<div className="col-lg-10 offset-lg-2 col-md-9 offset-md-3" onClick={() => setShowSidebar(false)}>
<Switch>
<Route exact path="/server/:serverId/list-short-urls/:page" component={ShortUrls} />
<Route exact path="/server/:serverId/create-short-url" component={CreateShortUrl} />
<Route exact path="/server/:serverId/short-code/:shortCode/visits" component={ShortUrlVisits} />
<Route exact path="/server/:serverId/manage-tags" component={TagsList} />
<Route
render={() => <NotFound to={`/server/${serverId}/list-short-urls/1`} btnText="List short URLs" />}
/>
</Switch>
<div className="shlink-container">
<Switch>
<Route exact path="/server/:serverId/list-short-urls/:page" component={ShortUrls} />
<Route exact path="/server/:serverId/create-short-url" component={CreateShortUrl} />
<Route exact path="/server/:serverId/short-code/:shortCode/visits" component={ShortUrlVisits} />
<Route exact path="/server/:serverId/manage-tags" component={TagsList} />
<Route
render={() => <NotFound to={`/server/${serverId}/list-short-urls/1`} btnText="List short URLs" />}
/>
</Switch>
</div>
</div>
</div>
</Swipeable>

View File

@@ -1,14 +1,17 @@
import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { serverType } from '../servers/prop-types';
const propTypes = {
selectedServer: serverType,
className: PropTypes.string,
};
const ShlinkVersions = ({ selectedServer }) => {
const { version } = selectedServer;
const ShlinkVersions = ({ selectedServer, className }) => {
const { printableVersion } = selectedServer;
return <span>Server: v{version}</span>;
return <small className={classNames('text-muted', className)}>Client: v2.3.1 / Server: {printableVersion}</small>;
};
ShlinkVersions.propTypes = propTypes;

View File

@@ -31,7 +31,7 @@ const provideServices = (bottle, connect, withRouter) => {
bottle.decorator('MenuLayout', connect([ 'selectedServer', 'shortUrlsListParams' ], [ 'selectServer' ]));
bottle.decorator('MenuLayout', withRouter);
bottle.serviceFactory('AsideMenu', AsideMenu, 'DeleteServerButton', 'ShlinkVersions');
bottle.serviceFactory('AsideMenu', AsideMenu, 'DeleteServerButton');
bottle.serviceFactory('ShlinkVersions', () => ShlinkVersions);
bottle.decorator('ShlinkVersions', connect([ 'selectedServer' ]));