mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
removed lab reducer
This commit is contained in:
parent
e24ea4afeb
commit
2b7b756212
26 changed files with 242 additions and 369 deletions
|
@ -1,24 +1,24 @@
|
|||
import { ILabNode } from '~/redux/lab/types';
|
||||
import { ILabNode } from '~/types/lab';
|
||||
import React, { createContext, FC, useContext } from 'react';
|
||||
import { INode, ITag } from '~/redux/types';
|
||||
import { IFlowNode, ITag } from '~/redux/types';
|
||||
|
||||
export interface LabContextProps {
|
||||
isLoading: boolean;
|
||||
nodes: ILabNode[];
|
||||
count: number;
|
||||
onLoadMore: () => void;
|
||||
hasMore: boolean;
|
||||
loadMore: () => void;
|
||||
|
||||
tags: ITag[];
|
||||
heroes: Partial<INode>[];
|
||||
heroes: IFlowNode[];
|
||||
isLoadingStats: boolean;
|
||||
updates: Partial<INode>[];
|
||||
updates: IFlowNode[];
|
||||
}
|
||||
|
||||
const defaultValues: LabContextProps = {
|
||||
isLoading: false,
|
||||
nodes: [],
|
||||
count: 0,
|
||||
onLoadMore: () => {},
|
||||
hasMore: false,
|
||||
loadMore: () => {},
|
||||
tags: [],
|
||||
heroes: [],
|
||||
isLoadingStats: false,
|
||||
|
|
|
@ -5,14 +5,14 @@ import { useLab } from '~/hooks/lab/useLab';
|
|||
interface LabProviderProps {}
|
||||
|
||||
const LabProvider: FC<LabProviderProps> = ({ children }) => {
|
||||
const { isLoading, nodes, count, onLoadMore, tags, heroes, isLoadingStats, updates } = useLab();
|
||||
const { isLoading, nodes, loadMore, hasMore, tags, heroes, isLoadingStats, updates } = useLab();
|
||||
|
||||
return (
|
||||
<LabContextProvider
|
||||
isLoading={isLoading && !nodes.length}
|
||||
nodes={nodes}
|
||||
count={count}
|
||||
onLoadMore={onLoadMore}
|
||||
hasMore={hasMore}
|
||||
loadMore={loadMore}
|
||||
tags={tags}
|
||||
heroes={heroes}
|
||||
isLoadingStats={isLoadingStats}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue