refactoring layout

This commit is contained in:
Artem Tarasov 2020-08-01 19:10:21 +03:00
parent d13383f507
commit f988fa5573
2 changed files with 25 additions and 32 deletions

View File

@ -127,9 +127,9 @@ class Body extends Component {
}), }),
getPortalCultures() getPortalCultures()
.then(() => { .then(() => {
const { cultures, portalCulture } = this.props; const { cultures, language } = this.props;
const languages = this.mapCulturesToArray(cultures, t); const languages = this.mapCulturesToArray(cultures, t);
const select = languages.filter(lang => lang.key === portalCulture); const select = languages.filter(lang => lang.key === language);
this.setState({ this.setState({
languages: languages, languages: languages,
selectLanguage: { selectLanguage: {
@ -212,7 +212,7 @@ class Body extends Component {
//console.log(emailTrim, password, selectLanguage.key, selectTimezone.key, licenseFile, analytics, wizardToken); //console.log(emailTrim, password, selectLanguage.key, selectTimezone.key, licenseFile, analytics, wizardToken);
setPortalOwner( password, selectLanguage.key, wizardToken, analytics) setPortalOwner(emailTrim, password, selectLanguage.key, wizardToken, analytics)
.then(() => history.push('/')) .then(() => history.push('/'))
.catch( e => this.setState({ .catch( e => this.setState({
errorLoading: true, errorLoading: true,
@ -280,7 +280,6 @@ class Body extends Component {
isWizardLoaded, isWizardLoaded,
machineName, machineName,
settingsPassword, settingsPassword,
portalTimezone,
language, language,
} = this.props; } = this.props;
@ -370,11 +369,9 @@ Body.propTypes = {
i18n: PropTypes.object, i18n: PropTypes.object,
isWizardLoaded: PropTypes.bool.isRequired, isWizardLoaded: PropTypes.bool.isRequired,
machineName: PropTypes.string.isRequired, machineName: PropTypes.string.isRequired,
//isComplete: PropTypes.bool.isRequired,
wizardToken: PropTypes.string, wizardToken: PropTypes.string,
settingsPassword: PropTypes.object, settingsPassword: PropTypes.object,
cultures: PropTypes.array.isRequired, cultures: PropTypes.array.isRequired,
portalCulture: PropTypes.string.isRequired,
timezones: PropTypes.array.isRequired, timezones: PropTypes.array.isRequired,
portalTimezone: PropTypes.string.isRequired portalTimezone: PropTypes.string.isRequired
} }
@ -403,7 +400,6 @@ function mapStateToProps(state) {
return { return {
isWizardLoaded: state.wizard.isWizardLoaded, isWizardLoaded: state.wizard.isWizardLoaded,
machineName: state.wizard.machineName, machineName: state.wizard.machineName,
isComplete: state.wizard.isComplete,
language: state.auth.settings.culture, language: state.auth.settings.culture,
@ -415,8 +411,7 @@ function mapStateToProps(state) {
cultures: state.auth.settings.cultures, cultures: state.auth.settings.cultures,
timezones: state.auth.settings.timezones, timezones: state.auth.settings.timezones,
portalTimezone: state.auth.settings.timezone, portalTimezone: state.auth.settings.timezone
portalCulture: state.auth.settings.culture
}; };
} }

View File

@ -12,7 +12,20 @@ import {
const { tablet } = utils.device; const { tablet } = utils.device;
const Modal = ({ const BtnContainer = styled(Box)`
width: 100px;
@media ${tablet} {
width: 293px;
}
`;
const BodyContainer = styled(Box)`
font: 13px 'Open Sans', normal;
line-height: 20px;
`;
const ModalContainer = ({
t, t,
errorLoading, errorLoading,
visibleModal, visibleModal,
@ -30,10 +43,9 @@ const Modal = ({
if(errorLoading) { if(errorLoading) {
header = t('errorLicenseTitle'); header = t('errorLicenseTitle');
content = <span content = <BodyContainer>
className="modal-error-content">
{errorMessage ? errorMessage: t('errorLicenseBody')} {errorMessage ? errorMessage: t('errorLicenseBody')}
</span>; </BodyContainer>;
} else if( visibleModal ) { } else if( visibleModal ) {
header = t('changeEmailTitle'); header = t('changeEmailTitle');
@ -50,7 +62,7 @@ const Modal = ({
onValidateInput={onEmailHandler} onValidateInput={onEmailHandler}
/>; />;
footer = <Box className="modal-button-save"> footer = <BtnContainer>
<Button <Button
key="saveBtn" key="saveBtn"
label={t('changeEmailBtn')} label={t('changeEmailBtn')}
@ -59,12 +71,12 @@ const Modal = ({
size="big" size="big"
onClick={onSaveEmailHandler} onClick={onSaveEmailHandler}
/> />
</Box>; </BtnContainer>;
} }
return <ModalDialog return (
<ModalDialog
visible={visible} visible={visible}
scale={false}
displayType="auto" displayType="auto"
zIndex={310} zIndex={310}
headerContent={header} headerContent={header}
@ -72,23 +84,9 @@ const Modal = ({
footerContent={footer} footerContent={footer}
onClose={onCloseModal} onClose={onCloseModal}
/> />
);
} }
const ModalContainer = styled(Modal)`
.modal-button-save {
width: 100px;
@media ${tablet} {
}
}
.modal-error-content {
font-size: 13px;
line-height: 20px;
}
`;
ModalContainer.propTypes = { ModalContainer.propTypes = {
t: PropTypes.func.isRequired, t: PropTypes.func.isRequired,
errorLoading: PropTypes.bool.isRequired, errorLoading: PropTypes.bool.isRequired,