diff --git a/src/App.js b/src/App.js index c7aa01e..c607109 100755 --- a/src/App.js +++ b/src/App.js @@ -152,9 +152,11 @@ function Item(p){ {item.name}/ {item.name} {itemLoc} - { - if (k.key==='Enter') {updateItem(item,document.getElementById("field_"+item.id),contributor)} + if (k.key==='Enter') {for (var field of document.getElementsByName("field_"+item.id)){ + updateItem(item,field,contributor) + }} }} onChange={(f)=>{ if (f.currentTarget.value>=item.required) {f.currentTarget.blur()} @@ -170,9 +172,8 @@ function Item(p){ function ItemGroup(p) { const { data } = p - const { contributor,itemCount,totalItemCount,playerInventory } = p + const { contributor,itemCount,totalItemCount,playerInventory,lockout,setLockout } = p const [displayData,setDisplayData] = useState([]) - const [lockout,setLockout] = useState(false) useEffect(()=>{ setDisplayData([...data].sort((a,b)=>{ @@ -185,8 +186,10 @@ function ItemGroup(p) { useEffect(()=>{ displayData.forEach((item)=>{ - if (document.getElementById("field_"+item.id)) { - document.getElementById("field_"+item.id).value=item.obtained + if (document.getElementsByName("field_"+item.id).length>0) { + for (var field of document.getElementsByName("field_"+item.id)){ + field.value=item.obtained + } } }) },[displayData]) @@ -303,7 +306,7 @@ function ListApp(p){ } } }) - .catch((err)=>{}) + .catch((err)=>{/*console.error("Couldn't read inventory data. "+JSON.stringify(err))*/}) },1000) return ()=>clearInterval(interval) }) @@ -328,6 +331,7 @@ function ListApp(p){ let d = resp.data recipeData=[d,...recipeData] }) + .catch((err)=>{/*console.error("Failed to get recipe. "+JSON.stringify(err))*/}) await sleep(250) } currentPage++; @@ -339,8 +343,10 @@ function ListApp(p){ let d=resp.data results=d.Results }) + .catch((err)=>{/* console.error("Failed to get recipe. "+JSON.stringify(err)) */}) } }) + .catch((err)=>{/* console.error("Failed to get recipe. "+JSON.stringify(err)) */}) .finally(async()=>{ //console.log(recipeData) //setChecking(false) @@ -546,6 +552,7 @@ function App() { setInProgressRatio((itemsInProgress/tot*100).toFixed(2)) setCraftsRatio((itemsCrafts/tot*100).toFixed(2)) }) + .catch((err)=>{/* console.error("Failed to download recipes. "+JSON.stringify(err)) */}) } }) .catch((err)=>{ @@ -565,6 +572,7 @@ function App() { setPlayerInventory(data.data) } }) + .catch((err)=>{/* console.error("Failed to download player inventory data. "+JSON.stringify(err)) */}) } },1000) return ()=>clearInterval(interval) @@ -724,6 +732,7 @@ function App() { .then((data)=>{ setTimeout(downloadData(d,val+1,max),250) }) + .catch((err)=>{/*console.error("Failed to download. "+JSON.stringify(err))*/}) } } @@ -753,6 +762,15 @@ function App() { } + + function updateSearch(val){ + if (val.length>2){ + setMatchedItems(fuzzysort.go(val.trim().toLowerCase(), [...data,...data2,...data3,...data4], {key:'name'})) + } else + if (val.length==0){ + setMatchedItems([]) + } + } return ( @@ -790,24 +808,19 @@ function App() {
- - { - if (f.currentTarget.value.length>2){ - setMatchedItems(fuzzysort.go(f.currentTarget.value.trim().toLowerCase(), [...data,...data2,...data3,...data4], {key:'name'})) - } else - if (f.currentTarget.value.length==0){ - setMatchedItems([]) - } + + { + updateSearch(f.currentTarget.value) }} /> {matchedItems.map((item)=>)}
- - - - + + + + : :nav==="list"?: