This commit is contained in:
Morten Olsen
2022-05-10 19:04:05 +02:00
parent 0b2f23ecb2
commit 8259232a83
101 changed files with 1752 additions and 1740 deletions

View File

@@ -1,15 +1,18 @@
import { createContext } from 'react';
import { createDataContext } from '#/utils/data-context';
import { Strategies } from "./algorithm/build-graph";
type PlannerOptions = {
strategy: Strategies;
}
type PlannerContextValue = {
options: PlannerOptions;
setOptions: (options: Partial<PlannerOptions>) => void;
}
const PlannerContext = createContext<PlannerContextValue>(undefined as any);
const {
Context: PlannerContext,
Provider: PlannerProvider,
} = createDataContext<PlannerOptions>({
createDefault: () => ({
strategy: Strategies.firstComplet,
}),
});
export type { PlannerContextValue, PlannerOptions };
export { PlannerContext };
export type { PlannerOptions };
export { PlannerContext, PlannerProvider };