From 30ff5f3a2bff5886a385dfb21228e2ff5878a629 Mon Sep 17 00:00:00 2001 From: Khushboo Mehta Date: Tue, 2 Apr 2024 22:56:53 +0200 Subject: [PATCH] fix(@desktop/wallet): New Collectible Details tabs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fixes #13806 Signed-off-by: Jakub SokoĊ‚owski --- .../shared_models/collectibles_entry.nim | 34 +++++- .../collectible_details/controller.nim | 9 ++ .../collectible_details/events_handler.nim | 5 +- src/backend/collectibles.nim | 4 + src/backend/collectibles_types.nim | 32 +++++- .../src/Models/ManageCollectiblesModel.qml | 43 +++++-- ui/StatusQ/src/assets.qrc | 1 + .../src/assets/img/icons/tiny/opensea.svg | 3 + .../Wallet/controls/CollectibleLinksTags.qml | 94 +++++++++++++++ ui/app/AppLayouts/Wallet/controls/qmldir | 1 + ui/app/AppLayouts/Wallet/stores/RootStore.qml | 5 + .../collectibles/CollectibleDetailView.qml | 108 ++++++++++++++---- vendor/status-go | 2 +- 13 files changed, 310 insertions(+), 31 deletions(-) create mode 100644 ui/StatusQ/src/assets/img/icons/tiny/opensea.svg create mode 100644 ui/app/AppLayouts/Wallet/controls/CollectibleLinksTags.qml diff --git a/src/app/modules/shared_models/collectibles_entry.nim b/src/app/modules/shared_models/collectibles_entry.nim index 17fc015e9a..0ff80109d8 100644 --- a/src/app/modules/shared_models/collectibles_entry.nim +++ b/src/app/modules/shared_models/collectibles_entry.nim @@ -58,7 +58,7 @@ QtObject: ownership:{self.ownership}, generatedId:{self.generatedId}, generatedCollectionId:{self.generatedCollectionId}, - tokenType:{self.tokenType} + tokenType:{self.tokenType}, )""" proc hasCollectibleData(self: CollectiblesEntry): bool = @@ -330,6 +330,24 @@ QtObject: read = getSoulbound notify = soulboundChanged + proc websiteChanged*(self: CollectiblesEntry) {.signal.} + proc getWebsite*(self: CollectiblesEntry): string {.slot.} = + if not self.hasCollectionData(): + return "" + return self.getCollectionData().socials.website + QtProperty[string] website: + read = getWebsite + notify = websiteChanged + + proc twitterHandleChanged*(self: CollectiblesEntry) {.signal.} + proc getTwitterHandle*(self: CollectiblesEntry): string {.slot.} = + if not self.hasCollectionData(): + return "" + return self.getCollectionData().socials.twitterHandle + QtProperty[string] twitterHandle: + read = getTwitterHandle + notify = twitterHandleChanged + proc updateDataIfSameID*(self: CollectiblesEntry, update: backend.Collectible): bool = if self.id != update.id: return false @@ -393,3 +411,17 @@ QtObject: ) let extradata = ExtraData() return newCollectibleDetailsBasicEntry(id, extradata) + + proc updateDataIfSameID*(self: CollectiblesEntry, update: backend.CollectionSocialsMessage) = + if self.id.contractID != update.id: + return + + if not self.hasCollectionData(): + return + + self.getCollectionData().socials.website = update.socials.website + self.getCollectionData().socials.twitterHandle = update.socials.twitterHandle + + # Notify changes for all properties + self.twitterHandleChanged() + self.websiteChanged() diff --git a/src/app/modules/shared_modules/collectible_details/controller.nim b/src/app/modules/shared_modules/collectible_details/controller.nim index d0cbd4dc69..bfba625c9c 100644 --- a/src/app/modules/shared_modules/collectible_details/controller.nim +++ b/src/app/modules/shared_modules/collectible_details/controller.nim @@ -86,6 +86,10 @@ QtObject: if self.detailedEntry.updateDataIfSameID(collectible): break + proc processGetCollectionSocialsResponse(self: Controller, response: JsonNode) = + let res = fromJson(response, backend_collectibles.CollectionSocialsMessage) + self.detailedEntry.updateDataIfSameID(res) + proc getDetailedCollectible*(self: Controller, chainId: int, contractAddress: string, tokenId: string) {.slot.} = self.setIsDetailedEntryLoading(true) @@ -102,6 +106,7 @@ QtObject: self.detailedEntryChanged() let response = backend_collectibles.getCollectiblesByUniqueIDAsync(self.requestId, @[id], self.dataType) + discard backend_collectibles.fetchCollectionSocialsAsync(id.contractID) if response.error != nil: self.setIsDetailedEntryLoading(false) error "error fetching collectible details: ", response.error @@ -116,6 +121,10 @@ QtObject: self.processCollectiblesDataUpdate(jsonObj) ) + self.eventsHandler.onGetCollectionSocialsDone(proc (jsonObj: JsonNode) = + self.processGetCollectionSocialsResponse(jsonObj) + ) + proc newController*( requestId: int32, networkService: network_service.Service, diff --git a/src/app/modules/shared_modules/collectible_details/events_handler.nim b/src/app/modules/shared_modules/collectible_details/events_handler.nim index f5c907e343..5a5988ab70 100644 --- a/src/app/modules/shared_modules/collectible_details/events_handler.nim +++ b/src/app/modules/shared_modules/collectible_details/events_handler.nim @@ -26,6 +26,9 @@ QtObject: proc onGetCollectiblesDetailsDone*(self: EventsHandler, handler: EventCallbackProc) = self.eventHandlers[backend_collectibles.eventGetCollectiblesDetailsDone] = handler + proc onGetCollectionSocialsDone*(self: EventsHandler, handler: EventCallbackProc) = + self.eventHandlers[backend_collectibles.eventGetCollectionSocialsDone] = handler + proc onCollectiblesDataUpdate*(self: EventsHandler, handler: EventCallbackProc) = self.eventHandlers[backend_collectibles.eventCollectiblesDataUpdated] = handler @@ -62,4 +65,4 @@ QtObject: result.events.on(SignalType.Wallet.event, proc(e: Args) = eventsHandler.handleApiEvents(e) ) - \ No newline at end of file + diff --git a/src/backend/collectibles.nim b/src/backend/collectibles.nim index de577270f3..25cbe6ad93 100644 --- a/src/backend/collectibles.nim +++ b/src/backend/collectibles.nim @@ -25,6 +25,7 @@ const eventCommunityCollectiblesReceived*: string = "wallet-collectibles-communi const eventCollectiblesDataUpdated*: string = "wallet-collectibles-data-updated" const eventOwnedCollectiblesFilteringDone*: string = "wallet-owned-collectibles-filtering-done" const eventGetCollectiblesDetailsDone*: string = "wallet-get-collectibles-details-done" +const eventGetCollectionSocialsDone*: string ="wallet-get-collection-socials-done" const invalidTimestamp*: int = -1 @@ -271,6 +272,9 @@ rpc(getCollectiblesByUniqueIDAsync, "wallet"): uniqueIds: seq[CollectibleUniqueID] dataType: CollectibleDataType +rpc(fetchCollectionSocialsAsync, "wallet"): + contractID: ContractID + rpc(refetchOwnedCollectibles, "wallet"): discard diff --git a/src/backend/collectibles_types.nim b/src/backend/collectibles_types.nim index ebe99d6603..593e105c28 100644 --- a/src/backend/collectibles_types.nim +++ b/src/backend/collectibles_types.nim @@ -47,6 +47,7 @@ type name*: string slug*: string imageUrl*: string + socials*: CollectionSocials CommunityData* = ref object of RootObj id*: string @@ -73,6 +74,14 @@ type receivedAmount*: Option[float64] contractType*: Option[ContractType] + CollectionSocials* = ref object of RootObj + website*: string + twitterHandle*: string + + CollectionSocialsMessage* = ref object of RootObj + socials*: CollectionSocials + id*: ContractID + # Mirrors services/wallet/thirdparty/collectible_types.go TokenBalance CollectibleBalance* = ref object tokenId*: UInt256 @@ -209,6 +218,15 @@ proc `$`*(self: CollectionData): string = name:{self.name}, slug:{self.slug}, imageUrl:{self.imageUrl} + website:{self.socials.website} + twitterHandle:{self.socials.twitterHandle} + )""" + +# CollectionSocials +proc `$`*(self: CollectionSocials): string = + return fmt"""CollectionSocials( + website:{self.website}, + twitterHandle:{self.twitterHandle}, )""" proc fromJson*(t: JsonNode, T: typedesc[CollectionData]): CollectionData = @@ -216,6 +234,7 @@ proc fromJson*(t: JsonNode, T: typedesc[CollectionData]): CollectionData = result.name = t["name"].getStr() result.slug = t["slug"].getStr() result.imageUrl = t["image_url"].getStr() + result.socials = fromJson(t["socials"], CollectionSocials) proc fromJson*(t: JsonNode, T: typedesc[ref CollectionData]): ref CollectionData = result = new(CollectionData) @@ -464,4 +483,15 @@ proc `%`*(cp: CollectiblePreferences): JsonNode {.inline.} = result["type"] = %int(cp.itemType) result["key"] = %cp.key result["position"] = %cp.position - result["visible"] = %cp.visible \ No newline at end of file + result["visible"] = %cp.visible + +proc fromJson*(t: JsonNode, T: typedesc[CollectionSocials]): CollectionSocials {.inline.} = + result = CollectionSocials() + if t.kind != JNull: + result.website = t["website"].getStr() + result.twitterHandle = t["twitter_handle"].getStr() + +proc fromJson*(t: JsonNode, T: typedesc[CollectionSocialsMessage]): CollectionSocialsMessage {.inline.} = + result = CollectionSocialsMessage() + result.socials = fromJson(t["socials"], CollectionSocials) + result.id = fromJson(t["id"], ContractID) diff --git a/storybook/src/Models/ManageCollectiblesModel.qml b/storybook/src/Models/ManageCollectiblesModel.qml index 14656fe328..13ace2f55d 100644 --- a/storybook/src/Models/ManageCollectiblesModel.qml +++ b/storybook/src/Models/ManageCollectiblesModel.qml @@ -23,6 +23,7 @@ ListModel { name: "Punx not dead!", collectionUid: "", collectionName: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240", + collectionImageUrl: ModelsData.collectibles.cryptoPunks, communityId: "", communityName: "", communityImage: ModelsData.icons.status, @@ -61,7 +62,9 @@ ListModel { value: "Tigerpunk" } ], - tokenId: "403" + tokenId: "403", + twitterHandle: "@punxNotDead", + website: "www.punxnotdead.com" }, { uid: "pp23", @@ -70,6 +73,7 @@ ListModel { name: "pepepunk#23", collectionUid: "pepepunks", collectionName: "Pepepunks", + collectionImageUrl: "https://i.seadn.io/s/raw/files/ba2811bb5cd0bed67529d69fa92ef5aa.jpg?auto=format&dpr=1&w=1000", communityId: "", communityName: "", communityImage: "", @@ -103,7 +107,9 @@ ListModel { value: "Tigerpunk" } ], - tokenId: "123" + tokenId: "123", + twitterHandle: "@pepepunks", + website: "www.pepepunks.com" }, { uid: "34545656768", @@ -112,6 +118,7 @@ ListModel { name: "Kitty 1", collectionUid: "KT", collectionName: "Kitties", + collectionImageUrl: ModelsData.collectibles.kitty1Big, communityId: "", communityName: "", communityImage: "", @@ -145,7 +152,9 @@ ListModel { value: "Tigerpunk" } ], - tokenId: "7123" + tokenId: "7123", + twitterHandle: "@kitties", + website: "www.kitties.com" }, { uid: "123456", @@ -154,6 +163,7 @@ ListModel { name: "Kitty 2", collectionUid: "KT", collectionName: "Kitties", + collectionImageUrl: ModelsData.collectibles.kitty2Big, communityId: "", communityName: "", communityImage: "", @@ -190,7 +200,9 @@ ListModel { value: "Tigerpunk" } ], - tokenId: "403123" + tokenId: "403123", + twitterHandle: "", + website: "www.kitties.com" }, { uid: "12345645459537432", @@ -199,6 +211,7 @@ ListModel { name: "Big Kitty", collectionUid: "KT", collectionName: "Kitties", + collectionImageUrl: ModelsData.collectibles.kitty3Big, communityId: "", communityName: "", communityImage: "", @@ -237,7 +250,9 @@ ListModel { value: "Tigerpunk" } ], - tokenId: "1" + tokenId: "1", + twitterHandle: "@kitties", + website: "" }, { uid: "pp21", @@ -246,6 +261,7 @@ ListModel { name: "pepepunk#21", collectionUid: "pepepunks", collectionName: "Pepepunks", + collectionImageUrl: "https://i.seadn.io/s/raw/files/cfa559bb63e4378f17649c1e3b8f18fe.jpg?auto=format&dpr=1&w=1000", communityId: "", communityName: "", communityImage: "", @@ -271,7 +287,9 @@ ListModel { value: "Special" } ], - tokenId: "12568" + tokenId: "12568", + twitterHandle: "@pepepunks", + website: "www.pepepunks.com" }, { uid: "lp#666a", @@ -280,6 +298,7 @@ ListModel { name: "Lonely Panda #666", collectionUid: "lpan_collection", collectionName: "Lonely Panda Collection", + collectionImageUrl: "", communityId: "", communityName: "", communityImage: "", @@ -305,7 +324,9 @@ ListModel { value: "Rare" } ], - tokenId: "1445" + tokenId: "1445", + twitterHandle: "@lonelyPanda", + website: "www.lonelyPanda.com" }, ] @@ -316,6 +337,7 @@ ListModel { name: "Frenly Panda #9140", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "fpan", communityName: "Frenly Pandas", communityImage: "https://pbs.twimg.com/profile_images/1599347398769143808/C6qG3RQv_400x400.jpg", @@ -342,6 +364,7 @@ ListModel { name: "KILLABEAR #691", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "bbrz", communityName: "Bearz", communityImage: "https://i.seadn.io/gcs/files/4a875f997063f4f3772190852c1c44f0.png?w=128&auto=format", @@ -368,6 +391,7 @@ ListModel { name: "KILLABEAR #2385", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "bbrz", communityName: "Bearz", communityImage: "https://i.seadn.io/gcs/files/4a875f997063f4f3772190852c1c44f0.png?w=128&auto=format", @@ -394,6 +418,7 @@ ListModel { name: "Frenly Panda #3195324354654756756756784234523", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "fpan", communityName: "Frenly Pandas", communityImage: "https://pbs.twimg.com/profile_images/1599347398769143808/C6qG3RQv_400x400.jpg", @@ -420,6 +445,7 @@ ListModel { name: "Frenly Panda #4297", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "fpan", communityName: "Frenly Pandas", communityImage: "https://pbs.twimg.com/profile_images/1599347398769143808/C6qG3RQv_400x400.jpg", @@ -446,6 +472,7 @@ ListModel { name: "Frenly Panda #909", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "fpan", communityName: "Frenly Pandas", communityImage: "https://pbs.twimg.com/profile_images/1599347398769143808/C6qG3RQv_400x400.jpg", @@ -472,6 +499,7 @@ ListModel { name: "Lonely Bear #666", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "lbear", communityName: "Lonely Bearz Community 0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240", communityImage: "", @@ -503,6 +531,7 @@ ListModel { name: "Lonely Turtle #777", collectionUid: "", collectionName: "", + collectionImageUrl: "", communityId: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240", communityName: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240", communityImage: "", diff --git a/ui/StatusQ/src/assets.qrc b/ui/StatusQ/src/assets.qrc index 2d87c2fd52..73cf882d29 100644 --- a/ui/StatusQ/src/assets.qrc +++ b/ui/StatusQ/src/assets.qrc @@ -10418,5 +10418,6 @@ assets/img/icons/tiny/help.svg assets/img/icons/tiny/copy.svg assets/img/icons/tiny/profile.svg + assets/img/icons/tiny/opensea.svg diff --git a/ui/StatusQ/src/assets/img/icons/tiny/opensea.svg b/ui/StatusQ/src/assets/img/icons/tiny/opensea.svg new file mode 100644 index 0000000000..50bcd33e1f --- /dev/null +++ b/ui/StatusQ/src/assets/img/icons/tiny/opensea.svg @@ -0,0 +1,3 @@ + + + diff --git a/ui/app/AppLayouts/Wallet/controls/CollectibleLinksTags.qml b/ui/app/AppLayouts/Wallet/controls/CollectibleLinksTags.qml new file mode 100644 index 0000000000..ffd9384147 --- /dev/null +++ b/ui/app/AppLayouts/Wallet/controls/CollectibleLinksTags.qml @@ -0,0 +1,94 @@ +import QtQuick 2.13 +import QtQuick.Layouts 1.13 +import QtQuick.Controls 2.14 + +import StatusQ.Core 0.1 +import StatusQ.Core.Theme 0.1 +import StatusQ.Components 0.1 + +import utils 1.0 + +Control { + id: root + + property alias primaryText: primaryText.text + property alias primaryLabel: primaryText + property alias secondaryText: secondaryText.text + property alias secondaryLabel: secondaryText + property StatusAssetSettings asset: StatusAssetSettings { + width: 16 + height: 16 + name: "" + color: Theme.palette.transparent + isLetterIdenticon: false + letterSize: charactersLen > 1 ? 8 : 11 + imgIsIdenticon: false + } + + signal clicked() + + implicitWidth: 290 + implicitHeight: 64 + topPadding: 15 + bottomPadding: 15 + leftPadding: 12 + rightPadding: 12 + + background: Rectangle { + radius: Style.current.radius + border.width: 1 + border.color: Theme.palette.baseColor2 + color: mouse.containsMouse ? Theme.palette.baseColor2 : Theme.palette.transparent + MouseArea { + id: mouse + anchors.fill: parent + hoverEnabled: true + onClicked: root.clicked() + } + } + + contentItem: RowLayout { + spacing: 8 + StatusSmartIdenticon { + id: identicon + Layout.alignment: Qt.AlignTop + Layout.preferredWidth: active ? 16 : 0 + Layout.preferredHeight: 16 + asset: root.asset + } + Column { + Layout.fillWidth: true + spacing: 0 + StatusBaseText { + id: primaryText + width: parent.width + font.pixelSize: 13 + font.weight: Font.Medium + lineHeight: 18 + lineHeightMode: Text.FixedHeight + color: Theme.palette.directColor1 + visible: text + elide: Text.ElideRight + } + StatusBaseText { + id: secondaryText + width: parent.width + font.pixelSize: 12 + lineHeight: 16 + lineHeightMode: Text.FixedHeight + color: Theme.palette.baseColor1 + visible: text + elide: Text.ElideMiddle + } + } + StatusRoundIcon { + Layout.alignment: Qt.AlignVCenter + Layout.preferredWidth: 24 + Layout.preferredHeight: 24 + visible: root.hovered + asset.name: "external" + asset.color: Theme.palette.directColor1 + asset.bgColor: Theme.palette.transparent + } + } +} diff --git a/ui/app/AppLayouts/Wallet/controls/qmldir b/ui/app/AppLayouts/Wallet/controls/qmldir index 2213db7aa0..5d9eb5e2d1 100644 --- a/ui/app/AppLayouts/Wallet/controls/qmldir +++ b/ui/app/AppLayouts/Wallet/controls/qmldir @@ -14,3 +14,4 @@ InformationTileAssetDetails 1.0 InformationTileAssetDetails.qml StatusNetworkListItemTag 1.0 StatusNetworkListItemTag.qml CollectibleBalanceTag 1.0 CollectibleBalanceTag.qml ConnectedDappsButton 1.0 ConnectedDappsButton.qml +CollectibleLinksTags 1.0 CollectibleLinksTags.qml diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml index 825a66a39a..b11b7e2fa1 100644 --- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml @@ -600,4 +600,9 @@ QtObject { let baseLink = root.areTestNetworksEnabled ? Constants.openseaExplorerLinks.testnetLink : Constants.openseaExplorerLinks.mainnetLink return "%1/assets/%2/%3/%4".arg(baseLink).arg(networkName).arg(contractAddress).arg(tokenId) } + + function getTwitterLink(twitterHandle) { + const prefix = Constants.socialLinkPrefixesByType[Constants.socialLinkType.twitter] + return prefix + twitterHandle + } } diff --git a/ui/app/AppLayouts/Wallet/views/collectibles/CollectibleDetailView.qml b/ui/app/AppLayouts/Wallet/views/collectibles/CollectibleDetailView.qml index b52a9bd925..cecae9207a 100644 --- a/ui/app/AppLayouts/Wallet/views/collectibles/CollectibleDetailView.qml +++ b/ui/app/AppLayouts/Wallet/views/collectibles/CollectibleDetailView.qml @@ -46,6 +46,7 @@ Item { readonly property string blockExplorerLink: !!collectible ? root.walletRootStore.getExplorerUrl(collectible.networkShortName, collectible.contractAddress, collectible.tokenId): "" readonly property var addrFilters: root.addressFilters.split(":").map((addr) => addr.toLowerCase()) readonly property int imageStackSpacing: 4 + property bool activityLoading: walletRootStore.tmpActivityController0.status.loadingData property Component balanceTag: Component { CollectibleBalanceTag { @@ -69,6 +70,15 @@ Item { model: d.filteredBalances roleName: "balance" } + + function getCurrentTab() { + for (let i =0; i< collectiblesDetailsTab.contentChildren.length; i++) { + if(collectiblesDetailsTab.contentChildren[i].visible) { + return i + } + } + return 0 + } } CollectibleDetailsHeader { @@ -101,7 +111,7 @@ Item { onOpenCollectibleOnExplorer: Global.openLinkWithConfirmation(d.blockExplorerLink, root.walletRootStore.getExplorerDomain(networkShortName)) } - Column { + ColumnLayout { id: collectibleBody anchors.top: collectibleHeader.bottom anchors.topMargin: 25 @@ -117,8 +127,8 @@ Item { readonly property real visibleImageHeight: artwork.height readonly property real visibleImageWidth: artwork.width - height: collectibleImageDetails.visibleImageHeight - width: parent.width + Layout.preferredHeight: collectibleImageDetails.visibleImageHeight + Layout.fillWidth: true spacing: 24 ColumnLayout { @@ -126,7 +136,7 @@ Item { spacing: 0 Repeater { id: repeater - model: Math.min(3, d.balanceAggregator.value) + model: Math.min(3, d.balanceAggregator.value) Item { Layout.preferredWidth: childrenRect.width Layout.preferredHeight: childrenRect.height @@ -139,7 +149,11 @@ Item { property int modelIndex: index anchors.top: parent.top anchors.left: parent.left - sourceComponent: root.isCommunityCollectible && (root.isOwnerTokenType || root.isTMasterTokenType) ? privilegedCollectibleImage: collectibleimage + sourceComponent: isCollectibleLoading ? + collectibleimage: + root.isCommunityCollectible && (root.isOwnerTokenType || root.isTMasterTokenType) ? + privilegedCollectibleImage: + collectibleimage active: root.visible } Loader { @@ -195,44 +209,62 @@ Item { StatusTabBar { id: collectiblesDetailsTab - width: parent.width - topPadding: Style.current.xlPadding - visible: !!collectible && collectible.traits.count > 0 + Layout.fillWidth: true + topPadding: 52 + + currentIndex: d.getCurrentTab() StatusTabButton { - leftPadding: 0 - width: implicitWidth text: qsTr("Properties") + width: visible ? implicitWidth: 0 + visible: root.isCommunityCollectible + enabled: visible } + + StatusTabButton { + text: qsTr("Traits") + width: visible ? implicitWidth: 0 + visible: !root.isCommunityCollectible && !!collectible && collectible.traits.count > 0 + enabled: visible + } + StatusTabButton { - rightPadding: 0 - width: implicitWidth text: qsTr("Activity") + width: visible ? implicitWidth: 0 + } + + StatusTabButton { + text: qsTr("Links") + width: visible ? implicitWidth: 0 + visible: !root.isCommunityCollectible && (!!collectible && + ((!!collectible.website && !!collectible.collectionName) || + collectible.twitterHandle)) + enabled: visible } } StatusScrollView { id: scrollView - width: parent.width - height: parent.height + Layout.fillWidth: true + Layout.fillHeight: true contentWidth: availableWidth + padding: 0 Loader { id: tabLoader - width: parent.width - height: parent.height - + width: scrollView.availableWidth sourceComponent: { switch (collectiblesDetailsTab.currentIndex) { case 0: return traitsView - case 1: return activityView + case 1: return traitsView + case 2: return activityView + case 3: return linksView } } Component { id: traitsView Flow { - width: scrollView.availableWidth spacing: 10 Repeater { model: !!collectible ? collectible.traits: null @@ -248,9 +280,15 @@ Item { Component { id: activityView StatusListView { - width: scrollView.availableWidth height: scrollView.availableHeight model: root.activityModel + header: ShapeRectangle { + width: parent.width + height: visible ? 42: 0 + visible: !root.activityModel.count && !d.activityLoading + font.pixelSize: Style.current.primaryTextFontSize + text: qsTr("Activity will appear here") + } delegate: TransactionDelegate { required property var model required property int index @@ -273,6 +311,36 @@ Item { } } } + + Component { + id: linksView + Flow { + spacing: 10 + CollectibleLinksTags { + asset.name: !!collectible ? collectible.collectionImageUrl: "" + asset.isImage: true + primaryText: !!collectible ? collectible.collectionName : "" + secondaryText: !!collectible ? collectible.website : "" + visible: !!collectible && !!collectible.website && !!collectible.collectionName + enabled: !!collectible ? Utils.getUrlStatus(collectible.website): false + onClicked: Global.openLinkWithConfirmation(collectible.website, collectible.website) + } + CollectibleLinksTags { + asset.name: "tiny/opensea" + primaryText: qsTr("Opensea") + secondaryText: d.collectionLink + visible: Utils.getUrlStatus(d.collectionLink) + onClicked: Global.openLinkWithConfirmation(d.collectionLink, root.walletRootStore.getOpenseaDomainName()) + } + CollectibleLinksTags { + asset.name: "xtwitter" + primaryText: qsTr("Twitter") + secondaryText: !!collectible ? collectible.twitterHandle : "" + visible: !!collectible && collectible.twitterHandle + onClicked: Global.openLinkWithConfirmation(root.walletRootStore.getTwitterLink(collectible.twitterHandle), Constants.socialLinkPrefixesByType[Constants.socialLinkType.twitter]) + } + } + } } } } diff --git a/vendor/status-go b/vendor/status-go index 8f50b578d1..867cd1f14b 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 8f50b578d1378c1e43bfa9645910d5e690b8c98b +Subproject commit 867cd1f14bd4a286dd4a691ecc13b7f8ba5a8fd7