From 4fbaa8aed7a345a1190591d551d5c0a08ff7b3b8 Mon Sep 17 00:00:00 2001 From: Bartlomiej Tarczynski Date: Thu, 18 Apr 2024 15:16:49 +0200 Subject: [PATCH] Change useMatchBid to be regular function --- .../frontend/src/components/bids/allBids/AllBidsList.tsx | 4 ++-- .../frontend/src/components/bids/allBids/matchesBidFn.ts | 5 +++++ packages/frontend/src/components/bids/allBids/useMatchBid.ts | 5 ----- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 packages/frontend/src/components/bids/allBids/matchesBidFn.ts delete mode 100644 packages/frontend/src/components/bids/allBids/useMatchBid.ts diff --git a/packages/frontend/src/components/bids/allBids/AllBidsList.tsx b/packages/frontend/src/components/bids/allBids/AllBidsList.tsx index 07bb2731..45a4f4b5 100644 --- a/packages/frontend/src/components/bids/allBids/AllBidsList.tsx +++ b/packages/frontend/src/components/bids/allBids/AllBidsList.tsx @@ -3,7 +3,7 @@ import { getFirstRaffleBidIndex } from '@/utils/getFirstRaffleBidIndex' import { useBids } from '@/providers/BidsProvider' import { NothingFound } from '@/components/bids/allBids/NothingFound' import { BidsListHeaders } from '@/components/bids/BidsListHeaders' -import { useMatchBid } from '@/components/bids/allBids/useMatchBid' +import { matchesBidFn } from '@/components/bids/allBids/matchesBidFn' import { BidsSubList } from '@/components/bids/allBids/BidsSubList' interface AllBidsListProps { @@ -14,8 +14,8 @@ interface AllBidsListProps { export const AllBidsList = ({ search, auctionWinnersCount, raffleWinnersCount }: AllBidsListProps) => { const { bidList } = useBids() - const matchesSearch = useMatchBid(search) + const matchesSearch = matchesBidFn(search) const firstRaffleBidIndex = getFirstRaffleBidIndex(bidList.length, auctionWinnersCount, raffleWinnersCount) const bids = useMemo(() => { diff --git a/packages/frontend/src/components/bids/allBids/matchesBidFn.ts b/packages/frontend/src/components/bids/allBids/matchesBidFn.ts new file mode 100644 index 00000000..39ccce30 --- /dev/null +++ b/packages/frontend/src/components/bids/allBids/matchesBidFn.ts @@ -0,0 +1,5 @@ +import { Bid } from '@/types/bid' + +export const matchesBidFn = (value: string) => { + return (bid: Bid) => (value ? bid.address.toLowerCase().includes(value.toLowerCase()) : true) +} diff --git a/packages/frontend/src/components/bids/allBids/useMatchBid.ts b/packages/frontend/src/components/bids/allBids/useMatchBid.ts deleted file mode 100644 index 1fa7c016..00000000 --- a/packages/frontend/src/components/bids/allBids/useMatchBid.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { useCallback } from 'react' -import { Bid } from '@/types/bid' - -export const useMatchBid = (value: string) => - useCallback((bid: Bid) => (value ? bid.address.toLowerCase().includes(value.toLowerCase()) : true), [value])