Move utility functions to common functions
[MAILPOET-2677]
This commit is contained in:
committed by
Veljko V
parent
50ca3b7310
commit
dc0fc44194
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { onChange, t } from 'settings/utils';
|
||||
import { useSelector } from 'settings/store/hooks';
|
||||
import { onChange, t } from 'common/functions';
|
||||
|
||||
type Props = {
|
||||
id?: string
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
import { t } from 'common/functions';
|
||||
import { useSelector } from 'settings/store/hooks';
|
||||
import { t } from 'settings/utils';
|
||||
import TabLink from './tab_link';
|
||||
|
||||
export default () => {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { t, onChange, isEmail } from 'settings/utils';
|
||||
import { Label, Inputs } from 'settings/components';
|
||||
import { isEmail, t, onChange } from 'common/functions';
|
||||
import { useSetting, useSelector, useAction } from 'settings/store/hooks';
|
||||
import SenderEmailAddressWarning from 'common/sender_email_address_warning.jsx';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { t } from 'settings/utils';
|
||||
import { t } from 'common/functions';
|
||||
import { Label, Inputs } from 'settings/components';
|
||||
|
||||
export default function GdprCompliant() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import React from 'react';
|
||||
import { SaveButton } from 'settings/components';
|
||||
import { t } from 'settings/utils';
|
||||
import { t } from 'common/functions';
|
||||
import DefaultSender from './default_sender';
|
||||
import SubscribeOn from './subscribe_on';
|
||||
import ManageSubscription from './manage_subscription';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { t } from 'settings/utils';
|
||||
import { t } from 'common/functions';
|
||||
import { useSetting } from 'settings/store/hooks';
|
||||
import {
|
||||
Label, Inputs, SegmentsSelect, PagesSelect,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { t, onChange, isEmail } from 'settings/utils';
|
||||
import { t, onChange, isEmail } from 'common/functions';
|
||||
import { useSetting, useAction } from 'settings/store/hooks';
|
||||
import { Label, Inputs } from 'settings/components';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { t } from 'settings/utils';
|
||||
import { t } from 'common/functions';
|
||||
import { Label, Inputs, SegmentsSelect } from 'settings/components';
|
||||
|
||||
type Props = {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
t, onToggle, onChange, isEmail,
|
||||
} from 'settings/utils';
|
||||
} from 'common/functions';
|
||||
import { useSetting, useAction } from 'settings/store/hooks';
|
||||
import { Label, Inputs } from 'settings/components';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { t, onChange, onToggle } from 'settings/utils';
|
||||
import { t, onChange, onToggle } from 'common/functions';
|
||||
import { useSetting } from 'settings/store/hooks';
|
||||
import { Label, Inputs, SegmentsSelect } from 'settings/components';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { t } from 'settings/utils';
|
||||
import { t } from 'common/functions';
|
||||
import { useSetting } from 'settings/store/hooks';
|
||||
import { Label, Inputs, PagesSelect } from 'settings/components';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import { Switch, Route, Redirect } from 'react-router-dom';
|
||||
import Notices from 'notices/notices.jsx';
|
||||
import MailPoet from 'mailpoet';
|
||||
import Loading from 'common/loading';
|
||||
import { t } from 'common/functions';
|
||||
import {
|
||||
Advanced,
|
||||
Basics,
|
||||
@ -12,7 +12,6 @@ import {
|
||||
WooCommerce,
|
||||
} from './pages';
|
||||
import Tabs from './components/tabs';
|
||||
import { t } from './utils';
|
||||
import { useSelector } from './store/hooks';
|
||||
|
||||
export default function Settings() {
|
||||
|
@ -1,13 +0,0 @@
|
||||
import MailPoet from 'mailpoet';
|
||||
import { ChangeEvent } from 'react';
|
||||
|
||||
type Setter = (value: string) => any
|
||||
type Event = ChangeEvent<any>
|
||||
|
||||
export const onChange = (setter: Setter) => (e: Event) => setter(e.target.value);
|
||||
|
||||
export const onToggle = (setter: Setter) => (e: Event) => setter(e.target.checked ? '1' : '0');
|
||||
|
||||
export const t = ([word]: TemplateStringsArray) => MailPoet.I18n.t(word);
|
||||
|
||||
export const isEmail = (value: string): boolean => (window as any).mailpoet_email_regex.test(value);
|
Reference in New Issue
Block a user