Skip to content

Commit

Permalink
Update var naming
Browse files Browse the repository at this point in the history
  • Loading branch information
bigboydiamonds committed Feb 2, 2024
1 parent c3cb1c1 commit c279906
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions packages/widget/src/components/ui/TokenPopoverSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ export const TokenPopoverSelect = ({

const {
filterValue,
setFilterValue,
filteredSortedOptionsWithBalances,
filteredSortedRemainingWithBalances,
filteredOptions: filteredSortedOptionsWithBalances,
filteredRemaining: filteredSortedRemainingWithBalances,
noFilteredResults,
TokenInputFilter,
} = useTokenInputFilter(
Expand Down Expand Up @@ -240,15 +239,15 @@ const TokenOption = ({
const useTokenInputFilter = (
options: TokenBalance[],
remaining: TokenBalance[],
isOpen: boolean
isActive: boolean
) => {
const [filterValue, setFilterValue] = useState('')

useEffect(() => {
if (!isOpen) {
if (!isActive) {
setFilterValue('')
}
}, [isOpen])
}, [isActive])

const filterTokens = (tokens: TokenBalance[], filter: string) => {
const lowerFilter = filter.toLowerCase()
Expand All @@ -258,14 +257,11 @@ const useTokenInputFilter = (
})
}

const filteredSortedOptionsWithBalances = filterTokens(options, filterValue)
const filteredSortedRemainingWithBalances = filterTokens(
remaining,
filterValue
)
const filteredOptions = filterTokens(options, filterValue)
const filteredRemaining = filterTokens(remaining, filterValue)

const noFilteredOptions = _.isEmpty(filteredSortedOptionsWithBalances)
const noFilteredRemaining = _.isEmpty(filteredSortedRemainingWithBalances)
const noFilteredOptions = _.isEmpty(filteredOptions)
const noFilteredRemaining = _.isEmpty(filteredRemaining)
const noFilteredResults = noFilteredOptions && noFilteredRemaining

const TokenInputFilter = () => {
Expand All @@ -281,8 +277,8 @@ const useTokenInputFilter = (
return {
filterValue,
setFilterValue,
filteredSortedOptionsWithBalances,
filteredSortedRemainingWithBalances,
filteredOptions,
filteredRemaining,
noFilteredResults,
TokenInputFilter,
}
Expand Down

0 comments on commit c279906

Please sign in to comment.