|
|
@ -53,16 +53,25 @@ const ogcdOverrides = new Set([ |
|
|
|
114 //bard MB
|
|
|
|
114 //bard MB
|
|
|
|
]) |
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const actionMap = new Map() |
|
|
|
|
|
|
|
|
|
|
|
export default function Action({ actionId, additionalClasses }) { |
|
|
|
export default function Action({ actionId, additionalClasses }) { |
|
|
|
const [apiData, setApiData] = React.useState() |
|
|
|
const [apiData, setApiData] = React.useState() |
|
|
|
|
|
|
|
|
|
|
|
React.useEffect(() => { |
|
|
|
React.useEffect(() => { |
|
|
|
|
|
|
|
const mapData = actionMap.get(actionId) |
|
|
|
|
|
|
|
if (mapData != null) { |
|
|
|
|
|
|
|
setApiData(mapData) |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let current = true |
|
|
|
let current = true |
|
|
|
void (async () => { |
|
|
|
void (async () => { |
|
|
|
const data = await (await fetch(`https://xivapi.com/Action/${actionId}`, { |
|
|
|
const data = await (await fetch(`https://xivapi.com/Action/${actionId}?colums=Icon,Name,ActionCategoryTargetID`, { |
|
|
|
mode: "cors" |
|
|
|
mode: "cors" |
|
|
|
})).json() |
|
|
|
})).json() |
|
|
|
if (current) { |
|
|
|
if (current) { |
|
|
|
|
|
|
|
actionMap.set(actionId, data) |
|
|
|
setApiData(data) |
|
|
|
setApiData(data) |
|
|
|
} |
|
|
|
} |
|
|
|
})() |
|
|
|
})() |
|
|
@ -80,7 +89,7 @@ export default function Action({ actionId, additionalClasses }) { |
|
|
|
<img |
|
|
|
<img |
|
|
|
className={ |
|
|
|
className={ |
|
|
|
gcdOverrides.has(actionId) || |
|
|
|
gcdOverrides.has(actionId) || |
|
|
|
(!ogcdOverrides.has(actionId) && apiData.ActionCategory.ID !== 4) |
|
|
|
(!ogcdOverrides.has(actionId) && apiData.ActionCategoryTargetID !== 4) |
|
|
|
? `gcd ${additionalClasses}` |
|
|
|
? `gcd ${additionalClasses}` |
|
|
|
: `ogcd ${additionalClasses}` |
|
|
|
: `ogcd ${additionalClasses}` |
|
|
|
} |
|
|
|
} |
|
|
|