forked from kodadot/nft-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kodadot#11163 from roiLeo/feature/init/swapLanding
✨ swap page landing
- Loading branch information
Showing
51 changed files
with
1,453 additions
and
121 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,5 @@ export type CollectionEntityMinimal = { | |
name: string | ||
currentOwner: string | ||
type: string | ||
ownerCount?: number | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { NFTWithMetadata } from '@/composables/useNft' | ||
import { SwapStep } from '@/components/swap/types' | ||
|
||
export default (nft: NFTWithMetadata) => { | ||
const route = useRoute() | ||
const swapStore = useAtomicSwapStore() | ||
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 | ||
: [...swap.value.desired, ...swap.value.offered].flat().some(item => item.id === nft.id) | ||
}) | ||
|
||
const onAtomicSwapSelect = () => { | ||
if (isItemSelected.value) { | ||
swapStore.removeStepItem(nft.id) | ||
} | ||
else { | ||
swapStore.updateStepItems([ | ||
...stepItems.value, | ||
{ | ||
id: nft.id, | ||
collectionId: nft.collection.id, | ||
sn: nft.sn, | ||
name: nft.name, | ||
meta: nft.meta, | ||
}, | ||
]) | ||
} | ||
} | ||
|
||
return { | ||
onAtomicSwapSelect, | ||
showAtomicSwapAction, | ||
isItemSelected, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.