Rename at index and modal-dialog-container

This commit is contained in:
TatianaLopaeva 2020-08-28 10:50:38 +03:00
parent 9bac1c0639
commit 6816ebc6cb
2 changed files with 12 additions and 21 deletions

View File

@ -13,9 +13,7 @@ import ContactContainer from "./sub-components/contact-container";
import ModalDialogContainer from "./sub-components/modal-dialog-container"; import ModalDialogContainer from "./sub-components/modal-dialog-container";
import { setLicense } from "../../../store/payments/actions"; import { setLicense } from "../../../store/payments/actions";
import { createI18N } from "../../../helpers/i18n"; import { createI18N } from "../../../helpers/i18n";
import moment from "moment";
import isEmpty from "lodash/isEmpty";
const i18n = createI18N({ const i18n = createI18N({
page: "PaymentsEnterprise", page: "PaymentsEnterprise",
localesPath: "pages/PaymentsEnterprise", localesPath: "pages/PaymentsEnterprise",
@ -43,10 +41,9 @@ class Body extends React.PureComponent {
super(props); super(props);
const { t } = this.props; const { t } = this.props;
this.state = { this.state = {
errorMessage: null, // errorMessage: null,
license: false, // isErrorLicense: false,
hasErrorLicense: false, isVisible: false,
visibleModalDialog: false,
}; };
document.title = `${t("Payments")} ${t("OrganizationName")}`; document.title = `${t("Payments")} ${t("OrganizationName")}`;
@ -70,9 +67,9 @@ class Body extends React.PureComponent {
setLicense(null, fd).catch((e) => setLicense(null, fd).catch((e) =>
this.setState({ this.setState({
errorMessage: e, // errorMessage: e,
hasErrorLicense: true, // isErrorLicense: true,
visibleModalDialog: true, isVisible: true,
}) })
); );
}; };
@ -81,8 +78,8 @@ class Body extends React.PureComponent {
}; };
onCloseModalDialog = () => { onCloseModalDialog = () => {
this.setState({ this.setState({
visibleModalDialog: false, isVisible: false,
errorMessage: null, // errorMessage: null,
}); });
}; };
render() { render() {
@ -95,7 +92,7 @@ class Body extends React.PureComponent {
t, t,
createPortals, createPortals,
} = this.props; } = this.props;
const { hasErrorLicense, errorMessage, visibleModalDialog } = this.state; const { isVisible } = this.state;
return !isLoaded ? ( return !isLoaded ? (
<Loader className="pageLoader" type="rombs" size="40px" /> <Loader className="pageLoader" type="rombs" size="40px" />
) : ( ) : (
@ -108,14 +105,12 @@ class Body extends React.PureComponent {
<AdvantagesContainer t={t} /> <AdvantagesContainer t={t} />
<ModalDialogContainer <ModalDialogContainer
t={t} t={t}
visibleModalDialog={visibleModalDialog} isVisible={isVisible}
errorMessage={errorMessage}
onCloseModalDialog={this.onCloseModalDialog} onCloseModalDialog={this.onCloseModalDialog}
/> />
<ButtonContainer <ButtonContainer
t={t} t={t}
buyUrl={buyUrl} buyUrl={buyUrl}
hasErrorLicense={hasErrorLicense}
onButtonClickBuy={this.onButtonClickBuy} onButtonClickBuy={this.onButtonClickBuy}
onButtonClickUpload={this.onButtonClickUpload} onButtonClickUpload={this.onButtonClickUpload}
/> />

View File

@ -27,17 +27,13 @@ const StyledHeader = styled.div`
margin-bottom: 17px; margin-bottom: 17px;
} }
`; `;
const ModalDialogContainer = ({ const ModalDialogContainer = ({ t, isVisible, onCloseModalDialog }) => {
t,
visibleModalDialog,
onCloseModalDialog,
}) => {
const header = <StyledHeader>{t("LoadingError")}</StyledHeader>; const header = <StyledHeader>{t("LoadingError")}</StyledHeader>;
const body = <StyledBody>{t("LicenseError")}</StyledBody>; const body = <StyledBody>{t("LicenseError")}</StyledBody>;
return ( return (
<ModalDialog <ModalDialog
bodyPadding="0px" bodyPadding="0px"
visible={visibleModalDialog} visible={isVisible}
displayType="auto" displayType="auto"
zIndex={310} zIndex={310}
headerContent={header} headerContent={header}