From a386b79175dc2cdfabf26653da5ed788e51ccfcd Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Mon, 23 Dec 2024 20:08:09 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E2=9C=A8=20Add=20=20for?= =?UTF-8?q?=20buyer=20message=20animation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ScrollingList.vue | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 src/components/ScrollingList.vue diff --git a/src/components/ScrollingList.vue b/src/components/ScrollingList.vue new file mode 100644 index 000000000..b4c343ced --- /dev/null +++ b/src/components/ScrollingList.vue @@ -0,0 +1,51 @@ + + + + From 8bef8cd13255e942e0ae2d8ac1ec1207381e5c06 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Tue, 24 Dec 2024 10:08:04 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=F0=9F=92=84Init=20collectorMessageList=20U?= =?UTF-8?q?I=20on=20class=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../collector-message-item-background.svg | 16 ++ .../NFTPage/CollectorMessageList/index.vue | 59 ++++++++ src/locales/en.json | 2 + src/locales/zh-Hant.json | 2 + src/pages/nft/class/_classId/index.vue | 143 +++++++++++++++--- 5 files changed, 203 insertions(+), 19 deletions(-) create mode 100644 src/assets/images/nft/books/collector-message-item-background.svg create mode 100644 src/components/NFTPage/CollectorMessageList/index.vue diff --git a/src/assets/images/nft/books/collector-message-item-background.svg b/src/assets/images/nft/books/collector-message-item-background.svg new file mode 100644 index 000000000..ac89e9b0f --- /dev/null +++ b/src/assets/images/nft/books/collector-message-item-background.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/NFTPage/CollectorMessageList/index.vue b/src/components/NFTPage/CollectorMessageList/index.vue new file mode 100644 index 000000000..494cdb8be --- /dev/null +++ b/src/components/NFTPage/CollectorMessageList/index.vue @@ -0,0 +1,59 @@ + + diff --git a/src/locales/en.json b/src/locales/en.json index 8ac634eb8..748082504 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -622,6 +622,8 @@ "nft_collect_modal_subtitle_select_collect_method": "Select a collect method", "nft_collect_modal_title_collect": "Collect NFT", "nft_collect_modal_title_collecting": "Collecting NFT", + "nft_collector_message_label": "Collector's message", + "nft_collector_message_view_all": "View all", "nft_collection_content_label": "Content in this collection", "nft_collection_hint": "This book is part of a collection", "nft_collection_label": "Collection", diff --git a/src/locales/zh-Hant.json b/src/locales/zh-Hant.json index e51787675..2e9a69a1e 100644 --- a/src/locales/zh-Hant.json +++ b/src/locales/zh-Hant.json @@ -622,6 +622,8 @@ "nft_collect_modal_subtitle_select_collect_method": "請選擇收藏方法", "nft_collect_modal_title_collect": "收藏作品", "nft_collect_modal_title_collecting": "正在收藏作品", + "nft_collector_message_label": "收藏者的留言", + "nft_collector_message_view_all": "顯示全部", "nft_collection_content_label": "套裝內容", "nft_collection_hint": "此本書收錄在套裝中", "nft_collection_label": "組合套裝", diff --git a/src/pages/nft/class/_classId/index.vue b/src/pages/nft/class/_classId/index.vue index e8bc0888a..8fa3c1981 100644 --- a/src/pages/nft/class/_classId/index.vue +++ b/src/pages/nft/class/_classId/index.vue @@ -1,5 +1,5 @@
+ + @@ -479,6 +508,10 @@ export default { customPrice: 0, isOpeningCheckoutPage: false, + + isHistoryInfoLoading: false, + isFinishedLoadingHistory: false, + isOpeningCollectorListDialog: false, }; }, async fetch({ route, store, redirect, error, localeLocation }) { @@ -936,6 +969,7 @@ export default { shouldShowFollowButton() { return Boolean(this.iscnOwner !== this.getAddress); }, + // for WNFT populatedCollectorsWithMemo() { if (!this.populatedDisplayEvents) { return this.populatedCollectors; @@ -967,6 +1001,7 @@ export default { } return collectorsWithMemo; }, + // for collector dialog populatedBuyerWithMessage() { if (!this.populatedDisplayEvents) { return this.populatedCollectors; @@ -1001,6 +1036,62 @@ export default { } return collectorsWithBuyerMessages; }, + // for collector message list + filterCollectorsWithReplies() { + if (!this.populatedDisplayEvents || !this.populatedCollectors) { + return []; + } + const collectorsWithReplies = this.populatedCollectors + .map(collector => { + const purchaseEvent = this.populatedDisplayEvents.find( + event => + event.event === 'purchase' && event.toWallet === collector.id + ); + + const transferEvent = this.populatedDisplayEvents.find( + event => + event.event === 'transfer' && event.toWallet === collector.id + ); + + let buyerMessage = null; + let authorReply = null; + + if (purchaseEvent) { + buyerMessage = purchaseEvent.buyerMessage || null; + } else if (transferEvent) { + buyerMessage = transferEvent.buyerMessage || null; + authorReply = transferEvent.memo || null; + } + + if (!buyerMessage) { + return null; + } + + return { + ...collector, + buyerMessage, + authorReply, + }; + }) + .filter(Boolean); + + if (collectorsWithReplies && collectorsWithReplies.length) { + collectorsWithReplies.sort((a, b) => { + if (a.buyerMessage && !b.buyerMessage) { + return -1; + } + if (!a.buyerMessage && b.buyerMessage) { + return 1; + } + return b.authorReply - a.authorReply; + }); + } + + return collectorsWithReplies; + }, + shouldShowCollectorMessage() { + return this.filterCollectorsWithReplies?.length > 3; + }, isShowBanner() { return ( this.classId === @@ -1100,6 +1191,7 @@ export default { ]), parseNFTMetadataURL, async fetchTrimmedCollectorsInfo() { + this.isHistoryInfoLoading = true; const trimmedCollectors = this.sortedOwnerListId.slice( 0, this.trimmedCount @@ -1108,6 +1200,8 @@ export default { this.lazyGetUserInfoByAddresses(trimmedCollectors), this.updateNFTHistory({ getAllUserInfo: false }), ]); + this.isHistoryInfoLoading = false; + this.isFinishedLoadingHistory = true; }, getPurchaseEventParams(edition) { const customPriceInDecimal = this.customPrice @@ -1140,6 +1234,17 @@ export default { ); await this.lazyGetUserInfoByAddresses(this.sortedOwnerListId); }, + async handleClickMoreCollectorMessage() { + this.isOpeningCollectorListDialog = true; + logTrackerEvent( + this, + 'NFT', + 'class_details_show_more_collector_clicked', + this.classId, + 1 + ); + await this.lazyGetUserInfoByAddresses(this.sortedOwnerListId); + }, async handleClickMoreHistory() { logTrackerEvent( this, From 5053719fd794e4751143872b06e2fb0ee1143dc0 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Tue, 24 Dec 2024 10:08:38 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=92=84=20Add=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NFTPage/CollectorListDialog.vue | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 src/components/NFTPage/CollectorListDialog.vue diff --git a/src/components/NFTPage/CollectorListDialog.vue b/src/components/NFTPage/CollectorListDialog.vue new file mode 100644 index 000000000..29d99319e --- /dev/null +++ b/src/components/NFTPage/CollectorListDialog.vue @@ -0,0 +1,91 @@ + + From 40e7350339d789a5d133d98d318eb5a515406cf3 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Tue, 24 Dec 2024 15:01:46 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=8E=A8=20Add=20props=20for=20min/max?= =?UTF-8?q?=20messages=20and=20multiplier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NFTPage/CollectorMessageList/index.vue | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/NFTPage/CollectorMessageList/index.vue b/src/components/NFTPage/CollectorMessageList/index.vue index 494cdb8be..9768d3410 100644 --- a/src/components/NFTPage/CollectorMessageList/index.vue +++ b/src/components/NFTPage/CollectorMessageList/index.vue @@ -4,8 +4,10 @@ @@ -20,6 +22,10 @@ export default { type: Array, default: () => [], }, + creatorAvatar: { + type: String, + default: undefined, + }, classId: { type: String, default: undefined, @@ -28,22 +34,34 @@ export default { type: Boolean, default: false, }, + minMessages: { + type: Number, + default: 6, + }, + maxMessages: { + type: Number, + default: 20, + }, + durationMultiplier: { + type: Number, + default: 3.33, + }, }, computed: { displayMessages() { if (this.messages.length < 3) return []; let loopedMessages = [...this.messages]; - while (loopedMessages.length < 6) { + while (loopedMessages.length < this.minMessages) { loopedMessages = loopedMessages.concat(this.messages); } - if (loopedMessages.length > 20) { - loopedMessages = loopedMessages.slice(0, 20); + if (loopedMessages.length > this.maxMessages) { + loopedMessages = loopedMessages.slice(0, this.maxMessages); } return loopedMessages; }, durationTime() { - return `${this.messages.length * 3.33}s`; + return `${this.messages.length * this.durationMultiplier}s`; }, }, mounted() { From 8c4db426d560fd5506b0c7ff932f837c5e076641 Mon Sep 17 00:00:00 2001 From: AuroraHuang22 Date: Tue, 24 Dec 2024 15:02:53 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=92=84=20Add=20item=20card=20&=20hove?= =?UTF-8?q?r=20effect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/NFTMessage/Identity.vue | 9 +- .../NFTPage/CollectorMessageList/Item.vue | 124 ++++++++++++++++++ src/components/ScrollingList.vue | 7 +- src/pages/nft/class/_classId/index.vue | 2 + 4 files changed, 138 insertions(+), 4 deletions(-) create mode 100644 src/components/NFTPage/CollectorMessageList/Item.vue diff --git a/src/components/NFTMessage/Identity.vue b/src/components/NFTMessage/Identity.vue index b3a16ed22..7ffa19214 100644 --- a/src/components/NFTMessage/Identity.vue +++ b/src/components/NFTMessage/Identity.vue @@ -36,9 +36,12 @@ > {{ userLabel }} - + diff --git a/src/components/NFTPage/CollectorMessageList/Item.vue b/src/components/NFTPage/CollectorMessageList/Item.vue new file mode 100644 index 000000000..70b6834df --- /dev/null +++ b/src/components/NFTPage/CollectorMessageList/Item.vue @@ -0,0 +1,124 @@ + + + diff --git a/src/components/ScrollingList.vue b/src/components/ScrollingList.vue index b4c343ced..22cbeab5a 100644 --- a/src/components/ScrollingList.vue +++ b/src/components/ScrollingList.vue @@ -1,6 +1,6 @@