Skip to content
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

fix multi recipient royalties on Details Tab #7013

Merged
merged 4 commits into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 53 additions & 8 deletions components/gallery/GalleryItemDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,34 @@
</div>

<div
v-if="nft?.recipient"
class="is-flex is-justify-content-space-between">
<p>{{ $t('transfers.recipient') }}</p>
<nuxt-link
:to="`/${urlPrefix}/u/${nft?.recipient}`"
class="has-text-link">
<Identity ref="identity" :address="nft?.recipient" />
</nuxt-link>
v-if="recipient"
class="recipient is-flex is-justify-content-space-between is-capitalized">
<p>{{ $t('transfers.recipients') }}</p>
<template v-if="Array.isArray(recipient) && recipient.length > 1">
<ol>
<li v-for="[addr, percentile] in recipient" :key="addr" class="">
<nuxt-link
:to="`/${urlPrefix}/u/${addr}`"
class="has-text-link is-inline-block">
<Identity ref="identity" :address="addr" />
</nuxt-link>
<span className="is-size-7">({{ percentile }}%)</span>
</li>
</ol>
</template>
<template
v-else-if="Array.isArray(recipient) && recipient.length === 1">
<nuxt-link
:to="`/${urlPrefix}/u/${recipient[0][0]}`"
class="has-text-link">
<Identity ref="identity" :address="recipient[0][0]" />
</nuxt-link>
</template>
<template v-else>
<nuxt-link :to="`/${urlPrefix}/u/${recipient}`" class="has-text-link">
<Identity ref="identity" :address="recipient" />
</nuxt-link>
</template>
</div>

<hr class="my-2" />
Expand Down Expand Up @@ -203,6 +223,16 @@ const isLewd = computed(() => {
)
})

const recipient = computed(() => {
if (nft.value?.recipient) {
try {
return JSON.parse(nft.value?.recipient)
} catch (e) {
return nft.value?.recipient
}
}
})

defineExpose({ isLewd })

const parentNftUrl = computed(() => {
Expand Down Expand Up @@ -257,3 +287,18 @@ const openLink = (link) => {
window.open(toCloudflareIpfsUrl(link), '_blank')
}
</script>

<style lang="scss">
@import '@/styles/abstracts/variables.scss';
.recipient {
li {
gap: 0.3rem;
> span {
font-size: 0.8rem;
@include ktheme() {
color: theme('k-grey');
}
}
}
}
</style>