Add extra/subaura filter to Search
* Adds subaura or extra key automatically * Doesn't show "Recently used" weapons or summons if selecting an extra or subaura slot
This commit is contained in:
parent
15730918be
commit
0e586f4f78
1 changed files with 19 additions and 1 deletions
|
|
@ -151,9 +151,22 @@ const SearchModal = (props: Props) => {
|
|||
openChange()
|
||||
}
|
||||
|
||||
const extraPositions = () => {
|
||||
if (props.object === 'weapons') return [9, 10, 11]
|
||||
else if (props.object === 'summons') return [4, 5]
|
||||
else return []
|
||||
}
|
||||
|
||||
function receiveFilters(filters: { [key: string]: any }) {
|
||||
setCurrentPage(1)
|
||||
setResults([])
|
||||
|
||||
// Only show extra or subaura objects if invoked from those positions
|
||||
if (extraPositions().includes(props.fromPosition)) {
|
||||
if (props.object === 'weapons') filters.extra = true
|
||||
else if (props.object === 'summons') filters.subaura = true
|
||||
}
|
||||
|
||||
setFilters(filters)
|
||||
}
|
||||
|
||||
|
|
@ -175,7 +188,12 @@ const SearchModal = (props: Props) => {
|
|||
: []
|
||||
|
||||
if (open) {
|
||||
if (firstLoad && cookieObj && cookieObj.length > 0) {
|
||||
if (
|
||||
firstLoad &&
|
||||
cookieObj &&
|
||||
cookieObj.length > 0 &&
|
||||
!extraPositions().includes(props.fromPosition)
|
||||
) {
|
||||
setResults(cookieObj)
|
||||
setRecordCount(cookieObj.length)
|
||||
setFirstLoad(false)
|
||||
|
|
|
|||
Loading…
Reference in a new issue