2020-03-05 12:18:33 +03:00
|
|
|
import React from 'react';
|
2020-03-05 13:11:26 +03:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import classNames from 'classnames';
|
2020-03-05 14:53:32 +03:00
|
|
|
import { pipe } from 'ramda';
|
2020-03-05 12:18:33 +03:00
|
|
|
import { serverType } from '../servers/prop-types';
|
2020-03-28 19:33:23 +03:00
|
|
|
import { versionToPrintable, versionToSemVer } from '../utils/helpers/version';
|
2020-07-09 13:58:10 +03:00
|
|
|
import { ExternalLink } from 'react-external-link';
|
2020-03-05 14:53:32 +03:00
|
|
|
|
|
|
|
const SHLINK_WEB_CLIENT_VERSION = '%_VERSION_%';
|
2020-03-05 12:18:33 +03:00
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
selectedServer: serverType,
|
2020-03-05 13:11:26 +03:00
|
|
|
className: PropTypes.string,
|
2020-03-05 14:53:32 +03:00
|
|
|
clientVersion: PropTypes.string,
|
2020-03-05 12:18:33 +03:00
|
|
|
};
|
|
|
|
|
2020-03-05 14:53:32 +03:00
|
|
|
const ShlinkVersions = ({ selectedServer, className, clientVersion = SHLINK_WEB_CLIENT_VERSION }) => {
|
2020-07-09 16:47:09 +03:00
|
|
|
const { printableVersion: serverVersion } = selectedServer;
|
|
|
|
const normalizedClientVersion = pipe(versionToSemVer(), versionToPrintable)(clientVersion);
|
2020-03-05 12:18:33 +03:00
|
|
|
|
2020-03-05 14:53:32 +03:00
|
|
|
return (
|
|
|
|
<small className={classNames('text-muted', className)}>
|
2020-07-09 16:54:45 +03:00
|
|
|
Client: {<ExternalLink href="https://github.com/shlinkio/shlink-web-client/releases/" className="text-muted"><b>{normalizedClientVersion}</b></ExternalLink>} - Server: {<ExternalLink href="https://github.com/shlinkio/shlink/releases/" className="text-muted"><b>{serverVersion}</b></ExternalLink>}
|
2020-03-05 14:53:32 +03:00
|
|
|
</small>
|
|
|
|
);
|
2020-03-05 12:18:33 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
ShlinkVersions.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default ShlinkVersions;
|