1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00

added flow context

This commit is contained in:
Fedor Katurov 2022-01-04 13:44:51 +07:00
parent 31e433af3e
commit 5f3accee48
6 changed files with 105 additions and 87 deletions

View file

@ -1,48 +1,22 @@
import React, { FC } from 'react';
import { FlowGrid } from '~/components/flow/FlowGrid';
import styles from './styles.module.scss';
import { FlowStamp } from '~/components/flow/FlowStamp';
import { FlowStamp } from '~/containers/flow/FlowStamp';
import { SidebarRouter } from '~/containers/main/SidebarRouter';
import { FlowDisplay, IFlowNode, INode } from '~/redux/types';
import classNames from 'classnames';
import { FlowSwiperHero } from '~/components/flow/FlowSwiperHero';
import { IUser } from '~/redux/auth/types';
import { useFlowContext } from '~/utils/context/FlowContextProvider';
import { useUser } from '~/hooks/user/userUser';
interface Props {
updates: IFlowNode[];
recent: IFlowNode[];
heroes: IFlowNode[];
nodes: IFlowNode[];
user: IUser;
isFluid: boolean;
onToggleLayout: () => void;
onChangeCellView: (id: INode['id'], flow: FlowDisplay) => void;
searchText: string;
searchTotal: number;
searchIsLoading: boolean;
searchResults: INode[];
onSearchChange: (text: string) => void;
onSearchLoadMore: () => void;
}
const FlowLayout: FC<Props> = ({
updates,
heroes,
recent,
nodes,
user,
isFluid,
onToggleLayout,
onChangeCellView,
const FlowLayout: FC<Props> = ({ isFluid, onToggleLayout }) => {
const { heroes, nodes, onChangeCellView } = useFlowContext();
const user = useUser();
searchText,
searchTotal,
searchIsLoading,
searchResults,
onSearchChange,
onSearchLoadMore,
}) => {
return (
<div className={classNames(styles.container)}>
<div className={styles.grid}>
@ -51,18 +25,7 @@ const FlowLayout: FC<Props> = ({
</div>
<div className={styles.stamp}>
<FlowStamp
isFluid={isFluid}
recent={recent}
updated={updates}
searchText={searchText}
searchIsLoading={searchIsLoading}
searchTotal={searchTotal}
searchResults={searchResults}
onSearchChange={onSearchChange}
onSearchLoadMore={onSearchLoadMore}
onToggleLayout={onToggleLayout}
/>
<FlowStamp isFluid={isFluid} onToggleLayout={onToggleLayout} />
</div>
<FlowGrid nodes={nodes} user={user} onChangeCellView={onChangeCellView} />