From 474239c151c5fcf84819f22f9de799ff614ba994 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Thu, 9 Jul 2020 17:17:19 +0200 Subject: [PATCH] Moved version link to common component, and fixed coding styles --- src/common/ShlinkVersions.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/common/ShlinkVersions.js b/src/common/ShlinkVersions.js index 90cc0ba5..ae083806 100644 --- a/src/common/ShlinkVersions.js +++ b/src/common/ShlinkVersions.js @@ -2,11 +2,12 @@ import React from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { pipe } from 'ramda'; +import { ExternalLink } from 'react-external-link'; import { serverType } from '../servers/prop-types'; import { versionToPrintable, versionToSemVer } from '../utils/helpers/version'; -import { ExternalLink } from 'react-external-link'; const SHLINK_WEB_CLIENT_VERSION = '%_VERSION_%'; +const normalizeVersion = pipe(versionToSemVer(), versionToPrintable); const propTypes = { selectedServer: serverType, @@ -14,13 +15,27 @@ const propTypes = { clientVersion: PropTypes.string, }; +const versionLinkPropTypes = { + project: PropTypes.oneOf([ 'shlink', 'shlink-web-client' ]).isRequired, + version: PropTypes.string.isRequired, +}; + +const VersionLink = ({ project, version }) => ( + + {version} + +); + +VersionLink.propTypes = versionLinkPropTypes; + const ShlinkVersions = ({ selectedServer, className, clientVersion = SHLINK_WEB_CLIENT_VERSION }) => { const { printableVersion: serverVersion } = selectedServer; - const normalizedClientVersion = pipe(versionToSemVer(), versionToPrintable)(clientVersion); + const normalizedClientVersion = normalizeVersion(clientVersion); return ( - Client: {{normalizedClientVersion}} - Server: {{serverVersion}} + Client: - + Server: ); };