mirror of
https://github.com/morten-olsen/bob-the-algorithm.git
synced 2026-02-08 00:46:25 +01:00
v3
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user