mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
added illustrations
This commit is contained in:
parent
23f935aeeb
commit
f355bec236
6 changed files with 1435 additions and 6 deletions
|
@ -4,6 +4,12 @@ import * as NODE_ACTIONS from '~/redux/node/actions';
|
||||||
import { selectNode } from '~/redux/node/selectors';
|
import { selectNode } from '~/redux/node/selectors';
|
||||||
import { selectUser } from '~/redux/auth/selectors';
|
import { selectUser } from '~/redux/auth/selectors';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { NodeComments } from '~/components/node/NodeComments';
|
||||||
|
import styles from './styles.scss';
|
||||||
|
import { CommentForm } from '~/components/node/CommentForm';
|
||||||
|
import { Filler } from '~/components/containers/Filler';
|
||||||
|
import { Group } from '~/components/containers/Group';
|
||||||
|
import { GodRays } from '~/components/main/GodRays';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
node: selectNode(state),
|
node: selectNode(state),
|
||||||
|
@ -27,14 +33,26 @@ const id = 696;
|
||||||
|
|
||||||
const BorisLayoutUnconnected: FC<IProps> = ({
|
const BorisLayoutUnconnected: FC<IProps> = ({
|
||||||
node: { is_loading, is_loading_comments, comments = [], current: node, related },
|
node: { is_loading, is_loading_comments, comments = [], current: node, related },
|
||||||
|
user: { is_user },
|
||||||
nodeLoadNode,
|
nodeLoadNode,
|
||||||
}) => {
|
}) => {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (is_loading) return;
|
if (is_loading) return;
|
||||||
nodeLoadNode(id);
|
nodeLoadNode(id, 'DESC');
|
||||||
}, [nodeLoadNode, id]);
|
}, [nodeLoadNode, id]);
|
||||||
|
|
||||||
return <div>{comments.length}</div>;
|
return (
|
||||||
|
<div className={styles.wrap}>
|
||||||
|
<div className={styles.cover} />
|
||||||
|
<div className={styles.column} />
|
||||||
|
|
||||||
|
<Group className={styles.container}>
|
||||||
|
{is_user && <CommentForm id={0} />}
|
||||||
|
|
||||||
|
<NodeComments comments={comments} />
|
||||||
|
</Group>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const BorisLayout = connect(
|
const BorisLayout = connect(
|
||||||
|
|
47
src/containers/node/BorisLayout/styles.scss
Normal file
47
src/containers/node/BorisLayout/styles.scss
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
.wrap {
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
margin-top: 33vh;
|
||||||
|
flex: 3;
|
||||||
|
z-index: 2;
|
||||||
|
padding: $gap;
|
||||||
|
background: $content_bg;
|
||||||
|
border-radius: $radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
.column {
|
||||||
|
flex: 1;
|
||||||
|
background: $content_bg;
|
||||||
|
height: 400px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
margin-top: 33vh;
|
||||||
|
margin-right: $gap;
|
||||||
|
border-radius: $radius;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
padding: $gap;
|
||||||
|
text-align: center;
|
||||||
|
font: $font_24_bold;
|
||||||
|
text-transform: uppercase;
|
||||||
|
position: relative;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
overflow: hidden;
|
||||||
|
// background: linear-gradient($red, transparentize($red, 1));
|
||||||
|
background: 50% 0% no-repeat/cover url('~/sprites/illustrate.svg');
|
||||||
|
}
|
|
@ -18,8 +18,9 @@ export const nodeGotoNode = (id: number, node_type: INode['type']) => ({
|
||||||
type: NODE_ACTIONS.GOTO_NODE,
|
type: NODE_ACTIONS.GOTO_NODE,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const nodeLoadNode = (id: number) => ({
|
export const nodeLoadNode = (id: number, order?: 'ASC' | 'DESC') => ({
|
||||||
id,
|
id,
|
||||||
|
order,
|
||||||
type: NODE_ACTIONS.LOAD_NODE,
|
type: NODE_ACTIONS.LOAD_NODE,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -58,12 +58,14 @@ export const postNodeComment = ({
|
||||||
export const getNodeComments = ({
|
export const getNodeComments = ({
|
||||||
id,
|
id,
|
||||||
access,
|
access,
|
||||||
|
order = 'ASC',
|
||||||
}: {
|
}: {
|
||||||
id: number;
|
id: number;
|
||||||
access: string;
|
access: string;
|
||||||
|
order: 'ASC' | 'DESC';
|
||||||
}): Promise<IResultWithStatus<{ comments: Comment[] }>> =>
|
}): Promise<IResultWithStatus<{ comments: Comment[] }>> =>
|
||||||
api
|
api
|
||||||
.get(API.NODE.COMMENT(id), configWithToken(access))
|
.get(API.NODE.COMMENT(id), configWithToken(access, { params: { order } }))
|
||||||
.then(resultMiddleware)
|
.then(resultMiddleware)
|
||||||
.catch(errorMiddleware);
|
.catch(errorMiddleware);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ function* onNodeGoto({ id, node_type }: ReturnType<typeof nodeGotoNode>) {
|
||||||
yield put(push(URLS.NODE_URL(id)));
|
yield put(push(URLS.NODE_URL(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function* onNodeLoad({ id }: ReturnType<typeof nodeLoadNode>) {
|
function* onNodeLoad({ id, order = 'ASC' }: ReturnType<typeof nodeLoadNode>) {
|
||||||
yield put(nodeSetLoading(true));
|
yield put(nodeSetLoading(true));
|
||||||
yield put(nodeSetLoadingComments(true));
|
yield put(nodeSetLoadingComments(true));
|
||||||
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
|
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
|
||||||
|
@ -123,7 +123,7 @@ function* onNodeLoad({ id }: ReturnType<typeof nodeLoadNode>) {
|
||||||
data: { related },
|
data: { related },
|
||||||
},
|
},
|
||||||
} = yield all({
|
} = yield all({
|
||||||
comments: call(reqWrapper, getNodeComments, { id }),
|
comments: call(reqWrapper, getNodeComments, { id, order }),
|
||||||
related: call(reqWrapper, getNodeRelated, { id }),
|
related: call(reqWrapper, getNodeRelated, { id }),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
1361
src/sprites/illustrate.svg
Normal file
1361
src/sprites/illustrate.svg
Normal file
File diff suppressed because it is too large
Load diff
After Width: | Height: | Size: 50 KiB |
Loading…
Add table
Add a link
Reference in a new issue