Skip to content

Commit

Permalink
Merge branch 'main' into neotabs-tailwindcss
Browse files Browse the repository at this point in the history
  • Loading branch information
roiLeo authored Dec 11, 2023
2 parents 185b983 + e1879ef commit 4913904
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 9 deletions.
9 changes: 9 additions & 0 deletions components/collection/CollectionInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
<IdentityIndex ref="identity" :address="address" show-clipboard />
</nuxt-link>
</div>
<div v-if="recipient" class="is-flex mb-2">
<div class="mr-2 is-capitalized">{{ $t('royalty') }}</div>
<nuxt-link :to="`/${urlPrefix}/u/${recipient}`" class="has-text-link">
<IdentityIndex ref="identity" :address="recipient" show-clipboard />
</nuxt-link>
&nbsp;({{ royalty }}%)
</div>
<div class="overflow-wrap">
<Markdown
:source="visibleDescription"
Expand Down Expand Up @@ -83,6 +90,8 @@ const chain = computed(
?.text,
)
const address = computed(() => collectionInfo.value?.currentOwner)
const recipient = computed(() => collectionInfo.value?.recipient)
const royalty = computed(() => collectionInfo.value?.royalty)
const seeAllDescription = ref(false)
const DESCRIPTION_MAX_LENGTH = 210
Expand Down
6 changes: 5 additions & 1 deletion components/collection/utils/useCollectionDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ export function useCollectionSoldData({ address, collectionId }) {
}

export const useCollectionMinimal = ({ collectionId }) => {
const { urlPrefix } = usePrefix()
const { isAssetHub } = useIsChain(urlPrefix)
const collection = ref()
const { data } = useGraphql({
queryName: 'collectionByIdMinimal',
queryName: isAssetHub.value
? 'collectionByIdMinimalWithRoyalty'
: 'collectionByIdMinimal',
variables: {
id: collectionId,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<p v-if="Number(props.row.meta)">
{{ formatPrice(props.row.meta)[0] }}
<span class="has-text-grey">
(${{ formatPrice(props.row.meta)[1] }})</span
${{ formatPrice(props.row.meta)[1] }}</span
>
</p>
</NeoTableColumn>
Expand Down
16 changes: 9 additions & 7 deletions libs/ui/src/components/MediaItem/type/ImageMedia.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
:image-component-props="imageComponentProps"
:src="src"
:alt="alt"
class="block rounded-none"
:class="{
'object-cover absolute inset-0 w-full h-full':
!original && !isFullscreen,
}"
:class="className"
data-testid="type-image"
@error.once="() => onError('error-1')" />
<!-- if fail, try to load original url -->
Expand All @@ -24,15 +20,15 @@
v-if="status === 'error-1'"
:src="src"
:alt="alt"
class="is-block image-media__image no-border-radius"
:class="className"
data-testid="type-image"
@error.once="() => onError('error-2')" />
<!-- else, load placeholder -->
<img
v-if="status === 'error-2'"
:src="placeholder"
:alt="alt"
class="is-block image-media__image no-border-radius"
:class="className"
data-testid="type-image" />
</figure>
</template>
Expand Down Expand Up @@ -73,6 +69,12 @@ type Status = 'ok' | 'error-1' | 'error-2'
const status = ref<Status>('ok')
const isGif = computed(() => props.mimeType === 'image/gif')
const className = computed(() =>
!props.original && !props.isFullscreen
? 'object-cover absolute inset-0 w-full h-full'
: 'block rounded-none',
)
const toOriginalContentUrl = (baseurl: string) => {
const url = new URL(baseurl)
url.searchParams.append('original', 'true')
Expand Down
21 changes: 21 additions & 0 deletions queries/subsquid/general/collectionByIdMinimalWithRoyalty.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
query collectionByIdMinimalWithRoyalty($id: String!) {
collectionEntityById(id: $id) {
id
issuer
royalty
recipient
meta {
animationUrl
description
id
image
name
type
}
nftCount
max
metadata
name
currentOwner
}
}

0 comments on commit 4913904

Please sign in to comment.