diff --git a/src/containers/main/MainRouter/index.tsx b/src/containers/main/MainRouter/index.tsx index c11ddb8c..f53e0334 100644 --- a/src/containers/main/MainRouter/index.tsx +++ b/src/containers/main/MainRouter/index.tsx @@ -4,11 +4,11 @@ import { FlowLayout } from '~/layouts/FlowLayout'; import { NodeLayout } from '~/layouts/NodeLayout'; import { BorisLayout } from '~/layouts/BorisLayout'; import { ErrorNotFound } from '~/containers/pages/ErrorNotFound'; -import { ProfilePage } from '~/containers/profile/ProfilePage'; import { Redirect, Route, Switch, useLocation } from 'react-router'; import { LabLayout } from '~/layouts/LabLayout'; import { useShallowSelect } from '~/utils/hooks/useShallowSelect'; import { selectAuthUser } from '~/redux/auth/selectors'; +import { ProfileLayout } from '~/layouts/ProfileLayout'; interface IProps {} @@ -21,7 +21,7 @@ const MainRouter: FC = () => { - + {is_user && } diff --git a/src/containers/profile/ProfilePage/index.tsx b/src/containers/profile/ProfilePage/index.tsx deleted file mode 100644 index b205f4f0..00000000 --- a/src/containers/profile/ProfilePage/index.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import React, { FC, useEffect } from 'react'; -import styles from './styles.module.scss'; -import { ProfilePageLeft } from '../ProfilePageLeft'; -import { Switch, Route, RouteComponentProps } from 'react-router'; -import { IState } from '~/redux/store'; -import { selectAuthProfile } from '~/redux/auth/selectors'; -import { connect } from 'react-redux'; -import * as AUTH_ACTIONS from '~/redux/auth/actions'; - -const mapStateToProps = (state: IState) => ({ - profile: selectAuthProfile(state), -}); - -const mapDispatchToProps = { - authLoadProfile: AUTH_ACTIONS.authLoadProfile, -}; - -type Props = ReturnType & - typeof mapDispatchToProps & - RouteComponentProps<{ username: string }> & {}; - -const ProfilePageUnconnected: FC = ({ - profile, - authLoadProfile, - match: { - params: { username }, - }, -}) => { - useEffect(() => { - authLoadProfile(username); - }, [username]); - - return ( -
-
- -
DEFAULT
} /> -
TAB
} /> -
-
- -
- -
-
- ); -}; - -const ProfilePage = connect( - mapStateToProps, - mapDispatchToProps -)(ProfilePageUnconnected); - -export { ProfilePage }; diff --git a/src/layouts/ProfileLayout/index.tsx b/src/layouts/ProfileLayout/index.tsx new file mode 100644 index 00000000..950f4ca0 --- /dev/null +++ b/src/layouts/ProfileLayout/index.tsx @@ -0,0 +1,33 @@ +import React, { FC, useEffect } from 'react'; +import styles from './styles.module.scss'; +import { Route, RouteComponentProps, Switch } from 'react-router'; +import { useDispatch } from 'react-redux'; +import { authLoadProfile } from '~/redux/auth/actions'; +import { useShallowSelect } from '~/utils/hooks/useShallowSelect'; +import { selectAuthProfile } from '~/redux/auth/selectors'; +import { ProfilePageLeft } from '~/containers/profile/ProfilePageLeft'; +import { Container } from '~/containers/main/Container'; + +type Props = RouteComponentProps<{ username: string }> & {}; + +const ProfileLayout: FC = ({ + match: { + params: { username }, + }, +}) => { + const dispatch = useDispatch(); + + useEffect(() => { + dispatch(authLoadProfile(username)); + }, [username]); + + const profile = useShallowSelect(selectAuthProfile); + + return ( + + + + ); +}; + +export { ProfileLayout }; diff --git a/src/containers/profile/ProfilePage/styles.module.scss b/src/layouts/ProfileLayout/styles.module.scss similarity index 84% rename from src/containers/profile/ProfilePage/styles.module.scss rename to src/layouts/ProfileLayout/styles.module.scss index 65016399..104bc693 100644 --- a/src/containers/profile/ProfilePage/styles.module.scss +++ b/src/layouts/ProfileLayout/styles.module.scss @@ -2,11 +2,9 @@ .wrap { flex: 1; - background: $content_bg; display: flex; align-items: stretch; justify-content: stretch; - box-shadow: $node_shadow; border-radius: $radius; }