fix(@desktop/wallet): New Collectible Details tabs

fixes #13806

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Khushboo Mehta 2024-04-02 22:56:53 +02:00 committed by Khushboo-dev-cpp
parent b6b21c3744
commit 30ff5f3a2b
13 changed files with 310 additions and 31 deletions

View File

@ -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()

View File

@ -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,

View File

@ -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)
)

View File

@ -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

View File

@ -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
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)

View File

@ -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: "",

View File

@ -10418,5 +10418,6 @@
<file>assets/img/icons/tiny/help.svg</file>
<file>assets/img/icons/tiny/copy.svg</file>
<file>assets/img/icons/tiny/profile.svg</file>
<file>assets/img/icons/tiny/opensea.svg</file>
</qresource>
</RCC>

View File

@ -0,0 +1,3 @@
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.3335 16C12.7515 16 16.3335 12.418 16.3335 8C16.3335 3.58197 12.7525 0 8.3335 0C3.91546 0 0.333496 3.58197 0.333496 8C0.333496 12.418 3.91546 16 8.3335 16ZM13.1966 8.87371V9.38905C13.1966 9.41864 13.1785 9.44494 13.1522 9.45645C12.9911 9.52549 12.4396 9.77864 12.2103 10.0976C12.0827 10.2751 11.9617 10.4693 11.8401 10.6645C11.4039 11.3645 10.9601 12.0768 10.1785 12.0768H6.00886C4.53105 12.0768 3.3335 10.8751 3.3335 9.39233V9.34467C3.3335 9.30521 3.36554 9.27317 3.405 9.27317H5.72942C5.77543 9.27317 5.80913 9.3159 5.80503 9.3611C5.78858 9.51233 5.81654 9.66686 5.88804 9.80741C6.02612 10.0877 6.31215 10.2628 6.62119 10.2628H7.7719V9.3644H6.63434C6.57599 9.3644 6.54148 9.29699 6.57518 9.24933C6.58199 9.23887 6.58931 9.22816 6.597 9.21693L6.59707 9.21683L6.61626 9.18851C6.72394 9.03563 6.87764 8.79809 7.03052 8.52768C7.1349 8.34521 7.23599 8.15041 7.31737 7.9548C7.33246 7.92237 7.34477 7.88923 7.35685 7.85668L7.3601 7.84793L7.37755 7.79972L7.37755 7.7997C7.39389 7.75495 7.40962 7.71186 7.42175 7.66877C7.43517 7.62852 7.44639 7.58663 7.45721 7.54624L7.45721 7.54622L7.46449 7.51917C7.50313 7.35313 7.51956 7.17725 7.51956 6.99478C7.51956 6.92328 7.51628 6.84848 7.5097 6.77697C7.50641 6.69889 7.49655 6.6208 7.48668 6.54272C7.4801 6.47368 7.46778 6.40546 7.45463 6.33395C7.4382 6.22957 7.41518 6.12601 7.38887 6.02161L7.37983 5.98217C7.37397 5.96091 7.36839 5.93994 7.36285 5.91908L7.36283 5.91902C7.34974 5.86976 7.33682 5.82117 7.32066 5.77094C7.25572 5.54654 7.18094 5.32792 7.10202 5.12326C7.07326 5.04189 7.04038 4.96381 7.0075 4.88574L7.0075 4.88573C6.9694 4.79336 6.93078 4.70759 6.89405 4.62603L6.89403 4.62599L6.86449 4.56024C6.84148 4.51421 6.82175 4.47229 6.80202 4.42955C6.77983 4.38105 6.75682 4.33256 6.7338 4.28654C6.72734 4.27266 6.7205 4.25915 6.71378 4.24587C6.7034 4.22536 6.69329 4.2054 6.6853 4.18544L6.54476 3.92571C6.52503 3.89037 6.55791 3.84845 6.59654 3.85914L7.47601 4.09749H7.47847C7.47943 4.09749 7.48011 4.09777 7.48067 4.09801L7.48175 4.09832L7.59764 4.13037L7.72505 4.16654L7.7719 4.17968V3.65694C7.7719 3.40461 7.97409 3.19995 8.22396 3.19995C8.34889 3.19995 8.46231 3.25091 8.54369 3.33392C8.62505 3.41694 8.67601 3.53037 8.67601 3.65694V4.43285L8.76972 4.45914C8.77711 4.46162 8.7845 4.4649 8.79108 4.46982L8.82227 4.49348C8.84096 4.50772 8.86323 4.52468 8.88889 4.54381C8.9022 4.55445 8.91591 4.56604 8.93036 4.57824L8.93039 4.57827C8.95162 4.59621 8.97443 4.61548 8.99985 4.63504C9.08451 4.70325 9.18561 4.7912 9.29657 4.8923C9.32615 4.91778 9.35492 4.94408 9.38122 4.97038C9.52425 5.10354 9.68452 5.2597 9.8374 5.4323C9.88014 5.4808 9.92206 5.53011 9.96479 5.58189C9.97993 5.60051 9.99537 5.61904 10.0108 5.6375L10.0108 5.63751C10.0388 5.67117 10.0667 5.70461 10.0922 5.73806L10.1212 5.7765C10.1643 5.83358 10.2088 5.8924 10.2484 5.95341C10.2584 5.96876 10.269 5.98426 10.2796 5.99979L10.2797 5.99988C10.2935 6.02007 10.3073 6.04029 10.3199 6.06026C10.3823 6.15477 10.4374 6.25259 10.49 6.3504C10.5122 6.3956 10.5352 6.44491 10.5549 6.49341C10.6133 6.62409 10.6593 6.75725 10.6889 6.8904C10.6979 6.91917 10.7045 6.9504 10.7078 6.97835V6.98493C10.7177 7.02437 10.721 7.06629 10.7242 7.10902C10.7374 7.24547 10.7308 7.3819 10.7012 7.51917C10.6889 7.57753 10.6725 7.63259 10.6527 7.69096L10.6461 7.70974C10.6285 7.75982 10.6104 7.81134 10.5878 7.86027C10.5385 7.97451 10.4801 8.08877 10.4111 8.19561C10.3889 8.23507 10.3626 8.27699 10.3363 8.31645C10.3223 8.3369 10.308 8.35677 10.2941 8.37624C10.2794 8.39667 10.2651 8.41667 10.2516 8.43645C10.2155 8.48576 10.1769 8.53753 10.1374 8.58357C10.1021 8.63206 10.0659 8.68056 10.0264 8.7233C9.97137 8.78822 9.91876 8.84987 9.86369 8.90905C9.83082 8.94768 9.79548 8.98713 9.7593 9.02248C9.72902 9.05629 9.69811 9.08709 9.66919 9.11591L9.66915 9.11594L9.65492 9.13014C9.59986 9.18521 9.55383 9.22795 9.51519 9.26329L9.42479 9.34632C9.41164 9.35782 9.39438 9.3644 9.3763 9.3644H8.67601V10.2628H9.55711C9.75438 10.2628 9.94178 10.1929 10.093 10.0647L10.0971 10.0611L10.0971 10.0611C10.1558 10.0099 10.3773 9.81669 10.6379 9.52878C10.647 9.51891 10.6585 9.51152 10.6717 9.50824L13.1054 8.80467C13.1506 8.79152 13.1966 8.82603 13.1966 8.87371ZM3.92071 8.26877L3.95522 8.21451L6.03634 4.95887C6.06676 4.9112 6.13826 4.91613 6.16127 4.96791C6.50895 5.74709 6.80895 6.71614 6.66841 7.31944C6.60841 7.56767 6.44402 7.90382 6.25908 8.21451C6.23526 8.25973 6.20895 8.30411 6.181 8.34685C6.16785 8.36658 6.14566 8.37808 6.12182 8.37808H3.98153C3.92399 8.37808 3.8903 8.31562 3.92071 8.26877Z" fill="#2081E2"/>
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -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
}
}
}

View File

@ -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

View File

@ -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
}
}

View File

@ -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])
}
}
}
}
}
}

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 8f50b578d1378c1e43bfa9645910d5e690b8c98b
Subproject commit 867cd1f14bd4a286dd4a691ecc13b7f8ba5a8fd7