29 lines
812 B
TypeScript
29 lines
812 B
TypeScript
import React, { ReactNode } from "react";
|
|
|
|
import { PlayerCharacter } from "./types"
|
|
|
|
export type AppState = {
|
|
playerCharacters: { [name: string]: PlayerCharacter };
|
|
}
|
|
|
|
export const AppContext = React.createContext<{ state: AppState }>({state: {
|
|
playerCharacters: {}
|
|
}})
|
|
|
|
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
|