Include finished crafting message display in frontend
This commit is contained in:
		
							parent
							
								
									d4f66f4de8
								
							
						
					
					
						commit
						1d044f986d
					
				
							
								
								
									
										17
									
								
								src/App.js
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								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 <Toast key={not.id} show={show} autohide delay={NOTIFICATIONTIMEOUT*1000} onClose={()=>{setShow(false)}} bg={not.operation==="FINISH"?"success":not.operation==="INCREASE"?"primary":"warning"}> | ||||
| 	return <Toast key={not.id} show={show} autohide delay={NOTIFICATIONTIMEOUT*1000} onClose={()=>{setShow(false)}} bg={(not.operation==="FINISH"||not.operation==="FINISH_CRAFT")?"success":not.operation==="INCREASE"?"primary":"warning"}> | ||||
| 	<Toast.Header closeButton={true}> | ||||
| 	<span className="me-auto"> | ||||
| 		<strong>{not.username}</strong> | ||||
| 		{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}</span> | ||||
| 	</Toast.Header> | ||||
| @ -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() { | ||||
| 									<ProgressBar className="bg-dark text-white"> | ||||
| 										<ProgressBar animated striped variant="success" label={`${completeRatio}%`} now={completeRatio} /> | ||||
| 										<ProgressBar animated striped variant="info" label={`${inProgressRatio}%`} now={inProgressRatio} /> | ||||
| 										<ProgressBar animated striped variant="dark" now={missingProgressRatio} /> | ||||
| 										<ProgressBar animated striped variant="danger" label={`${craftsRatio}%`} now={craftsRatio} /> | ||||
| 										<ProgressBar animated striped variant="dark" now={missingCraftsRatio} /> | ||||
| 										<ProgressBar animated striped variant="dark" now={missingProgressRatio} /> | ||||
| 									</ProgressBar> | ||||
| 								</Row> | ||||
| 								<Row> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user