Skip to content

Commit

Permalink
fix(swaps): isItemSelected computed
Browse files Browse the repository at this point in the history
  • Loading branch information
hassnian committed Nov 14, 2024
1 parent bbf5219 commit e09b5a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/items/ItemsGrid/useAtomicSwapAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ import { SwapStep } from '@/components/swap/types'
export default (nft: NFTWithMetadata) => {
const route = useRoute()
const swapStore = useAtomicSwapStore()
const { step, stepItems } = storeToRefs(swapStore)
const { swap, step, stepItems } = storeToRefs(swapStore)

const routeName = computed(() => route.name?.toString() as string)

const showAtomicSwapAction = computed(() => ATOMIC_SWAP_PAGES.includes(routeName.value))

const isItemSelected = computed(() => {
return step.value === SwapStep.REVIEW ? false : stepItems.value?.some(item => item.id === nft.id)
return step.value === SwapStep.REVIEW
? false
: [...swap.value.desired, ...swap.value.offered].flat().some(item => item.id === nft.id)
})

const onAtomicSwapSelect = () => {
Expand Down

0 comments on commit e09b5a5

Please sign in to comment.