|
|
|
@ -152,9 +152,11 @@ function Item(p){ |
|
|
|
|
<img src={"https://xivapi.com"+item.icon} alt={item.name}/> {item.name} <sub className="text-muted" style={{marginLeft:"10px"}}>{itemLoc}</sub> |
|
|
|
|
</Col> |
|
|
|
|
<Col> |
|
|
|
|
<input disabled={lockout} id={"field_"+item.id} style={{width:"5em"}} defaultValue={item.obtained} className="mt-1 bg-secondary" |
|
|
|
|
<input disabled={lockout} name={"field_"+item.id} style={{width:"5em"}} defaultValue={item.obtained} className="mt-1 bg-secondary" |
|
|
|
|
onKeyDown={(k)=>{ |
|
|
|
|
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() { |
|
|
|
|
</Col> |
|
|
|
|
</Row> |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
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 (
|
|
|
|
|
<Container className="bg-dark" fluid> |
|
|
|
@ -790,24 +808,19 @@ function App() { |
|
|
|
|
</Row> |
|
|
|
|
<Row> |
|
|
|
|
<Form> |
|
|
|
|
<Form.Group className="mb-3" controlId="formBasicEmail"> |
|
|
|
|
<Form.Control className="bg-dark text-white" type="text" placeholder="Search Item" onChange={(f)=>{ |
|
|
|
|
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([]) |
|
|
|
|
} |
|
|
|
|
<Form.Group className="mb-3"> |
|
|
|
|
<Form.Control id="searchBar" className="bg-dark text-white" type="text" placeholder="Search Item" onChange={(f)=>{ |
|
|
|
|
updateSearch(f.currentTarget.value) |
|
|
|
|
}} /> |
|
|
|
|
{matchedItems.map((item)=><Item key={item.obj.id} item={item.obj} setLockout={setLockout} lockout={lockout} contributor={contributor} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory}></Item>)} |
|
|
|
|
</Form.Group> |
|
|
|
|
</Form> |
|
|
|
|
</Row> |
|
|
|
|
<Accordion className="bg-dark" defaultActiveKey="0"> |
|
|
|
|
<ItemGroup name="Gathering Items" contributor={contributor} akey="0" data={data} lastModified={lastModified} setLastModified={setLastModified} setData={setData} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory}/> |
|
|
|
|
<ItemGroup name="Other Items" contributor={contributor} akey="1" data={data2} lastModified={lastModified} setLastModified={setLastModified} setData={setData2} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory}/> |
|
|
|
|
<ItemGroup name="Pre-crafting" contributor={contributor} akey="2" data={data3} lastModified={lastModified} setLastModified={setLastModified} setData={setData3} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory}/> |
|
|
|
|
<ItemGroup name="Crafting Items" contributor={contributor} akey="3" data={data4} lastModified={lastModified} setLastModified={setLastModified} setData={setData4} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory}/> |
|
|
|
|
<ItemGroup name="Gathering Items" contributor={contributor} akey="0" data={data} lastModified={lastModified} setLastModified={setLastModified} setData={setData} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory} lockout={lockout} setLockout={setLockout}/> |
|
|
|
|
<ItemGroup name="Other Items" contributor={contributor} akey="1" data={data2} lastModified={lastModified} setLastModified={setLastModified} setData={setData2} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory} lockout={lockout} setLockout={setLockout}/> |
|
|
|
|
<ItemGroup name="Pre-crafting" contributor={contributor} akey="2" data={data3} lastModified={lastModified} setLastModified={setLastModified} setData={setData3} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory} lockout={lockout} setLockout={setLockout}/> |
|
|
|
|
<ItemGroup name="Crafting Items" contributor={contributor} akey="3" data={data4} lastModified={lastModified} setLastModified={setLastModified} setData={setData4} setData1={setData} setData2={setData2} setData3={setData3} setData4={setData4} itemCount={itemCount} totalItemCount={totalItemCount} playerInventory={playerInventory} lockout={lockout} setLockout={setLockout}/> |
|
|
|
|
</Accordion> |
|
|
|
|
</>:<Importer></Importer> |
|
|
|
|
:nav==="list"?<ListApp transferItems={transferItems}></ListApp>: |
|
|
|
|