1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00
vault-frontend/src/hooks/flow/useFlow.ts
2022-01-09 19:28:23 +07:00

30 lines
873 B
TypeScript

import { useFlowLayout } from '~/hooks/flow/useFlowLayout';
import { useMemo } from 'react';
import { useFlowLoader } from '~/hooks/flow/useFlowLoader';
import { useFlowStore } from '~/store/flow/useFlowStore';
import { useFlowSetCellView } from '~/hooks/flow/useFlowSetCellView';
import { useGetLabStats } from '~/hooks/lab/useGetLabStats';
export const useFlow = () => {
const { loadMore, isSyncing } = useFlowLoader();
const { nodes, heroes, recent, updated } = useFlowStore();
const { isFluid, toggleLayout } = useFlowLayout();
const lab = useGetLabStats();
const updates = useMemo(() => [...updated, ...lab.updates].slice(0, 10), [lab.updates, updated]);
const onChangeCellView = useFlowSetCellView();
return {
nodes,
heroes,
recent,
updates,
isFluid,
toggleLayout,
onChangeCellView,
loadMore,
isSyncing,
};
};