From 0ae2b7ff9694a27fa54688c8f82eaf9a1410427f Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Thu, 23 Nov 2023 08:10:20 +0100 Subject: [PATCH] Updated the SettingsProvider.jsx --- .../src/common/contexts/SettingsProvider.jsx | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/client/src/common/contexts/SettingsProvider.jsx b/client/src/common/contexts/SettingsProvider.jsx index cc0f8aa..512aa2d 100644 --- a/client/src/common/contexts/SettingsProvider.jsx +++ b/client/src/common/contexts/SettingsProvider.jsx @@ -20,6 +20,31 @@ export const SettingsProvider = ({children}) => { setRounds(newValue); } + const updateStartCapital = (newValue) => { + localStorage.setItem("startCapital", newValue); + setStartCapital(newValue); + } + + const updateCostPerCake = (newValue) => { + localStorage.setItem("costPerCake", newValue); + setCostPerCake(newValue); + } + + const updateCostPerRound = (newValue) => { + localStorage.setItem("costPerRound", newValue); + setCostPerRound(newValue); + } + + const updateProduction = (newValue) => { + localStorage.setItem("maxProduction", newValue); + setMaxProduction(newValue); + } + + const updatePrice = (newValue) => { + localStorage.setItem("maxProduction", newValue); + setMaxPrice(newValue); + } + const updateDemandTable = (newValue) => { localStorage.setItem("demandTable", JSON.stringify(newValue)); setDemandTable(newValue); @@ -27,9 +52,9 @@ export const SettingsProvider = ({children}) => { return ( {children}