-
-
Notifications
You must be signed in to change notification settings - Fork 366
feat: Create Collection Atomic Swap #11410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d670f92
feat: Create Collection Atomic Swap
Jarsen136 8366465
refactor: props
Jarsen136 f637628
feat: Create Collection Atomic Offer
Jarsen136 aa621ec
chore: types
Jarsen136 2b56c08
Merge branch 'main' into issue-11331-0
hassnian 5639864
fix: removable
Jarsen136 b01a876
Merge branch 'issue-11331-0' of github.com:kodadot/nft-gallery into i…
Jarsen136 b1f18bd
Merge branch 'main' into issue-11331-0
preschian 6022d51
Merge pull request #11412 from kodadot/issue-11331-1
Jarsen136 424df7d
Merge branch 'main' into issue-11331-0
vikiival File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,49 @@ | ||
<template> | ||
<NeoButton | ||
variant="secondary" | ||
class="" | ||
@click="onCreateCollectionSwapClick" | ||
> | ||
{{ $t('swap.createCollectionSwap') }} | ||
</NeoButton> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { NeoButton } from '@kodadot1/brick' | ||
import { useCollectionMinimal } from '@/components/collection/utils/useCollectionDetails' | ||
|
||
const route = useRoute() | ||
const { $i18n } = useNuxtApp() | ||
|
||
const collectionId = computed(() => route.params.id.toString()) | ||
const swapStore = useAtomicSwapStore() | ||
const { isCurrentAccount } = useAuth() | ||
|
||
const isCollectionOwner = computed(() => isCurrentAccount(collection.value.currentOwner)) | ||
|
||
const { collection } = useCollectionMinimal({ | ||
collectionId: collectionId, | ||
}) | ||
const { onTradeActionClick } = useTradeActionClick(isCollectionOwner) | ||
|
||
const onCreateCollectionSwapClick = () => { | ||
onTradeActionClick(() => { | ||
const swap = swapStore.createSwap(collectionId.value!, { | ||
isCollectionSwap: true, | ||
desired: [ | ||
{ | ||
id: null, | ||
collectionId: collectionId.value!, | ||
name: $i18n.t('swap.anyNftFromCollection', [collection.value?.name]), | ||
sn: null, | ||
meta: { | ||
image: collection.value?.meta?.image, | ||
}, | ||
}, | ||
], | ||
|
||
}) | ||
navigateToSwap(swap) | ||
}) | ||
} | ||
</script> |
This file contains hidden or 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 hidden or 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 hidden or 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,53 @@ | ||
<template> | ||
<div | ||
class="rounded-full min-w-[236px] h-[62px] md:w-auto border border-k-shade inline-flex justify-start px-2.5" | ||
data-testid="drop-created-by-container" | ||
> | ||
<div class="flex items-center"> | ||
<div | ||
class="rounded-full overflow-hidden bg-background-color border" | ||
:style="{ | ||
width: `${imageSize}px`, | ||
height: `${imageSize}px`, | ||
padding: `${Math.round(imageSize / 16)}px`, | ||
}" | ||
> | ||
<BaseMediaItem | ||
:src="sanitizeIpfsUrl(collection.meta?.image)" | ||
:image-component="NuxtImg" | ||
:sizes="`${imageSize}px`" | ||
title="User Avatar" | ||
class="object-cover overflow-hidden rounded-full h-full w-full !shadow-none" | ||
inner-class="object-cover" | ||
/> | ||
Jarsen136 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</div> | ||
<div class="ml-3.5"> | ||
<NuxtLink :to="`/${urlPrefix}/collection/${collectionId}`"> | ||
{{ collection.name }} | ||
</NuxtLink> | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { useCollectionMinimal } from '@/components/collection/utils/useCollectionDetails' | ||
import { sanitizeIpfsUrl } from '@/utils/ipfs' | ||
|
||
const NuxtImg = resolveComponent('NuxtImg') | ||
|
||
const props = withDefaults( | ||
defineProps<{ | ||
collectionId: string | ||
imageSize?: number | ||
}>(), | ||
{ | ||
imageSize: 48, | ||
}, | ||
) | ||
|
||
const { urlPrefix } = usePrefix() | ||
const { collection } = useCollectionMinimal({ | ||
collectionId: computed(() => props.collectionId), | ||
}) | ||
Jarsen136 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</script> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.