This commit is contained in:
Daniil Senkiv 2019-12-20 10:50:45 +03:00
commit c16cd68f8f
9 changed files with 52 additions and 31 deletions

View File

@ -47,11 +47,13 @@ const InfoItemValue = styled.div`
padding-left: 0px;
}
}
.help-icon {
margin-top: -2px;
}
`;
const TooltipIcon = styled.span`
const TooltipIcon = styled.div`
display: inline-flex;
padding-top: 6px;
`;
const IconButtonWrapper = styled.div`
@ -353,6 +355,7 @@ class ProfileInfo extends React.PureComponent {
offsetRight={0}
tooltipContent={tooltipLanguage}
helpButtonHeaderContent={t('Language')}
className="help-icon"
/>
</TooltipIcon>

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-common",
"version": "1.0.17",
"version": "1.0.18",
"description": "Ascensio System SIA common components and solutions library",
"license": "AGPL-3.0",
"files": [

View File

@ -14,7 +14,7 @@ import {
} from "asc-web-components";
import { connect } from "react-redux";
import styled from "styled-components";
import { withTranslation, I18nextProvider } from "react-i18next";
import { withTranslation } from "react-i18next";
import i18n from "./i18n";
import SubModalDialog from "./sub-components/modal-dialog";
import { login, setIsLoaded } from "../../store/auth/actions";
@ -25,6 +25,7 @@ const FormContainer = styled.form`
max-width: 432px;
.login-header {
min-height: 79px;
margin-bottom: 24px;
.login-logo {
@ -181,9 +182,12 @@ class Form extends Component {
};
componentDidMount() {
const { language, match } = this.props;
const { language, match, i18n } = this.props;
const { error, confirmedEmail } = match.params;
i18n.changeLanguage(language);
if(i18n.lng != language)
i18n.changeLanguage(language);
error && this.setState({ errorText: error });
confirmedEmail && this.setState({ identifier: confirmedEmail });
window.addEventListener("keyup", this.onKeyPress);
@ -323,19 +327,6 @@ class Form extends Component {
}
}
const FormWrapper = withTranslation()(Form);
const LoginForm = props => {
const { language } = props;
i18n.changeLanguage(language);
return (
<I18nextProvider i18n={i18n}>
<PageLayout sectionBodyContent={<FormWrapper {...props} />} />
</I18nextProvider>
);
};
Form.propTypes = {
login: PropTypes.func.isRequired,
match: PropTypes.object.isRequired,
@ -343,6 +334,7 @@ Form.propTypes = {
setIsLoaded: PropTypes.func.isRequired,
greetingTitle: PropTypes.string.isRequired,
t: PropTypes.func.isRequired,
i18n: PropTypes.object.isRequired,
language: PropTypes.string.isRequired
};
@ -352,12 +344,28 @@ Form.defaultProps = {
email: ""
};
const FormWrapper = withTranslation()(Form);
const LoginForm = props => {
const { language, isLoaded } = props;
i18n.changeLanguage(language);
return (
<>
{isLoaded && <PageLayout sectionBodyContent={<FormWrapper i18n={i18n} {...props} />} />}
</>
);
};
LoginForm.propTypes = {
language: PropTypes.string.isRequired
language: PropTypes.string.isRequired,
isLoaded: PropTypes.bool
};
function mapStateToProps(state) {
return {
isLoaded: state.auth.isLoaded,
language: state.auth.user.cultureName || state.auth.settings.culture,
greetingTitle: state.auth.settings.greetingSettings
};

View File

@ -132,13 +132,17 @@ export function getUserInfo(dispatch) {
export function login(user, pass) {
return dispatch => {
return api.user.login(user, pass).then(() => getUserInfo(dispatch));
return api.user.login(user, pass)
.then(() => dispatch(setIsLoaded(false)))
.then(() => getUserInfo(dispatch));
};
}
export function logout() {
return dispatch => {
return api.user.logout().then(() => dispatch(setLogout()));
return api.user.logout()
.then(() => dispatch(setLogout()))
.then(() => dispatch(setIsLoaded(true)));
};
}

View File

@ -1,6 +1,6 @@
{
"name": "asc-web-components",
"version": "1.0.249",
"version": "1.0.252",
"description": "Ascensio System SIA component library",
"license": "AGPL-3.0",
"main": "dist/asc-web-components.js",

View File

@ -28,8 +28,7 @@ function getHorizontalCss(labelWidth) {
}
.icon-button {
position: relative;
line-height: 24px;
margin: 2px 0 0 4px;
margin-top: 1px;
}
`;
}
@ -56,7 +55,7 @@ function getVerticalCss() {
.icon-button {
position: relative;
line-height: unset;
margin: -4px 0 0 4px;
margin-top: -12px;
}
`;
}

View File

@ -100,7 +100,7 @@ class FilterItem extends React.Component {
scaled={false}
noBorder={true}
opened={this.props.opened}
directionX='right'
directionX='left'
></StyledComboBox>
: <StyledFilterName>{this.props.label}</StyledFilterName>
}

View File

@ -11,6 +11,12 @@ import Heading from "../heading";
import throttle from "lodash/throttle";
import styled from "styled-components";
const HelpContainer = styled.div`
.help-icon {
padding: 8px;
}
`;
const Content = styled.div`
position: relative;
width: 100%;
@ -136,10 +142,10 @@ class HelpButton extends React.Component {
} = this.props;
return (
<div ref={this.ref} style={style}>
<HelpContainer ref={this.ref} style={style}>
<IconButton
id={this.id}
className={className}
className={`${className} help-icon`}
isClickable={true}
iconName={iconName}
size={13}
@ -196,7 +202,7 @@ class HelpButton extends React.Component {
</Aside>
</>
)}
</div>
</HelpContainer>
);
}
}

View File

@ -9,7 +9,8 @@ const StyledOuter = styled.div`
props.size ? Math.abs(parseInt(props.size)) + "px" : "20px"};
cursor: ${props =>
props.isDisabled || !props.isClickable ? "default" : "pointer"};
line-height: 0;
line-height: 0;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
`;
class IconButton extends React.PureComponent {
constructor(props) {