From 1d044f986d85daf04fde84cf4624a2b5e2f452e9 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sun, 28 May 2023 01:42:30 -0500 Subject: [PATCH] Include finished crafting message display in frontend --- src/App.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/App.js b/src/App.js index c607109..56fd345 100755 --- a/src/App.js +++ b/src/App.js @@ -44,7 +44,7 @@ function Item(p){ 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,itemCount:itemCount,totalItemCount:totalItemCount}) + 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,finalcraft:item.finalcraft}) .then((data)=>{ setLockout(false) }) @@ -207,11 +207,12 @@ function Notification(p) { const [show,setShow] = useState(true) const { not } = p - return {setShow(false)}} bg={not.operation==="FINISH"?"success":not.operation==="INCREASE"?"primary":"warning"}> + return {setShow(false)}} bg={(not.operation==="FINISH"||not.operation==="FINISH_CRAFT")?"success":not.operation==="INCREASE"?"primary":"warning"}> {not.username} - {not.operation==="FINISH"?" has finished collecting "+not.required+"/"+not.required+" "+not.item_name+"!": + {not.operation==="FINISH_CRAFT"?" has finished crafting "+not.item_name+"!": + not.operation==="FINISH"?" has finished collecting "+not.required+" "+not.item_name+"!": not.operation==="INCREASE"?" has collected "+not.obtained+"/"+not.required+" "+not.item_name+" (+"+(not.obtained-not.previous_amt)+")" :" has set "+not.item_name+" to "+not.obtained+"/"+not.required} @@ -486,7 +487,6 @@ function App() { const [itemCount,setItemCount] = useState() const [totalItemCount,setTotalItemCount] = useState() const [craftsRatio,setCraftsRatio] = useState(0) - const [missingCraftsRatio,setMissingCraftsRatio] = useState(0) const [inProgressRatio,setInProgressRatio] = useState(0) const [missingProgressRatio,setMissingProgressRatio] = useState(0) const [completeRatio,setCompleteRatio] = useState(0) @@ -546,8 +546,7 @@ function App() { } setItemCount(itemsComplete+itemsInProgress+itemsCrafts) setTotalItemCount(tot) - setMissingCraftsRatio(((totCrafts-itemsCrafts)/tot*100).toFixed(2)) - setMissingProgressRatio(((totItemsInProgress-itemsInProgress)/tot*100).toFixed(2)) + setMissingProgressRatio((((totItemsInProgress-itemsInProgress)+(totCrafts-itemsCrafts))/tot*100).toFixed(2)) setCompleteRatio((itemsComplete/tot*100).toFixed(2)) setInProgressRatio((itemsInProgress/tot*100).toFixed(2)) setCraftsRatio((itemsCrafts/tot*100).toFixed(2)) @@ -655,8 +654,7 @@ function App() { } setItemCount(itemsComplete+itemsInProgress+itemsCrafts) setTotalItemCount(tot) - setMissingCraftsRatio(((totCrafts-itemsCrafts)/tot*100).toFixed(2)) - setMissingProgressRatio(((totItemsInProgress-itemsInProgress)/tot*100).toFixed(2)) + setMissingProgressRatio((((totItemsInProgress-itemsInProgress)+(totCrafts-itemsCrafts))/tot*100).toFixed(2)) setCompleteRatio((itemsComplete/tot*100).toFixed(2)) setInProgressRatio((itemsInProgress/tot*100).toFixed(2)) setCraftsRatio((itemsCrafts/tot*100).toFixed(2)) @@ -801,9 +799,8 @@ function App() { - - +