Removed all warnings
This commit is contained in:
parent
53406cd6d6
commit
88ea058b7d
94
src/App.js
94
src/App.js
@ -1,4 +1,3 @@
|
||||
import logo from './logo512.png';
|
||||
import './App.css';
|
||||
import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
|
||||
@ -35,7 +34,6 @@ const progress2 = new Audio(process.env.PUBLIC_URL+"/progress2.mp3")
|
||||
function ItemGroup(p) {
|
||||
const { data } = p
|
||||
const { contributor } = p
|
||||
const { setData1,setData2,setData3,setData4,setLastModified,lastModified } = p
|
||||
const [displayData,setDisplayData] = useState([])
|
||||
const [lockout,setLockout] = useState(false)
|
||||
|
||||
@ -44,6 +42,7 @@ 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}
|
||||
return 0
|
||||
}))
|
||||
},[data])
|
||||
|
||||
@ -57,9 +56,9 @@ function ItemGroup(p) {
|
||||
|
||||
function updateItem(item,target,contributor) {
|
||||
var correctedVal=Math.min(item.required,target.value);
|
||||
if (correctedVal==item.obtained) {return;}
|
||||
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==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})
|
||||
.then((data)=>{
|
||||
setLockout(false)
|
||||
})
|
||||
@ -73,7 +72,7 @@ function ItemGroup(p) {
|
||||
<Accordion.Body className="panel-body">
|
||||
{displayData.map((item,i,arr)=><Row key={item.id} className={"pb-1 pt-1 text-light"+(Number(item.obtained)===0?" notStarted":Number(item.obtained)===Number(item.required)?" completed":" inProgress")}>
|
||||
<Col>
|
||||
<img src={"https://xivapi.com"+item.icon}/> {item.name}
|
||||
<img src={"https://xivapi.com"+item.icon} alt={item.name}/> {item.name}
|
||||
</Col>
|
||||
<Col>
|
||||
<input disabled={lockout} id={"field_"+item.id} style={{width:"5em"}} defaultValue={item.obtained} className="mt-1 bg-secondary"
|
||||
@ -111,7 +110,6 @@ function Notification(p) {
|
||||
}
|
||||
|
||||
function DarkInput(p){
|
||||
const {props}=p;
|
||||
return <input type="text" className="bg-dark text-white" {...p}></input>
|
||||
}
|
||||
|
||||
@ -172,14 +170,14 @@ function SorterApp(){
|
||||
setChecking(false)
|
||||
return
|
||||
} else
|
||||
if (itemData1.ItemSortCategory.ID==itemData2.ItemSortCategory.ID&&
|
||||
if (itemData1.ItemSortCategory.ID===itemData2.ItemSortCategory.ID&&
|
||||
itemData1.ItemUICategory.ID<itemData2.ItemUICategory.ID){
|
||||
i.resultFunc(SUCCESS)
|
||||
setChecking(false)
|
||||
return
|
||||
} else
|
||||
if (itemData1.ItemSortCategory.ID==itemData2.ItemSortCategory.ID&&
|
||||
itemData1.ItemUICategory.ID==itemData2.ItemUICategory.ID&&
|
||||
if (itemData1.ItemSortCategory.ID===itemData2.ItemSortCategory.ID&&
|
||||
itemData1.ItemUICategory.ID===itemData2.ItemUICategory.ID&&
|
||||
itemData1.ID<itemData2.ID){
|
||||
i.resultFunc(SUCCESS)
|
||||
setChecking(false)
|
||||
@ -346,12 +344,10 @@ function App() {
|
||||
const [succeeded,setSucceeded] = useState(0)
|
||||
const [failed,setFailed] = useState(0)
|
||||
const [total,setTotal] = useState(0)
|
||||
const [listData,setListData] = useState([])
|
||||
const [lastModified,setLastModified] = useState(new Date())
|
||||
|
||||
const [contributor,setContributor] = useState("")
|
||||
const [notifications,setNotifications] = useState([])
|
||||
const [closedNotifications,setClosedNotifications] = useState([])
|
||||
|
||||
const [nav,setNav] = useState("main")
|
||||
|
||||
@ -428,41 +424,6 @@ function App() {
|
||||
|
||||
const disabled=true
|
||||
|
||||
function downloadData(d,val,max) {
|
||||
if (val<max) {
|
||||
axios.get(encodeURI("https://xivapi.com/search?string="+d[val].Item))
|
||||
.then((data)=>{
|
||||
var results = data.data.Results
|
||||
var found=false
|
||||
for (var r of results) {
|
||||
if (r.Name===d[val].Item&&r.UrlType==="Item") {
|
||||
found=true
|
||||
//console.log("Found "+r)
|
||||
setSucceeded(succeeded+1)
|
||||
var dataObj = {
|
||||
itemid:r.ID,
|
||||
name:r.Name,
|
||||
obtained:0,
|
||||
required:d[val].Needed,
|
||||
icon:r.Icon
|
||||
}
|
||||
return axios.post(BACKEND_URL+"/setItem",dataObj)
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
setFailed(failed+1)
|
||||
console.log("Could not find "+d[val].Item+"....")
|
||||
}
|
||||
})
|
||||
.then(()=>{
|
||||
setTimeout(downloadData(d,val+1,max),250)
|
||||
})
|
||||
.catch((err)=>{
|
||||
setFailed(failed+1)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(()=>{
|
||||
if (update) {
|
||||
axios.get("https://projectdivar.com:4505/getData")
|
||||
@ -491,15 +452,50 @@ function App() {
|
||||
if (succeeded+failed===total) {
|
||||
setUpdate(true)
|
||||
}
|
||||
},[succeeded,failed])
|
||||
},[succeeded,failed,total])
|
||||
|
||||
useEffect(()=>{
|
||||
|
||||
const downloadData=(d,val,max)=>{
|
||||
if (val<max) {
|
||||
axios.get(encodeURI("https://xivapi.com/search?string="+d[val].Item))
|
||||
.then((data)=>{
|
||||
var results = data.data.Results
|
||||
var found=false
|
||||
for (var r of results) {
|
||||
if (r.Name===d[val].Item&&r.UrlType==="Item") {
|
||||
found=true
|
||||
//console.log("Found "+r)
|
||||
setSucceeded(succeeded+1)
|
||||
var dataObj = {
|
||||
itemid:r.ID,
|
||||
name:r.Name,
|
||||
obtained:0,
|
||||
required:d[val].Needed,
|
||||
icon:r.Icon
|
||||
}
|
||||
return axios.post(BACKEND_URL+"/setItem",dataObj)
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
setFailed(failed+1)
|
||||
console.log("Could not find "+d[val].Item+"....")
|
||||
}
|
||||
})
|
||||
.then(()=>{
|
||||
setTimeout(downloadData(d,val+1,max),250)
|
||||
})
|
||||
.catch((err)=>{
|
||||
setFailed(failed+1)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
var d = parse(fileData,{columns:true,skip_empty_lines:true})
|
||||
console.log(d)
|
||||
var promises = []
|
||||
downloadData(d,0,d.length)
|
||||
setTotal(d.length)
|
||||
},[fileData])
|
||||
},[fileData,failed,succeeded])
|
||||
|
||||
return (
|
||||
<Container className="bg-dark" fluid>
|
||||
|
Loading…
x
Reference in New Issue
Block a user