Use get settings selector in the form placement
[MAILPOET-2740]
This commit is contained in:
@@ -7,15 +7,13 @@ import Toggle from '../../../../common/toggle';
|
|||||||
import Icon from './below_pages_icon';
|
import Icon from './below_pages_icon';
|
||||||
|
|
||||||
const BelowPages = () => {
|
const BelowPages = () => {
|
||||||
const placeFormBellowAllPages = useSelect(
|
const formSettings = useSelect(
|
||||||
(select) => select('mailpoet-form-editor').placeFormBellowAllPages(),
|
(select) => select('mailpoet-form-editor').getFormSettings(),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
const placeFormBellowAllPages = formSettings.placeFormBellowAllPages || false;
|
||||||
|
const placeFormBellowAllPosts = formSettings.placeFormBellowAllPosts || false;
|
||||||
|
|
||||||
const placeFormBellowAllPosts = useSelect(
|
|
||||||
(select) => select('mailpoet-form-editor').placeFormBellowAllPosts(),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
const { setPlaceFormBellowAllPages, setPlaceFormBellowAllPosts } = useDispatch('mailpoet-form-editor');
|
const { setPlaceFormBellowAllPages, setPlaceFormBellowAllPosts } = useDispatch('mailpoet-form-editor');
|
||||||
|
|
||||||
const [
|
const [
|
||||||
|
@@ -10,24 +10,17 @@ import Icon from './fixed_bar_icon';
|
|||||||
const delayValues = [0, 15, 30, 60, 120, 180, 240];
|
const delayValues = [0, 15, 30, 60, 120, 180, 240];
|
||||||
|
|
||||||
const FixedBar = () => {
|
const FixedBar = () => {
|
||||||
const fixedBarFormDelay = useSelect(
|
const formSettings = useSelect(
|
||||||
(select) => select('mailpoet-form-editor').getFixedBarFormDelay(),
|
(select) => select('mailpoet-form-editor').getFormSettings(),
|
||||||
[]
|
|
||||||
);
|
|
||||||
const fixedBarFormPosition = useSelect(
|
|
||||||
(select) => select('mailpoet-form-editor').getFixedBarFormPosition(),
|
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
const fixedBarFormDelay = formSettings.fixedBarFormDelay === undefined
|
||||||
|
? 15
|
||||||
|
: formSettings.fixedBarFormDelay;
|
||||||
|
const fixedBarFormPosition = formSettings.fixedBarFormPosition === undefined ? 'top' : formSettings.fixedBarFormPosition;
|
||||||
|
const placeFixedBarFormOnAllPages = formSettings.placeFixedBarFormOnAllPages || false;
|
||||||
|
const placeFixedBarFormOnAllPosts = formSettings.placeFixedBarFormOnAllPosts || false;
|
||||||
|
|
||||||
const placeFixedBarFormOnAllPages = useSelect(
|
|
||||||
(select) => select('mailpoet-form-editor').placeFixedBarFormOnAllPages(),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const placeFixedBarFormOnAllPosts = useSelect(
|
|
||||||
(select) => select('mailpoet-form-editor').placeFixedBarFormOnAllPosts(),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
const {
|
const {
|
||||||
setPlaceFixedBarFormOnAllPages,
|
setPlaceFixedBarFormOnAllPages,
|
||||||
setPlaceFixedBarFormOnAllPosts,
|
setPlaceFixedBarFormOnAllPosts,
|
||||||
@@ -46,11 +39,11 @@ const FixedBar = () => {
|
|||||||
const [
|
const [
|
||||||
localDelay,
|
localDelay,
|
||||||
setLocalDelay,
|
setLocalDelay,
|
||||||
] = useState(fixedBarFormDelay === undefined ? 15 : fixedBarFormDelay);
|
] = useState(fixedBarFormDelay);
|
||||||
const [
|
const [
|
||||||
localPosition,
|
localPosition,
|
||||||
setLocalPosition,
|
setLocalPosition,
|
||||||
] = useState(fixedBarFormPosition === undefined ? 'top' : fixedBarFormPosition);
|
] = useState(fixedBarFormPosition);
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
setPlaceFixedBarFormOnAllPages(localPlaceFixedBarFormOnAllPages);
|
setPlaceFixedBarFormOnAllPages(localPlaceFixedBarFormOnAllPages);
|
||||||
@@ -69,7 +62,7 @@ const FixedBar = () => {
|
|||||||
>
|
>
|
||||||
<div className="mailpoet-toggle-list">
|
<div className="mailpoet-toggle-list">
|
||||||
<div className="mailpoet-toggle-list-description">
|
<div className="mailpoet-toggle-list-description">
|
||||||
{MailPoet.I18n.t('placeFixedBarFormOnPages')}
|
{MailPoet.I18n.t('placeFormBellowAllPages')}
|
||||||
</div>
|
</div>
|
||||||
<div className="mailpoet-toggle-list-toggle">
|
<div className="mailpoet-toggle-list-toggle">
|
||||||
<Toggle
|
<Toggle
|
||||||
|
@@ -10,20 +10,16 @@ import Icon from './popup_icon';
|
|||||||
const delayValues = [0, 15, 30, 60, 120, 180, 240];
|
const delayValues = [0, 15, 30, 60, 120, 180, 240];
|
||||||
|
|
||||||
const Popup = () => {
|
const Popup = () => {
|
||||||
const popupFormDelay = useSelect(
|
const formSettings = useSelect(
|
||||||
(select) => select('mailpoet-form-editor').getPopupFormDelay(),
|
(select) => select('mailpoet-form-editor').getFormSettings(),
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
|
const popupFormDelay = formSettings.popupFormDelay === undefined
|
||||||
|
? 15
|
||||||
|
: formSettings.fixedBarFormDelay;
|
||||||
|
const placePopupFormOnAllPages = formSettings.placePopupFormOnAllPages || false;
|
||||||
|
const placePopupFormOnAllPosts = formSettings.placePopupFormOnAllPosts || false;
|
||||||
|
|
||||||
const placePopupFormOnAllPages = useSelect(
|
|
||||||
(select) => select('mailpoet-form-editor').placePopupFormOnAllPages(),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
|
|
||||||
const placePopupFormOnAllPosts = useSelect(
|
|
||||||
(select) => select('mailpoet-form-editor').placePopupFormOnAllPosts(),
|
|
||||||
[]
|
|
||||||
);
|
|
||||||
const {
|
const {
|
||||||
setPlacePopupFormOnAllPages,
|
setPlacePopupFormOnAllPages,
|
||||||
setPlacePopupFormOnAllPosts,
|
setPlacePopupFormOnAllPosts,
|
||||||
@@ -41,7 +37,7 @@ const Popup = () => {
|
|||||||
const [
|
const [
|
||||||
localDelay,
|
localDelay,
|
||||||
setLocalDelay,
|
setLocalDelay,
|
||||||
] = useState(popupFormDelay === undefined ? 15 : popupFormDelay);
|
] = useState(popupFormDelay);
|
||||||
|
|
||||||
const save = () => {
|
const save = () => {
|
||||||
setPlacePopupFormOnAllPages(localPlacePopupFormOnAllPages);
|
setPlacePopupFormOnAllPages(localPlacePopupFormOnAllPages);
|
||||||
|
@@ -34,33 +34,6 @@ export default {
|
|||||||
getFormSettings(state) {
|
getFormSettings(state) {
|
||||||
return state.formData.settings;
|
return state.formData.settings;
|
||||||
},
|
},
|
||||||
placeFormBellowAllPages(state) {
|
|
||||||
return state.formData.settings.placeFormBellowAllPages || false;
|
|
||||||
},
|
|
||||||
placeFormBellowAllPosts(state) {
|
|
||||||
return state.formData.settings.placeFormBellowAllPosts || false;
|
|
||||||
},
|
|
||||||
placePopupFormOnAllPages(state) {
|
|
||||||
return state.formData.settings.placePopupFormOnAllPages || false;
|
|
||||||
},
|
|
||||||
placePopupFormOnAllPosts(state) {
|
|
||||||
return state.formData.settings.placePopupFormOnAllPosts || false;
|
|
||||||
},
|
|
||||||
getPopupFormDelay(state) {
|
|
||||||
return state.formData.settings.popupFormDelay;
|
|
||||||
},
|
|
||||||
placeFixedBarFormOnAllPages(state) {
|
|
||||||
return state.formData.settings.placeFixedBarFormOnAllPages || false;
|
|
||||||
},
|
|
||||||
placeFixedBarFormOnAllPosts(state) {
|
|
||||||
return state.formData.settings.placeFixedBarFormOnAllPosts || false;
|
|
||||||
},
|
|
||||||
getFixedBarFormDelay(state) {
|
|
||||||
return state.formData.settings.fixedBarFormDelay;
|
|
||||||
},
|
|
||||||
getFixedBarFormPosition(state) {
|
|
||||||
return state.formData.settings.fixedBarFormPosition;
|
|
||||||
},
|
|
||||||
getAllAvailableSegments(state) {
|
getAllAvailableSegments(state) {
|
||||||
return state.segments;
|
return state.segments;
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user