refactor: remove unused isSellMode, setIsSellMode in useSellAsset (#5236)
* refactor: remove unused isSellMode, setIsSellMode in useSellAsset * rm
This commit is contained in:
parent
ef9a59a96b
commit
be7e808fff
@ -68,12 +68,10 @@ const ScrollingIndicator = ({ top, show }: SeparatorProps) => (
|
|||||||
const Bag = () => {
|
const Bag = () => {
|
||||||
const { account, provider } = useWeb3React()
|
const { account, provider } = useWeb3React()
|
||||||
|
|
||||||
const { resetSellAssets, sellAssets, setIsSellMode } = useSellAsset(
|
const { resetSellAssets, sellAssets } = useSellAsset(
|
||||||
({ isSellMode, reset, sellAssets, setIsSellMode }) => ({
|
({ reset, sellAssets }) => ({
|
||||||
isSellMode,
|
|
||||||
resetSellAssets: reset,
|
resetSellAssets: reset,
|
||||||
sellAssets,
|
sellAssets,
|
||||||
setIsSellMode,
|
|
||||||
}),
|
}),
|
||||||
shallow
|
shallow
|
||||||
)
|
)
|
||||||
@ -164,9 +162,8 @@ const Bag = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleCloseBag = useCallback(() => {
|
const handleCloseBag = useCallback(() => {
|
||||||
setIsSellMode(false)
|
|
||||||
setBagExpanded({ bagExpanded: false, manualClose: true })
|
setBagExpanded({ bagExpanded: false, manualClose: true })
|
||||||
}, [setBagExpanded, setIsSellMode])
|
}, [setBagExpanded])
|
||||||
|
|
||||||
const fetchAssets = async () => {
|
const fetchAssets = async () => {
|
||||||
const itemsToBuy = itemsInBag.filter((item) => item.status !== BagItemStatus.UNAVAILABLE).map((item) => item.asset)
|
const itemsToBuy = itemsInBag.filter((item) => item.status !== BagItemStatus.UNAVAILABLE).map((item) => item.asset)
|
||||||
|
@ -4,7 +4,6 @@ import { devtools } from 'zustand/middleware'
|
|||||||
import { ListingMarket, ListingWarning, WalletAsset } from '../types'
|
import { ListingMarket, ListingWarning, WalletAsset } from '../types'
|
||||||
|
|
||||||
interface SellAssetState {
|
interface SellAssetState {
|
||||||
isSellMode: boolean
|
|
||||||
sellAssets: WalletAsset[]
|
sellAssets: WalletAsset[]
|
||||||
selectSellAsset: (asset: WalletAsset) => void
|
selectSellAsset: (asset: WalletAsset) => void
|
||||||
removeSellAsset: (asset: WalletAsset) => void
|
removeSellAsset: (asset: WalletAsset) => void
|
||||||
@ -12,7 +11,6 @@ interface SellAssetState {
|
|||||||
setGlobalExpiration: (expirationTime: number) => void
|
setGlobalExpiration: (expirationTime: number) => void
|
||||||
setAssetListPrice: (asset: WalletAsset, price?: number, marketplace?: ListingMarket) => void
|
setAssetListPrice: (asset: WalletAsset, price?: number, marketplace?: ListingMarket) => void
|
||||||
setGlobalMarketplaces: (marketplaces: ListingMarket[]) => void
|
setGlobalMarketplaces: (marketplaces: ListingMarket[]) => void
|
||||||
setIsSellMode: (b: boolean) => void
|
|
||||||
removeAssetMarketplace: (asset: WalletAsset, marketplace: ListingMarket) => void
|
removeAssetMarketplace: (asset: WalletAsset, marketplace: ListingMarket) => void
|
||||||
addMarketplaceWarning: (asset: WalletAsset, warning: ListingWarning) => void
|
addMarketplaceWarning: (asset: WalletAsset, warning: ListingWarning) => void
|
||||||
removeMarketplaceWarning: (asset: WalletAsset, warning: ListingWarning, setGlobalOverride?: boolean) => void
|
removeMarketplaceWarning: (asset: WalletAsset, warning: ListingWarning, setGlobalOverride?: boolean) => void
|
||||||
@ -22,7 +20,6 @@ interface SellAssetState {
|
|||||||
export const useSellAsset = create<SellAssetState>()(
|
export const useSellAsset = create<SellAssetState>()(
|
||||||
devtools(
|
devtools(
|
||||||
(set) => ({
|
(set) => ({
|
||||||
isSellMode: false,
|
|
||||||
sellAssets: [],
|
sellAssets: [],
|
||||||
selectSellAsset: (asset) =>
|
selectSellAsset: (asset) =>
|
||||||
set(({ sellAssets }) => {
|
set(({ sellAssets }) => {
|
||||||
@ -98,7 +95,6 @@ export const useSellAsset = create<SellAssetState>()(
|
|||||||
return { sellAssets: assetsCopy }
|
return { sellAssets: assetsCopy }
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setIsSellMode: (isSellMode) => set(() => ({ isSellMode })),
|
|
||||||
removeAssetMarketplace: (asset, marketplace) => {
|
removeAssetMarketplace: (asset, marketplace) => {
|
||||||
set(({ sellAssets }) => {
|
set(({ sellAssets }) => {
|
||||||
const assetsCopy = [...sellAssets]
|
const assetsCopy = [...sellAssets]
|
||||||
|
Loading…
Reference in New Issue
Block a user