mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-05-04 00:56:40 +07:00
added lab sorting
This commit is contained in:
parent
566e1192cd
commit
948f3a7e04
7 changed files with 63 additions and 15 deletions
src/utils
|
@ -1,7 +1,7 @@
|
|||
import React, { createContext, FC, useContext } from 'react';
|
||||
|
||||
import { IFlowNode, ITag } from '~/types';
|
||||
import { ILabNode } from '~/types/lab';
|
||||
import { ILabNode, LabNodesSort } from '~/types/lab';
|
||||
|
||||
export interface LabContextProps {
|
||||
isLoading: boolean;
|
||||
|
@ -13,6 +13,8 @@ export interface LabContextProps {
|
|||
heroes: IFlowNode[];
|
||||
isLoadingStats: boolean;
|
||||
updates: IFlowNode[];
|
||||
sort: LabNodesSort;
|
||||
setSort: (sort: LabNodesSort) => void;
|
||||
}
|
||||
|
||||
const defaultValues: LabContextProps = {
|
||||
|
@ -24,6 +26,8 @@ const defaultValues: LabContextProps = {
|
|||
heroes: [],
|
||||
isLoadingStats: false,
|
||||
updates: [],
|
||||
sort: LabNodesSort.New,
|
||||
setSort: () => {},
|
||||
};
|
||||
|
||||
const LabContext = createContext<LabContextProps>(defaultValues);
|
||||
|
|
|
@ -6,7 +6,18 @@ import { LabContextProvider } from '~/utils/context/LabContextProvider';
|
|||
interface LabProviderProps {}
|
||||
|
||||
const LabProvider: FC<LabProviderProps> = ({ children }) => {
|
||||
const { isLoading, nodes, loadMore, hasMore, tags, heroes, isLoadingStats, updates } = useLab();
|
||||
const {
|
||||
isLoading,
|
||||
nodes,
|
||||
loadMore,
|
||||
hasMore,
|
||||
tags,
|
||||
heroes,
|
||||
isLoadingStats,
|
||||
updates,
|
||||
sort,
|
||||
setSort,
|
||||
} = useLab();
|
||||
|
||||
return (
|
||||
<LabContextProvider
|
||||
|
@ -18,6 +29,8 @@ const LabProvider: FC<LabProviderProps> = ({ children }) => {
|
|||
heroes={heroes}
|
||||
isLoadingStats={isLoadingStats}
|
||||
updates={updates}
|
||||
sort={sort}
|
||||
setSort={setSort}
|
||||
>
|
||||
{children}
|
||||
</LabContextProvider>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue