Added short code length field to form to create short URLs

This commit is contained in:
Alejandro Celaya
2020-03-29 18:55:41 +02:00
parent 9a20b4428d
commit bd29670108
5 changed files with 60 additions and 19 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { serverType } from '../prop-types';
import { compareVersions } from '../../utils/helpers/version';
import { versionMatch } from '../../utils/helpers/version';
const propTypes = {
minVersion: PropTypes.string,
@@ -16,10 +16,9 @@ const ForServerVersion = ({ minVersion, maxVersion, selectedServer, children })
}
const { version } = selectedServer;
const matchesMinVersion = !minVersion || compareVersions(version, '>=', minVersion);
const matchesMaxVersion = !maxVersion || compareVersions(version, '<=', maxVersion);
const matchesVersion = versionMatch(version, { maxVersion, minVersion });
if (!matchesMinVersion || !matchesMaxVersion) {
if (!matchesVersion) {
return null;
}