1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-21 17:44:46 +07:00

added initial profile dialog

This commit is contained in:
Fedor Katurov 2019-11-11 16:01:21 +07:00
parent f6baedc4cd
commit 618c2e3275
28 changed files with 315 additions and 58 deletions
src/containers/profile/ProfileLayout

View file

@ -0,0 +1,58 @@
import React, { FC, useEffect, useState } from 'react';
import { useRouteMatch, withRouter, RouteComponentProps } from 'react-router';
import styles from './styles.scss';
import { NodeNoComments } from '~/components/node/NodeNoComments';
import { Grid } from '~/components/containers/Grid';
import { CommentForm } from '~/components/node/CommentForm';
import { ProfileInfo } from '../ProfileInfo';
import * as NODE_ACTIONS from '~/redux/node/actions';
import { connect } from 'react-redux';
import { IUser } from '~/redux/auth/types';
import { Group } from '~/components/containers/Group';
const mapStateToProps = () => ({});
const mapDispatchToProps = {
nodeSetCoverImage: NODE_ACTIONS.nodeSetCoverImage,
};
type IProps = RouteComponentProps & typeof mapDispatchToProps & {};
const ProfileLayoutUnconnected: FC<IProps> = ({ history, nodeSetCoverImage }) => {
const {
params: { username },
} = useRouteMatch<{ username: string }>();
const [user, setUser] = useState<IUser>(null);
useEffect(() => {
if (user) setUser(null);
}, [username]);
useEffect(() => {
if (user && user.id && user.cover) {
nodeSetCoverImage(user.cover);
return () => nodeSetCoverImage(null);
}
}, [user]);
return (
<Group className={styles.wrap} horizontal>
<div className={styles.column}>
<ProfileInfo user={user} />
</div>
<Grid className={styles.content}>
<div className={styles.comments}>
<CommentForm id={0} />
<NodeNoComments is_loading={false} />
</div>
</Grid>
</Group>
);
};
const ProfileLayout = connect(
mapStateToProps,
mapDispatchToProps
)(withRouter(ProfileLayoutUnconnected));
export { ProfileLayout };

View file

@ -0,0 +1,27 @@
.wrap {
display: flex;
align-items: flex-start !important;
justify-content: flex-start !important;
flex-direction: row;
flex: 1;
}
.content {
flex: 3;
// flex: 0 1 $limited_width;
// padding: $gap;
box-sizing: border-box;
}
.column {
flex: 1;
}
.info {
}
.comments {
background: $node_bg;
border-radius: $radius;
padding: $gap;
}