Files
shlink-web-client/src/common/ShlinkVersions.js
MartinH0 d46acdbd70 Added Links to Version Info
Actually it would be better if the link is just added if version info is provided. Now the Link is given always.
2020-07-07 22:10:35 +02:00

30 lines
1.1 KiB
JavaScript

import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { pipe } from 'ramda';
import { serverType } from '../servers/prop-types';
import { versionToPrintable, versionToSemVer } from '../utils/helpers/version';
const SHLINK_WEB_CLIENT_VERSION = '%_VERSION_%';
const propTypes = {
selectedServer: serverType,
className: PropTypes.string,
clientVersion: PropTypes.string,
};
const ShlinkVersions = ({ selectedServer, className, clientVersion = SHLINK_WEB_CLIENT_VERSION }) => {
const { printableVersion: serverVersion } = selectedServer;
const normalizedClientVersion = pipe(versionToSemVer(), versionToPrintable)(clientVersion);
return (
<small className={classNames('text-muted', className)}>
Client: <a href="https://github.com/shlinkio/shlink-web-client/releases" rel="noopener noreferrer"><b>{normalizedClientVersion}</b></a> - Server: <a href="https://github.com/shlinkio/shlink/releases" rel="noopener noreferrer"><b>{serverVersion}</b></a>
</small>
);
};
ShlinkVersions.propTypes = propTypes;
export default ShlinkVersions;