Skip to content

Commit

Permalink
👽️ Support iscn author as object
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Dec 17, 2024
1 parent 9c2387d commit f3478c3
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 28 deletions.
10 changes: 5 additions & 5 deletions src/components/NFTBook/ItemCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Label
class="text-medium-gray mt-[6px] mb-[12px]"
preset="p6"
:text="(iscnWorkAuthor || creatorDisplayName) | ellipsis"
:text="(iscnWorkAuthorName || creatorDisplayName) | ellipsis"
/>
<Label
v-if="nftBookAvailablePriceLabel"
Expand Down Expand Up @@ -157,22 +157,22 @@
</p>
<NFTBookSpecTable class="mt-[12px]">
<li
v-if="iscnWorkAuthor"
v-if="iscnWorkAuthorName"
class="flex flex-col justify-center min-w-0"
>
<NuxtLink
class="group"
:to="
localeLocation({
name: 'store',
query: { q: iscnWorkAuthor },
query: { q: iscnWorkAuthorName },
})
"
>
<NFTBookSpecTableLabel :text="$t('identity_type_author')" />
<NFTBookSpecTableValue
class="group-hover:underline"
:text="iscnWorkAuthor"
:text="iscnWorkAuthorName"
:preset="preset"
/>
</NuxtLink>
Expand Down Expand Up @@ -213,7 +213,7 @@
<NFTBookSpecTableLabel
:text="
$t(
iscnWorkAuthor
iscnWorkAuthorName
? iscnWorkPublisher
? 'identity_type_distributor'
: 'identity_type_publisher'
Expand Down
6 changes: 3 additions & 3 deletions src/components/NFTBook/ItemCardV2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@

<div class="text-[#8B8B8B] text-[0.875rem] laptop:text-[1rem]">
<NuxtLink
v-if="iscnWorkAuthor"
v-if="iscnWorkAuthorName"
:to="
localeLocation({
name: 'store',
query: {
q: iscnWorkAuthor,
q: iscnWorkAuthorName,
ll_medium: linkMedium,
},
})
"
>
{{ iscnWorkAuthor | ellipsis }}
{{ iscnWorkAuthorName | ellipsis }}
</NuxtLink>
<NuxtLink
v-else
Expand Down
6 changes: 3 additions & 3 deletions src/components/NFTPage/PreviewCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@
</NuxtLink>

<div
v-if="iscnWorkAuthor"
v-if="iscnWorkAuthorName"
class="my-[1rem] flex flex-col items-center text-center min-w-0 w-full"
>
<span class="text-like-cyan-gray text-10">{{
$t('identity_type_author')
}}</span>
<span class="w-full truncate text-dark-gray">{{
iscnWorkAuthor
iscnWorkAuthorName
}}</span>
</div>
</div>
Expand Down Expand Up @@ -199,7 +199,7 @@ export default {
type: String,
default: undefined,
},
iscnWorkAuthor: {
iscnWorkAuthorName: {
type: String,
default: undefined,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/NFTPage/Recommendation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export default {
if (this.type === NFT_TYPE.COLLECTION) {
return true;
}
return !!this.iscnWorkAuthor;
return !!this.iscnWorkAuthorName;
},
defaultFeaturedWNFT() {
return DEFAULT_RECOMMENDATIONS_LIST.WNFT.map(nft => ({
Expand Down
12 changes: 10 additions & 2 deletions src/mixins/nft.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ export default {
);
},
iscnWorkAuthor() {
return this.iscnData?.contentMetadata?.author?.trim();
return this.iscnData?.contentMetadata?.author;
},
iscnWorkAuthorName() {
if (typeof this.iscnWorkAuthor === 'string') {
return this.iscnWorkAuthor.trim();
}
return this.iscnWorkAuthor?.name?.trim();
},
iscnWorkPublisher() {
return this.iscnData?.contentMetadata?.publisher?.trim();
Expand Down Expand Up @@ -690,7 +696,9 @@ export default {
},
nftSignImageAuthor() {
const customAuthor = NFT_BOOK_WITH_SIGN_IMAGE_SET.get(this.classId);
return customAuthor || this.iscnWorkAuthor || this.creatorDisplayNameFull;
return (
customAuthor || this.iscnWorkAuthorName || this.creatorDisplayNameFull
);
},
},
watch: {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/nft/claim/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@
'gap-[12px]',
]"
>
<div v-if="iscnWorkAuthor" class="flex flex-col w-full">
<div v-if="iscnWorkAuthorName" class="flex flex-col w-full">
<Label
preset="h6"
:text="$t('nft_claim_NFT_author')"
class=" text-medium-gray font-[500]"
/>
<p class="text-[16px] font-[500] w-full break-words">
{{ iscnWorkAuthor }}
{{ iscnWorkAuthorName }}
</p>
</div>
<div v-if="iscnWorkPublisher" class="flex flex-col w-full">
Expand Down
6 changes: 3 additions & 3 deletions src/pages/nft/class/_classId/_nftId.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
:avatar-size="40"
:is-avatar-outlined="isCreatorCivicLiker"
:iscn-owner="iscnOwner"
:iscn-work-author="iscnWorkAuthor"
:iscn-work-author-name="iscnWorkAuthorName"
:iscn-url="iscnURL"
:display-name="creatorDisplayNameFull"
:class-id="classId"
Expand Down Expand Up @@ -422,8 +422,8 @@ export default {
head() {
let title =
this.nftName || this.NFTName || this.$t('nft_details_page_title');
if (this.iscnWorkAuthor) {
title += ` - ${this.iscnWorkAuthor}`;
if (this.iscnWorkAuthorName) {
title += ` - ${this.iscnWorkAuthorName}`;
}
if (this.nftIsNFTBook) {
title += ` - ${this.$t('nft_details_page_title_book')}`;
Expand Down
14 changes: 7 additions & 7 deletions src/pages/nft/class/_classId/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@
:is-avatar-outlined="isCreatorCivicLiker"
:is-nft-book="nftIsNFTBook"
:iscn-owner="iscnOwner"
:iscn-work-author="iscnWorkAuthor"
:iscn-work-author-name="iscnWorkAuthorName"
:iscn-url="iscnURL"
:display-name="creatorDisplayNameFull"
:class-id="classId"
Expand Down Expand Up @@ -540,8 +540,8 @@ export default {
},
head() {
let title = this.NFTName || this.$t('nft_details_page_title');
if (this.iscnWorkAuthor) {
title += ` - ${this.iscnWorkAuthor}`;
if (this.iscnWorkAuthorName) {
title += ` - ${this.iscnWorkAuthorName}`;
}
if (this.nftIsNFTBook) {
title += ` - ${this.$t('nft_details_page_title_book')}`;
Expand Down Expand Up @@ -813,8 +813,8 @@ export default {
let titleWithEdition =
this.NFTName || this.$t('nft_details_page_title');
titleWithEdition += ` - ${e.name}`;
if (this.iscnWorkAuthor) {
titleWithEdition += ` - ${this.iscnWorkAuthor}`;
if (this.iscnWorkAuthorName) {
titleWithEdition += ` - ${this.iscnWorkAuthorName}`;
}
titleWithEdition += ` - ${this.$t('nft_details_page_title_book')}`;
meta.find(m => m.hid === 'og:title').content = titleWithEdition;
Expand All @@ -826,11 +826,11 @@ export default {
content: this.iscnData?.contentMetadata?.isbn,
});
}
if (this.iscnWorkAuthor) {
if (this.iscnWorkAuthorName) {
meta.push({
hid: 'product:custom_label_1',
property: 'product:custom_label_1',
content: this.iscnWorkAuthor,
content: this.iscnWorkAuthorName,
});
}
if (this.iscnData?.contentMetadata?.inLanguage) {
Expand Down
4 changes: 2 additions & 2 deletions src/pages/nft/gift/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
<NFTBookCoverWithFrame :src="productImageUrl" />
<Label class="text-[28px] font-600" :text="productTitle" />
<div class="grid grid-cols-2">
<div v-if="iscnWorkAuthor" class="flex flex-col">
<div v-if="iscnWorkAuthorName" class="flex flex-col">
<Label
preset="h6"
:text="$t('nft_claim_NFT_author')"
class=" text-medium-gray"
/>
<Label preset="h5" :text="iscnWorkAuthor" />
<Label preset="h5" :text="iscnWorkAuthorName" />
</div>
<div v-if="iscnWorkPublisher" class="flex flex-col w-full">
<Label
Expand Down

0 comments on commit f3478c3

Please sign in to comment.