2021-12-29 05:28:02 +00:00
|
|
|
import React, { ReactNode } from "react";
|
|
|
|
|
|
|
|
import { PlayerCharacter } from "./types"
|
|
|
|
|
|
|
|
export type AppState = {
|
|
|
|
playerCharacters: { [name: string]: PlayerCharacter };
|
|
|
|
}
|
|
|
|
|
2021-12-29 16:31:14 +00:00
|
|
|
export const AppContext = React.createContext<{ state: AppState }>({state: {
|
2021-12-29 05:28:02 +00:00
|
|
|
playerCharacters: {}
|
2021-12-29 16:31:14 +00:00
|
|
|
}})
|
2021-12-29 05:28:02 +00:00
|
|
|
|
|
|
|
const AppProvider = ({ children }: { children: ReactNode }) => {
|
|
|
|
const [state, setState] = React.useState<AppState>({playerCharacters: {
|
|
|
|
"priat": {
|
|
|
|
name: "Priat",
|
|
|
|
concept: "An Intuitive Jack who Explores Yesterday",
|
|
|
|
effort: 1,
|
|
|
|
cypherLimit: 2,
|
|
|
|
might: { value: 12, max: 12, edge: 0 },
|
|
|
|
speed: { value: 14, max: 14, edge: 0 },
|
|
|
|
intellect: { value: 12, max: 12, edge: 1 },
|
|
|
|
}}})
|
|
|
|
|
|
|
|
return (<AppContext.Provider value={{state}}>{children}</AppContext.Provider>)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default AppProvider
|