From 0e586f4f789f1d7eb5cc4dd91043544000de5c38 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sun, 25 Dec 2022 00:54:45 -0800 Subject: [PATCH] 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 --- components/SearchModal/index.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/components/SearchModal/index.tsx b/components/SearchModal/index.tsx index 9b5912de..b7cdebb9 100644 --- a/components/SearchModal/index.tsx +++ b/components/SearchModal/index.tsx @@ -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)