From 3544076f90d3ee8a3fa3e88eebecefac32b74b45 Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Fri, 20 Aug 2021 03:37:12 +0900 Subject: [PATCH] Added checkmark completion thing --- src/App.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/App.js b/src/App.js index 3b19adb..56e6fcf 100644 --- a/src/App.js +++ b/src/App.js @@ -12,6 +12,8 @@ import Button from 'react-bootstrap/Button'; import ProgressBar from 'react-bootstrap/ProgressBar'; import Accordion from 'react-bootstrap/Accordion'; +import { FaCheckCircle } from 'react-icons/fa'; + const parse = require('csv-parse/lib/sync') const axios = require('axios'); @@ -51,7 +53,12 @@ function ItemGroup(p) { if (b.required===b.obtained&&a.required!==a.obtained) {return -1} if (b.required===b.obtained&&a.required===a.obtained) {return a.id-b.id} if (b.required!==b.obtained&&a.required!==a.obtained) {return a.id-b.id} - }));}} type="number" min="0" max={item.required}/> / {item.required} + }));}} type="number" min="0" max={item.required}/> / {item.required} {item.required!==item.obtained&&{ + var correctedVal=item.required; if (f.currentTarget.value>=item.required) {f.currentTarget.blur()} axios.post(BACKEND_URL+"/updateItem",{obtained:correctedVal,id:item.id,last_modified:new Date()}); var newData=[...displayData];newData[i].obtained=correctedVal;p.setLastModified(new Date());setDisplayData(newData.sort((a,b)=>{ + if (b.required===b.obtained&&a.required!==a.obtained) {return -1} + if (b.required===b.obtained&&a.required===a.obtained) {return a.id-b.id} + if (b.required!==b.obtained&&a.required!==a.obtained) {return a.id-b.id} + }));}}/>} View Item Info