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 2 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
65 changes: 57 additions & 8 deletions components/gallery/GalleryItemDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,38 @@
</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">
<template v-if="Array.isArray(recipient) && recipient.length > 1">
<p>{{ $t('transfers.recipients') }}</p>
niklasp marked this conversation as resolved.
Show resolved Hide resolved
<ul>
niklasp marked this conversation as resolved.
Show resolved Hide resolved
<li
v-for="([addr, percentile], idx) in recipient"
:key="addr"
class="is-flex is-flex-direction-row is-justify-content-flex-end is-align-items-center">
{{ idx + 1 }}.
<nuxt-link :to="`/${urlPrefix}/u/${addr}`" class="has-text-link">
<Identity ref="identity" :address="addr" />
</nuxt-link>
<span className="is-size-7">({{ percentile }}%)</span>
</li>
</ul>
</template>
<template
v-else-if="Array.isArray(recipient) && recipient.length === 1">
<p>{{ $t('transfers.recipient') }}</p>
niklasp marked this conversation as resolved.
Show resolved Hide resolved
<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>
<p>{{ $t('transfers.recipient') }}</p>
niklasp marked this conversation as resolved.
Show resolved Hide resolved
niklasp marked this conversation as resolved.
Show resolved Hide resolved
<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 +227,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 +291,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>