Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TAS-2340] 🐛 Enable content viewing using ownedNFTId instead of lastOwnedNFTId #1889

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 17 additions & 5 deletions src/components/NFTPortfolio/Item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
:display-state="nftDisplayState"
:is-nft-book="nftIsNFTBook"
:portfolio-tab="portfolioTab"
:is-content-viewable="!(nftIsNFTBook && !isOwningNFT)"
:is-content-viewable="isContentViewable"
:is-content-downloadable="!nftIsDownloadHidden"
:collect-expiry-time="collectExpiryTime"
@collect="handleClickCollect"
Expand All @@ -39,12 +39,11 @@
</template>

<script>
import { logTrackerEvent } from '~/util/EventLogger';

import nftMixin from '~/mixins/nft';
import walletMixin from '~/mixins/wallet';

export default {
mixins: [nftMixin],
mixins: [nftMixin, walletMixin],
props: {
classId: {
type: String,
Expand All @@ -66,6 +65,10 @@ export default {
type: Boolean,
default: false,
},
isBookshelf: {
type: Boolean,
default: false,
},
},

data() {
Expand All @@ -74,8 +77,17 @@ export default {
};
},
computed: {
ownedNftId() {
return this.collectorMap?.[this.getAddress]?.[0];
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems there is a nftIdCollectedFirstByUser in nft mixin that we can resue

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isContentViewable() {
return this.nftIsNFTBook && this.isBookshelf && this.ownedNftId;
williamchong marked this conversation as resolved.
Show resolved Hide resolved
},
nftIdForDetails() {
return this.portfolioTab === 'collected' && this.nftId;
if (this.portfolioTab === 'collected') {
return this.isBookshelf ? this.ownedNftId : this.nftId;
}
return undefined;
},
detailsPageRoute() {
if (this.nftIdForDetails) {
Expand Down
1 change: 1 addition & 0 deletions src/components/NFTPortfolio/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@
:nft-id="nft.lastOwnedNFTId"
:portfolio-tab="portfolioTab"
:should-fetch-when-visible="true"
:is-bookshelf="isBookshelf"
@load-cover="updatePortfolioGrid"
@click.native="handleItemClick(nft.classId)"
@collect="handleItemCollect(nft.classId)"
Expand Down
5 changes: 4 additions & 1 deletion src/store/modules/nft.js
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,10 @@ const actions = {
if (classesOrPromise) {
await classesOrPromise;
} else {
await dispatch('fetchCollectedNFTClassesByAddress', { address });
await dispatch('fetchCollectedNFTClassesByAddress', {
address,
nocache: true,
});
}
},
async fetchNFTDisplayStateListByAddress({ commit }, address) {
Expand Down
Loading