diff --git a/culinaryFrontend/src/components/screens/MainActionsScreen.tsx b/culinaryFrontend/src/components/screens/MainActionsScreen.tsx index ef31de2..45f6eaa 100644 --- a/culinaryFrontend/src/components/screens/MainActionsScreen.tsx +++ b/culinaryFrontend/src/components/screens/MainActionsScreen.tsx @@ -17,10 +17,20 @@ type MainActionsScreenProps = { export default function MainActionsScreen({gameStateSetter}: MainActionsScreenProps) { - const refillUrl = "/functions/refill-fridge" - const soupUrl = "/functions/tomato-soup" - const spiceUrl = "/functions/soup-spices" - const tasteUrl = "/functions/check-soup" + const refillUrl = "/functions/refill-fridge" + const soupUrl = "/functions/tomato-soup" + const spiceUrl = "/functions/soup-spices" + const tasteUrl = "/functions/check-soup" + const saladListUrl = "/functions/salad-list" + const saladSequenceUrl = "/functions/salad-sequence" + const smoothieListUrl = "/functions/smoothie-list" + const smoothieSequenceUrl = "/functions/smoothie-sequence" + + const soupName = "soup" + const saladListName = "salad (list)" + const saladSequenceName = "salad (sequence)" + const smoothieListName = "smoothie (list)" + const smoothieSequenceName = "smoothie (sequence)" type BlenderOptions = { visible: boolean, @@ -102,7 +112,7 @@ export default function MainActionsScreen({gameStateSetter}: MainActionsScreenPr let [counterProducts, counterProductsSetter] = useState>([]) let [fridgeProducts, fridgeProductsSetter] = useState>([]) - let [infoText, infoTextSetter] = useState("Press \"Cook!\" button to start") + let [infoText, infoTextSetter] = useState("Press button to start") let [spicesShelfVis, spicesShelfVisSetter] = useState(false) let [blenderOptions, setBlenderOptions] = useState(initialBlenderOptions); let [potOptions, setPotOptions] = useState(initialPotOptions); @@ -512,7 +522,8 @@ export default function MainActionsScreen({gameStateSetter}: MainActionsScreenPr }) } - function cook() { + + function cook(url: string, dishName: string){ setBlenderOptions(initialBlenderOptions); setPotOptions(initialPotOptions); setSaladBowlOptions(initialSaladBowlOptions) @@ -520,16 +531,16 @@ export default function MainActionsScreen({gameStateSetter}: MainActionsScreenPr setBerryBasketOptions(initialBerryBasketOptions) spicesShelfVisSetter(false) counterProductsSetter([]) - setButtonBlocker("cook") + setButtonBlocker(dishName) const delay = (ms: number) => new Promise(res => setTimeout(res, ms)); let actions = Array() - axios.get(soupUrl).then(async (response) => { + axios.get(url).then(async (response) => { actions = response.data as Array console.log("GOT: " + actions) if (actions.length == 0){ - infoTextSetter("Not enough vegetables to make soup!") + infoTextSetter(`Not enough ingredients to make ${dishName}!`) setButtonBlocker("") return } @@ -635,8 +646,8 @@ export default function MainActionsScreen({gameStateSetter}: MainActionsScreenPr onClick={() => refill()}>Refill! + + + + + );