|
|
|
@ -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,7 +424,39 @@ function App() { |
|
|
|
|
|
|
|
|
|
const disabled=true |
|
|
|
|
|
|
|
|
|
function downloadData(d,val,max) { |
|
|
|
|
useEffect(()=>{ |
|
|
|
|
if (update) { |
|
|
|
|
axios.get("https://projectdivar.com:4505/getData") |
|
|
|
|
.then((data)=>{ |
|
|
|
|
//setData(data.data)
|
|
|
|
|
setData(data.data.slice(dataSplitters[0],dataSplitters[1])) |
|
|
|
|
setData2(data.data.slice(dataSplitters[1],dataSplitters[2])) |
|
|
|
|
setData3(data.data.slice(dataSplitters[2],dataSplitters[3])) |
|
|
|
|
setData4(data.data.slice(dataSplitters[3],data.data.length)) |
|
|
|
|
}) |
|
|
|
|
.catch((err)=>{ |
|
|
|
|
console.log(err.message) |
|
|
|
|
setData([ |
|
|
|
|
{id:1726,itemid:2,name:"Fire Shard",icon:"/i/020000/020001.png",obtained:694,required:4124}, |
|
|
|
|
{id:1727,itemid:3,name:"Ice Shard",icon:"/i/020000/020003.png",obtained:0,required:1226}, |
|
|
|
|
{id:1728,itemid:4,name:"Wind Shard",icon:"/i/020000/020004.png",obtained:4719,required:4719}, |
|
|
|
|
{id:1729,itemid:5,name:"Earth Shard",icon:"/i/020000/020006.png",obtained:15,required:1764}, |
|
|
|
|
{id:1730,itemid:6,name:"Lightning Shard",icon:"/i/020000/020005.png",obtained:0,required:2374}, |
|
|
|
|
]) |
|
|
|
|
}) |
|
|
|
|
setUpdate(false) |
|
|
|
|
} |
|
|
|
|
},[update]) |
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
if (succeeded+failed===total) { |
|
|
|
|
setUpdate(true) |
|
|
|
|
} |
|
|
|
|
},[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)=>{ |
|
|
|
@ -463,43 +491,11 @@ function App() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
if (update) { |
|
|
|
|
axios.get("https://projectdivar.com:4505/getData") |
|
|
|
|
.then((data)=>{ |
|
|
|
|
//setData(data.data)
|
|
|
|
|
setData(data.data.slice(dataSplitters[0],dataSplitters[1])) |
|
|
|
|
setData2(data.data.slice(dataSplitters[1],dataSplitters[2])) |
|
|
|
|
setData3(data.data.slice(dataSplitters[2],dataSplitters[3])) |
|
|
|
|
setData4(data.data.slice(dataSplitters[3],data.data.length)) |
|
|
|
|
}) |
|
|
|
|
.catch((err)=>{ |
|
|
|
|
console.log(err.message) |
|
|
|
|
setData([ |
|
|
|
|
{id:1726,itemid:2,name:"Fire Shard",icon:"/i/020000/020001.png",obtained:694,required:4124}, |
|
|
|
|
{id:1727,itemid:3,name:"Ice Shard",icon:"/i/020000/020003.png",obtained:0,required:1226}, |
|
|
|
|
{id:1728,itemid:4,name:"Wind Shard",icon:"/i/020000/020004.png",obtained:4719,required:4719}, |
|
|
|
|
{id:1729,itemid:5,name:"Earth Shard",icon:"/i/020000/020006.png",obtained:15,required:1764}, |
|
|
|
|
{id:1730,itemid:6,name:"Lightning Shard",icon:"/i/020000/020005.png",obtained:0,required:2374}, |
|
|
|
|
]) |
|
|
|
|
}) |
|
|
|
|
setUpdate(false) |
|
|
|
|
} |
|
|
|
|
},[update]) |
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
if (succeeded+failed===total) { |
|
|
|
|
setUpdate(true) |
|
|
|
|
} |
|
|
|
|
},[succeeded,failed]) |
|
|
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
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> |
|
|
|
|