Skip to content

Commit

Permalink
feat: add popLv property to MRC721 components and update content hand…
Browse files Browse the repository at this point in the history
…ling
  • Loading branch information
AricRedemption committed Jan 6, 2025
1 parent 77170e6 commit 8aaff47
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/lib/mrc721.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface MRC721Item {
outpoint: string
outValue: number
chain: Chain
popLv: number
}

export function getMetaFileUrl(metafile: string) {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/nfts/MRC721Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ const isDescExpanded = ref(false)
<MRC721
:cover="item.cover"
:pop="item.name"
:pop-lv="item.popLv"
:value="item.outValue"
:pop-lv="0"
:content="item.contentString"
:content="item.content"
:content-summary="item.desc"
/>

Expand Down
6 changes: 3 additions & 3 deletions src/pages/nfts/MRC721Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ const getHostAndToTx = async (txId: string) => {
<div class="w-full flex items-center justify-center">
<div class="size-[220px]">
<MRC721
:cover="metaPin.cover"
:pop="metaPin.name"
:cover="metaPin.cover"
:pop-lv="metaPin.popLv"
:value="metaPin.outValue"
:pop-lv="1"
:content="metaPin.contentString"
:content="metaPin.content"
:content-summary="metaPin.desc"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/wallet/components/MetaID/CollectionItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ const coverUrl = computed(() => getMetaFileUrl(props.collection.cover))
class="flex flex-col items-center justify-center cursor-pointer"
>
<MRC721
:popLv="0"
:popLv="item.popLv"
:cover="item.cover"
:pop="item.outpoint"
:value="item.outValue"
:content="item.contentString"
:content="item.content"
:contentSummary="item.desc || item.name"
/>

Expand Down
7 changes: 2 additions & 5 deletions src/pages/wallet/components/MetaID/MRC721.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ const imageSrc = computed(() => {
return getMetaFileUrl(props.cover)
}
if (props.content) {
const metafile = props.content.startsWith('metafile://')
? props.content
: JSON.parse(props.content).attachment[0].content
return getMetaFileUrl(metafile)
return props.content
}
} catch (error) {
console.error('Error getting image URL:', error)
Expand All @@ -35,7 +32,7 @@ const imageSrc = computed(() => {
class="relative w-full aspect-square bg-white rounded-lg overflow-hidden"
:class="{ 'border border-[#f5f5f5]': imageSrc }"
>
<PopCard :level="popLv" class="absolute left-0 top-0 z-10" />
<PopCard :level="popLv" class="absolute left-0 top-0 z-10" v-show="!!popLv" />
<div class="w-full h-full flex items-center justify-center">
<img :src="imageSrc" :alt="contentSummary" class="max-w-full max-h-full object-contain" v-if="imageSrc" />
<div class="line-clamp-6 text-xs break-all px-1.5" v-else>{{ contentSummary }}</div>
Expand Down

0 comments on commit 8aaff47

Please sign in to comment.