1
0

Updated the SettingsProvider.jsx

This commit is contained in:
Mathias Wagner 2023-11-23 07:50:23 +01:00
parent d2beddc0e5
commit da50e61776
Signed by: Mathias
GPG Key ID: B8DC354B0A1F5B44

View File

@ -9,6 +9,11 @@ export const SettingsProvider = ({children}) => {
1800: 40, 1800: 40,
2200: 30 2200: 30
}); });
const [startCapital, setStartCapital] = useState(localStorage.getItem("startCapital") || 25000);
const [costPerCake, setCostPerCake] = useState(localStorage.getItem("costPerCake") || 1000);
const [costPerRound, setCostPerRound] = useState(localStorage.getItem("costPerRound") || 4000);
const [maxProduction, setMaxProduction] = useState(localStorage.getItem("maxProduction") || 20);
const [maxPrice, setMaxPrice] = useState(localStorage.getItem("maxPrice") || 10000);
const updateRounds = (newValue) => { const updateRounds = (newValue) => {
localStorage.setItem("rounds", newValue); localStorage.setItem("rounds", newValue);
@ -21,7 +26,11 @@ export const SettingsProvider = ({children}) => {
} }
return ( return (
<SettingsContext.Provider value={{rounds, updateRounds, demandTable, updateDemandTable}}> <SettingsContext.Provider value={{
rounds, updateRounds, demandTable, updateDemandTable, startCapital, setStartCapital,
costPerCake, setCostPerCake, costPerRound, setCostPerRound, maxProduction, setMaxProduction,
maxPrice, setMaxPrice
}}>
{children} {children}
</SettingsContext.Provider> </SettingsContext.Provider>
); );