fix(Wallet/Collectibles): Applied special collectible format only to community special collectibles
- Updated default value for `communityPrivilegesLevel` to `2 = Community`. - Added `communityId` checker in `CollectiblesView`, `CollectibleDetailView` and `WalletLayout`. Closes #12283
This commit is contained in:
parent
b7d4cb9605
commit
23966ec2cb
|
@ -3,6 +3,7 @@ import options
|
|||
|
||||
import backend/collectibles as backend
|
||||
import collectible_trait_model
|
||||
import ../../../app_service/service/community_tokens/dto/community_token
|
||||
|
||||
# Additional data needed to build an Entry, which is
|
||||
# not included in the backend data and needs to be
|
||||
|
@ -192,7 +193,7 @@ QtObject:
|
|||
|
||||
proc getCommunityPrivilegesLevel*(self: CollectibleDetailsEntry): int {.slot.} =
|
||||
if self.data == nil or isNone(self.data.communityInfo):
|
||||
return 0
|
||||
return PrivilegesLevel.Community.int
|
||||
return int(self.data.communityInfo.get().privilegesLevel)
|
||||
|
||||
QtProperty[int] communityPrivilegesLevel:
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import sequtils, sugar, times, options
|
||||
import backend/collectibles as backend
|
||||
import collectibles_item
|
||||
import ../../../app_service/service/community_tokens/dto/community_token
|
||||
|
||||
proc collectibleToItem*(c: backend.CollectibleHeader, isPinned: bool = false) : Item =
|
||||
var mediaUrl = c.animationUrl
|
||||
|
@ -12,7 +13,7 @@ proc collectibleToItem*(c: backend.CollectibleHeader, isPinned: bool = false) :
|
|||
var communityId = ""
|
||||
var communityName = ""
|
||||
var communityColor = ""
|
||||
var communityPrivilegesLevel = 0
|
||||
var communityPrivilegesLevel = PrivilegesLevel.Community.int
|
||||
if isSome(c.communityHeader):
|
||||
let communityHeader = c.communityHeader.get()
|
||||
communityId = communityHeader.communityId
|
||||
|
|
|
@ -143,13 +143,18 @@ Item {
|
|||
}
|
||||
|
||||
footer: WalletFooter {
|
||||
id: footer
|
||||
|
||||
readonly property bool isHoldingSelected: !!walletStore.currentViewedCollectible && walletStore.currentViewedHoldingID !== ""
|
||||
readonly property bool isCommunityCollectible: !!walletStore.currentViewedCollectible ? walletStore.currentViewedCollectible.communityId !== "" : false
|
||||
readonly property bool isOwnerCommunityCollectible: isCommunityCollectible ? (walletStore.currentViewedCollectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false
|
||||
|
||||
visible: !root.showAllAccounts
|
||||
width: parent.width
|
||||
height: root.showAllAccounts ? implicitHeight : 61
|
||||
walletStore: RootStore
|
||||
networkConnectionStore: root.networkConnectionStore
|
||||
isCommunityOwnershipTransfer: (!!walletStore.currentViewedCollectible && walletStore.currentViewedHoldingID !== "") ?
|
||||
(walletStore.currentViewedCollectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false
|
||||
isCommunityOwnershipTransfer: footer.isHoldingSelected && footer.isOwnerCommunityCollectible
|
||||
communityName: !!walletStore.currentViewedCollectible ? walletStore.currentViewedCollectible.communityName : ""
|
||||
onLaunchShareAddressModal: Global.openPopup(receiveModalComponent)
|
||||
onLaunchSendModal: {
|
||||
|
|
|
@ -65,6 +65,7 @@ Item {
|
|||
isLoading: !!model.isLoading
|
||||
privilegesLevel: model.communityPrivilegesLevel ?? Constants.TokenPrivilegesLevel.Community
|
||||
ornamentColor: model.communityColor ?? "transparent"
|
||||
communityId: model.communityId
|
||||
|
||||
onClicked: root.collectibleClicked(model.chainId, model.contractAddress, model.tokenId, model.uid)
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ Item {
|
|||
readonly property int isNarrowMode : width < 700
|
||||
|
||||
// Community related token props:
|
||||
readonly property bool isCommunityCollectible: !!collectible ? collectible.communityId !== "" : false
|
||||
readonly property bool isOwnerTokenType: !!collectible ? (collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false
|
||||
readonly property bool isTMasterTokenType: !!collectible ? (collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.TMaster) : false
|
||||
|
||||
|
@ -66,7 +67,7 @@ Item {
|
|||
PrivilegedTokenArtworkPanel {
|
||||
id: privilegedCollectibleImage
|
||||
|
||||
visible: root.isOwnerTokenType || root.isTMasterTokenType
|
||||
visible: root.isCommunityCollectible && (root.isOwnerTokenType || root.isTMasterTokenType)
|
||||
size: root.isNarrowMode ? PrivilegedTokenArtworkPanel.Size.Medium : PrivilegedTokenArtworkPanel.Size.Large
|
||||
artwork: collectible.imageUrl
|
||||
color: !!collectible ? collectible.communityColor : "transparent"
|
||||
|
|
|
@ -23,8 +23,10 @@ Control {
|
|||
property url fallbackImageUrl : ""
|
||||
property bool isLoading: false
|
||||
property bool navigationIconVisible: false
|
||||
property string communityId: ""
|
||||
|
||||
// Special Owner and TMaster token properties
|
||||
readonly property bool isCommunityCollectible: communityId !== ""
|
||||
property int privilegesLevel: Constants.TokenPrivilegesLevel.Community
|
||||
readonly property bool isPrivilegedToken: (privilegesLevel === Constants.TokenPrivilegesLevel.Owner) ||
|
||||
(privilegesLevel === Constants.TokenPrivilegesLevel.TMaster)
|
||||
|
@ -52,7 +54,7 @@ Control {
|
|||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width
|
||||
|
||||
visible: !root.isPrivilegedToken
|
||||
visible: !specialCollectible.visible
|
||||
radius: 8
|
||||
mediaUrl: root.mediaUrl
|
||||
mediaType: root.mediaType
|
||||
|
@ -70,12 +72,14 @@ Control {
|
|||
}
|
||||
|
||||
PrivilegedTokenArtworkPanel {
|
||||
id: specialCollectible
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.margins: Style.current.halfPadding
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: width
|
||||
|
||||
visible: root.isPrivilegedToken
|
||||
visible: root.isCommunityCollectible && root.isPrivilegedToken
|
||||
size: PrivilegedTokenArtworkPanel.Size.Medium
|
||||
artwork: root.fallbackImageUrl
|
||||
color: root.ornamentColor
|
||||
|
|
Loading…
Reference in New Issue