fix order filtering for market

This commit is contained in:
saml33 2024-01-08 14:00:05 +11:00
parent 5c9953fa0d
commit 6456b41196
3 changed files with 8 additions and 3 deletions

View File

@ -3,16 +3,19 @@ import TabsText from '@components/shared/TabsText'
import SwapOrders from '@components/swap/SwapTriggerOrders'
import OpenOrders from '@components/trade/OpenOrders'
import mangoStore from '@store/mangoStore'
import useLocalStorageState from 'hooks/useLocalStorageState'
import useMangoAccount from 'hooks/useMangoAccount'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { FILTER_ORDERS_FOR_MARKET_KEY } from 'utils/constants'
const AccountOrders = () => {
const { t } = useTranslation('trade')
const { mangoAccount } = useMangoAccount()
const openOrders = mangoStore((s) => s.mangoAccount.openOrders)
const [activeTab, setActiveTab] = useState('trade:limit')
const [filterForCurrentMarket, setFilterForCurrentMarket] = useState(false)
const [filterForCurrentMarket, setFilterForCurrentMarket] =
useLocalStorageState(FILTER_ORDERS_FOR_MARKET_KEY, false)
const tabsWithCount: [string, number][] = useMemo(() => {
const stopOrdersCount =
@ -27,7 +30,7 @@ const AccountOrders = () => {
return (
<>
<div className="flex items-center justify-between px-4 py-4 md:px-6">
<div className="flex items-center justify-between p-4 md:px-6">
<TabsText
activeTab={activeTab}
onChange={setActiveTab}

View File

@ -369,7 +369,7 @@ const OpenOrders = ({
})
return formatted
}, [filterForCurrentMarket, openOrders])
}, [filledOrders, filterForCurrentMarket, openOrders, selectedMarket])
const {
items: tableData,

View File

@ -85,6 +85,8 @@ export const NEW_LISTING_BANNER_KEY = 'new-listing-banner-0.2'
export const NON_RESTRICTED_JURISDICTION_KEY = 'non-restricted-jurisdiction-0.1'
export const FILTER_ORDERS_FOR_MARKET_KEY = 'filterOrdersForMarket-0.1'
// Unused
export const PROFILE_CATEGORIES = [
'borrower',