diff --git a/client/components/domains/register-domain-step/index.jsx b/client/components/domains/register-domain-step/index.jsx index 3bc26320fb328..fe47d3d3a3d26 100644 --- a/client/components/domains/register-domain-step/index.jsx +++ b/client/components/domains/register-domain-step/index.jsx @@ -269,7 +269,6 @@ class RegisterDomainStep extends Component { getInitialFiltersState() { return { - maxCharacters: '', exactSldMatchesOnly: false, tlds: [], }; @@ -532,9 +531,7 @@ class RegisterDomainStep extends Component { } renderSearchFilters() { - const isKrackenUi = - config.isEnabled( 'domains/kracken-ui/exact-match-filter' ) || - config.isEnabled( 'domains/kracken-ui/max-characters-filter' ); + const isKrackenUi = config.isEnabled( 'domains/kracken-ui/exact-match-filter' ); const isRenderingInitialSuggestions = ! Array.isArray( this.state.searchResults ) && ! this.state.loadingResults && diff --git a/client/components/domains/search-filters/dropdown-filters.jsx b/client/components/domains/search-filters/dropdown-filters.jsx index 412aa0e5fe0e2..079fb1f392560 100644 --- a/client/components/domains/search-filters/dropdown-filters.jsx +++ b/client/components/domains/search-filters/dropdown-filters.jsx @@ -8,22 +8,19 @@ import PropTypes from 'prop-types'; import { createRef, Component } from 'react'; import FormInputCheckbox from 'calypso/components/forms/form-checkbox'; import FormFieldset from 'calypso/components/forms/form-fieldset'; -import FormTextInput from 'calypso/components/forms/form-text-input'; import TokenField from 'calypso/components/token-field'; import ValidationFieldset from 'calypso/signup/validation-fieldset'; -const HANDLED_FILTER_KEYS = [ 'tlds', 'maxCharacters', 'exactSldMatchesOnly' ]; +const HANDLED_FILTER_KEYS = [ 'tlds', 'exactSldMatchesOnly' ]; export class DropdownFilters extends Component { static propTypes = { availableTlds: PropTypes.array, filters: PropTypes.shape( { - maxCharacters: PropTypes.string, exactSldMatchesOnly: PropTypes.bool, tlds: PropTypes.array, } ).isRequired, lastFilters: PropTypes.shape( { - maxCharacters: PropTypes.string, exactSldMatchesOnly: PropTypes.bool, tlds: PropTypes.array, } ).isRequired, @@ -41,7 +38,6 @@ export class DropdownFilters extends Component { state = { showPopover: false, - showOverallValidationError: false, }; constructor( props ) { @@ -65,32 +61,10 @@ export class DropdownFilters extends Component { getFiltercounts() { return ( ( this.props.lastFilters.tlds?.length || 0 ) + - ( this.props.lastFilters.exactSldMatchesOnly && 1 ) + - ( this.props.lastFilters.maxCharacters !== '' && 1 ) + ( this.props.lastFilters.exactSldMatchesOnly && 1 ) ); } - getMaxCharactersValidationErrors() { - const { - filters: { maxCharacters }, - translate, - } = this.props; - const isValid = /^-?\d*$/.test( maxCharacters ); - return ! isValid ? [ translate( 'Value must be a whole number' ) ] : null; - } - - getOverallValidationErrors() { - const isValid = this.getMaxCharactersValidationErrors() === null; - const { showOverallValidationError } = this.state; - return ! isValid && showOverallValidationError - ? [ this.props.translate( 'Please correct any errors above' ) ] - : null; - } - - hasValidationErrors() { - return this.getOverallValidationErrors() !== null; - } - updateFilterValues = ( name, value ) => { this.props.onChange( { [ name ]: value, @@ -107,18 +81,13 @@ export class DropdownFilters extends Component { }; handleFiltersReset = () => { - this.setState( { showOverallValidationError: false }, () => { + this.setState( {}, () => { this.togglePopover( { discardChanges: false } ); - this.props.onReset( 'tlds', 'maxCharacters', 'exactSldMatchesOnly' ); + this.props.onReset( 'tlds', 'exactSldMatchesOnly' ); } ); }; handleFiltersSubmit = () => { - if ( this.hasValidationErrors() ) { - this.setState( { showOverallValidationError: true } ); - return; - } - - this.setState( { showOverallValidationError: false }, () => { + this.setState( {}, () => { this.togglePopover( { discardChanges: false } ); this.hasFiltersChanged() && this.props.onSubmit(); } ); @@ -180,14 +149,13 @@ export class DropdownFilters extends Component { renderPopover() { const { - filters: { maxCharacters, exactSldMatchesOnly }, + filters: { exactSldMatchesOnly }, popoverId, translate, showTldFilter, } = this.props; const isExactMatchFilterEnabled = config.isEnabled( 'domains/kracken-ui/exact-match-filter' ); - const isLengthFilterEnabled = config.isEnabled( 'domains/kracken-ui/max-characters-filter' ); return ( 660px' ) && { relativePosition: { left: -238 } } ) } hideArrow > - { isLengthFilterEnabled && ( - - - { translate( 'Max Characters' ) }: - - - - ) } - { showTldFilter && ( - +