// @flow
import React, { Component } from 'react';
import { Route, Switch, Redirect } from 'react-router-dom';
import AppInfo from 'components/auth/appInfo/AppInfo';
import PanelTransition from 'components/auth/PanelTransition';
import Register from 'components/auth/register/Register';
import Login from 'components/auth/login/Login';
import Permissions from 'components/auth/permissions/Permissions';
import ChooseAccount from 'components/auth/chooseAccount/ChooseAccount';
import Activation from 'components/auth/activation/Activation';
import ResendActivation from 'components/auth/resendActivation/ResendActivation';
import Password from 'components/auth/password/Password';
import AcceptRules from 'components/auth/acceptRules/AcceptRules';
import ForgotPassword from 'components/auth/forgotPassword/ForgotPassword';
import RecoverPassword from 'components/auth/recoverPassword/RecoverPassword';
import Mfa from 'components/auth/mfa/Mfa';
import Finish from 'components/auth/finish/Finish';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import styles from './auth.scss';
// TODO: after migrating to new react router (posibly) this view started remounting
// after route change e.g. /login -> /password which results in state dropping
// we should find why this view is remounting or move isSidebarHidden into store
// so that it persist disregarding remounts
let isSidebarHiddenCache = false;
type OwnProps = {|
|};
type Props = {
...OwnProps,
client: {
id: string,
name: string,
description: string
}
};
class AuthPage extends Component {
state = {
isSidebarHidden: isSidebarHiddenCache
};
render() {
const {isSidebarHidden} = this.state;
const {client} = this.props;
return (
);
}
onGoToAuth = () => {
isSidebarHiddenCache = true;
this.setState({
isSidebarHidden: true
});
};
}
function renderPanelTransition(factory) {
const {Title, Body, Footer, Links} = factory();
return (props) => (
}
Body={}
Footer={}
Links={}
/>
);
}
export default withRouter(connect((state) => ({
client: state.auth.client
}))(AuthPage));