mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
removed node reducer
This commit is contained in:
parent
168ba8cc04
commit
8d2b56cafc
14 changed files with 62 additions and 208 deletions
|
@ -4,7 +4,7 @@ import { history } from '~/redux/store';
|
|||
import { MainLayout } from '~/containers/main/MainLayout';
|
||||
import { Sprites } from '~/sprites/Sprites';
|
||||
import { Modal } from '~/containers/dialogs/Modal';
|
||||
import { PageCover } from '~/components/containers/PageCover';
|
||||
import { PageCoverProvider } from '~/components/containers/PageCoverProvider';
|
||||
import { BottomContainer } from '~/containers/main/BottomContainer';
|
||||
import { MainRouter } from '~/containers/main/MainRouter';
|
||||
import { DragDetectorProvider } from '~/hooks/dom/useDragDetector';
|
||||
|
@ -20,15 +20,15 @@ const App: VFC = () => {
|
|||
<SWRConfigProvider>
|
||||
<UserContextProvider user={user}>
|
||||
<DragDetectorProvider>
|
||||
<PageCover />
|
||||
<PageCoverProvider>
|
||||
<MainLayout>
|
||||
<Modal />
|
||||
<Sprites />
|
||||
|
||||
<MainLayout>
|
||||
<Modal />
|
||||
<Sprites />
|
||||
|
||||
<MainRouter />
|
||||
</MainLayout>
|
||||
<BottomContainer />
|
||||
<MainRouter />
|
||||
</MainLayout>
|
||||
<BottomContainer />
|
||||
</PageCoverProvider>
|
||||
</DragDetectorProvider>
|
||||
</UserContextProvider>
|
||||
</SWRConfigProvider>
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
import React, { FC, useEffect, useState } from 'react';
|
||||
import { RouteComponentProps, useRouteMatch, withRouter } from 'react-router';
|
||||
import styles from './styles.module.scss';
|
||||
import { NodeNoComments } from '~/components/node/NodeNoComments';
|
||||
import { Grid } from '~/components/containers/Grid';
|
||||
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';
|
||||
import { CommentForm } from '~/components/comment/CommentForm';
|
||||
|
||||
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 | undefined>(undefined);
|
||||
|
||||
useEffect(() => {
|
||||
if (user) setUser(undefined);
|
||||
}, [user, username]);
|
||||
|
||||
useEffect(() => {
|
||||
if (user && user.id && user.cover) {
|
||||
nodeSetCoverImage(user.cover);
|
||||
return () => {
|
||||
nodeSetCoverImage(undefined);
|
||||
};
|
||||
}
|
||||
}, [nodeSetCoverImage, user]);
|
||||
|
||||
return (
|
||||
<Group className={styles.wrap} horizontal>
|
||||
<div className={styles.column} />
|
||||
|
||||
<Grid className={styles.content}>
|
||||
<div className={styles.comments}>
|
||||
<CommentForm nodeId={0} saveComment={async () => console.log()} />
|
||||
<NodeNoComments is_loading={false} />
|
||||
</div>
|
||||
</Grid>
|
||||
</Group>
|
||||
);
|
||||
};
|
||||
|
||||
const ProfileLayout = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps
|
||||
)(withRouter(ProfileLayoutUnconnected));
|
||||
|
||||
export { ProfileLayout };
|
|
@ -1,29 +0,0 @@
|
|||
@import "src/styles/variables";
|
||||
|
||||
.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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue