Skip to content

Commit

Permalink
fix: legacy mrc721 display
Browse files Browse the repository at this point in the history
  • Loading branch information
AricRedemption committed Dec 30, 2024
1 parent 95e4d60 commit c6389b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/lib/mrc721.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ export interface MRC721Item {
}

export function getMetaFileUrl(metafile: string) {
if (metafile.startsWith('/content')) {
return `https://man${network.value === 'testnet' ? '-test' : ''}.metaid.io${metafile}`
}
if (!metafile?.startsWith('metafile://')) return metafile
const fileId = metafile.replace('metafile://', '')
return `https://man${network.value === 'testnet' ? '-test' : ''}.metaid.io/content/${fileId}`
Expand Down
8 changes: 3 additions & 5 deletions src/pages/nfts/MRC721Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const {
const items = computed(() => (itemsData.value ? itemsData.value.pages.flatMap((page) => page.list) : []))
const coverUrl = computed(() => collection.value ? getMetaFileUrl(collection.value.cover) : '')
const coverUrl = computed(() => (collection.value ? getMetaFileUrl(collection.value.cover) : ''))
const handleSelectItem = (itemPinId: string) => {
if (!address.value) return
Expand All @@ -52,9 +52,7 @@ const handleSelectItem = (itemPinId: string) => {
<LoadingText v-if="isLoadingCollection" :text="$t('Common.DataLoading')" />
<template v-else-if="collection">
<div class="flex items-center gap-3">
<div class="w-20 h-20 rounded-full overflow-hidden bg-gray-100">
<img :src="coverUrl" class="w-full h-full object-cover" />
</div>
<img :src="coverUrl" class="object-contain size-20 rounded-lg" />
<div class="space-y-1">
<h1 class="text-xl font-medium">{{ collection.name }}</h1>
<div class="text-sm text-gray-500">{{ collection.desc }}</div>
Expand Down Expand Up @@ -114,4 +112,4 @@ const handleSelectItem = (itemPinId: string) => {
</div>
</template>
</div>
</template>
</template>
6 changes: 2 additions & 4 deletions src/pages/wallet/components/MetaID/CollectionItems.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ const coverUrl = computed(() => getMetaFileUrl(props.collection.cover))
class="flex items-center justify-between cursor-pointer"
>
<div class="flex items-center gap-3">
<div class="w-10 h-10 rounded-full overflow-hidden bg-gray-100">
<img :src="coverUrl" class="w-full h-full object-cover" />
</div>
<img :src="coverUrl" class="object-contain size-10 rounded-md" />
<div>
<h3 class="text-base font-medium">{{ collection.collectionName }}</h3>
<div class="text-sm text-gray-500">{{ collection.totalNum }}</div>
Expand All @@ -70,7 +68,7 @@ const coverUrl = computed(() => getMetaFileUrl(props.collection.cover))
/>

<div class="mt-2 text-center">
<div class="text-base font-medium">{{ item.name || 'Smiling Tiger' }}</div>
<div class="text-base font-medium">{{ item?.name ?? '--' }}</div>
<div class="text-sm text-gray-500">
<span v-if="item.itemPinNumber !== -1"># {{ item.itemPinNumber }}</span>
<span v-else>{{ $t('Common.Unconfirmed') }}</span>
Expand Down

0 comments on commit c6389b5

Please sign in to comment.