1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00
vault-frontend/src/hooks/flow/useFlow.ts
2022-01-20 16:33:40 +07:00

32 lines
924 B
TypeScript

import { useMemo } from 'react';
import { useFlowLayout } from '~/hooks/flow/useFlowLayout';
import { useFlowLoader } from '~/hooks/flow/useFlowLoader';
import { useFlowSetCellView } from '~/hooks/flow/useFlowSetCellView';
import { useGetLabStats } from '~/hooks/lab/useGetLabStats';
import { useFlowStore } from '~/store/flow/useFlowStore';
import { GetNodeDiffResult } from '~/types/node';
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,
};
};