Use native lang features instead isEmpty

[MAILPOET-3763]
This commit is contained in:
Pavel Dohnal
2021-09-22 13:15:59 +02:00
committed by Veljko V
parent 82a061fac5
commit 14ba0ce8b3
2 changed files with 4 additions and 5 deletions

View File

@@ -3,7 +3,6 @@ import {
__, __,
assoc, assoc,
compose, compose,
isEmpty,
} from 'lodash/fp'; } from 'lodash/fp';
import { useHistory } from 'react-router-dom'; import { useHistory } from 'react-router-dom';
@@ -18,7 +17,7 @@ import ListingHeadingStepsRoute from '../../listings/heading_steps_route';
export function NewsletterTypeReEngagement(): JSX.Element { export function NewsletterTypeReEngagement(): JSX.Element {
let defaultAfterTime = ''; let defaultAfterTime = '';
if (!isEmpty(MailPoet.settings.deactivate_subscriber_after_inactive_days)) { if (MailPoet.settings.deactivate_subscriber_after_inactive_days) {
defaultAfterTime = ( defaultAfterTime = (
( (
Math.floor( Math.floor(
@@ -87,7 +86,7 @@ export function NewsletterTypeReEngagement(): JSX.Element {
isFullWidth isFullWidth
onClick={handleNext} onClick={handleNext}
type="button" type="button"
isDisabled={isEmpty(options.afterTimeNumber) || loading} isDisabled={(!options.afterTimeNumber) || loading}
withSpinner={loading} withSpinner={loading}
> >
{MailPoet.I18n.t('next')} {MailPoet.I18n.t('next')}

View File

@@ -1,6 +1,5 @@
import React from 'react'; import React from 'react';
import ReactStringReplace from 'react-string-replace'; import ReactStringReplace from 'react-string-replace';
import { isEmpty } from 'lodash/fp';
import MailPoet from 'mailpoet'; import MailPoet from 'mailpoet';
import Heading from 'common/typography/heading/heading'; import Heading from 'common/typography/heading/heading';
@@ -26,6 +25,7 @@ export function Scheduling({
}: Props): JSX.Element { }: Props): JSX.Element {
const daysInPeriod = afterTimeType === 'weeks' ? 7 : 30; const daysInPeriod = afterTimeType === 'weeks' ? 7 : 30;
const daysSelected = Number(afterTimeNumber) * daysInPeriod; const daysSelected = Number(afterTimeNumber) * daysInPeriod;
return ( return (
<> <>
<Heading level={4}>{MailPoet.I18n.t('selectEventToSendReEngagementEmail')}</Heading> <Heading level={4}>{MailPoet.I18n.t('selectEventToSendReEngagementEmail')}</Heading>
@@ -48,7 +48,7 @@ export function Scheduling({
</Select> </Select>
</Grid.CenteredRow> </Grid.CenteredRow>
{ {
((!isEmpty(inactiveSubscribersPeriod)) && (inactiveSubscribersPeriod <= daysSelected)) && ( ((!!inactiveSubscribersPeriod) && (inactiveSubscribersPeriod <= daysSelected)) && (
<p className="mailpoet-re-engagement-scheduling-note"> <p className="mailpoet-re-engagement-scheduling-note">
{ {
ReactStringReplace( ReactStringReplace(