From b3396db33829434726182ce6a4b5fb8aa843276a Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 14 May 2023 12:01:45 -0500 Subject: [PATCH] Update frontend to send item info to backend --- src/App.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/App.js b/src/App.js index fbc849a..03ae883 100755 --- a/src/App.js +++ b/src/App.js @@ -35,13 +35,13 @@ const progress1 = new Audio(process.env.PUBLIC_URL+"/progress1.mp3") const progress2 = new Audio(process.env.PUBLIC_URL+"/progress2.mp3") function Item(p){ - const {item,setLockout,contributor,lockout} = p + const {item,setLockout,contributor,lockout,itemCount,totalItemCount} = p function updateItem(item,target,contributor) { var correctedVal=Math.min(item.required,target.value); if (correctedVal===Number(item.obtained)) {return;} setLockout(true) - axios.post(BACKEND_URL+"/updateItem",{obtained:correctedVal,id:item.id,last_modified:new Date(),item_name:item.name,username:contributor,required:item.required,operation:correctedVal===Number(item.required)?"FINISH":correctedVal>item.obtained?"INCREASE":"SET",previous_amt:item.obtained}) + axios.post(BACKEND_URL+"/updateItem",{obtained:correctedVal,id:item.id,last_modified:new Date(),item_name:item.name,username:contributor,required:item.required,operation:correctedVal===Number(item.required)?"FINISH":correctedVal>item.obtained?"INCREASE":"SET",previous_amt:item.obtained,itemCount:itemCount,totalItemCount:totalItemCount}) .then((data)=>{ setLockout(false) }) @@ -73,7 +73,7 @@ function Item(p){ function ItemGroup(p) { const { data } = p - const { contributor } = p + const { contributor,itemCount,totalItemCount } = p const [displayData,setDisplayData] = useState([]) const [lockout,setLockout] = useState(false) @@ -97,7 +97,7 @@ function ItemGroup(p) { return {p.name} - {displayData.map((item,i,arr)=>)} + {displayData.map((item,i,arr)=>)} } @@ -665,7 +665,7 @@ function App() { data.length>0? <> - {(Number(completeRatio)+Number(inProgressRatio)+Number(craftsRatio))}% complete({itemCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " / " + totalItemCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}) + {Math.floor(Number(completeRatio)+Number(inProgressRatio)+Number(craftsRatio))}% complete({itemCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") + " / " + totalItemCount.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")}) @@ -687,15 +687,15 @@ function App() { setMatchedItems([]) } }} /> - {matchedItems.map((item)=>)} + {matchedItems.map((item)=>)} - - - - + + + + : :nav==="list"?: