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

View File

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