mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-18 10:32:53 +00:00
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 backend/collectibles as backend
|
||||||
import collectible_trait_model
|
import collectible_trait_model
|
||||||
|
import ../../../app_service/service/community_tokens/dto/community_token
|
||||||
|
|
||||||
# Additional data needed to build an Entry, which is
|
# Additional data needed to build an Entry, which is
|
||||||
# not included in the backend data and needs to be
|
# not included in the backend data and needs to be
|
||||||
@ -192,7 +193,7 @@ QtObject:
|
|||||||
|
|
||||||
proc getCommunityPrivilegesLevel*(self: CollectibleDetailsEntry): int {.slot.} =
|
proc getCommunityPrivilegesLevel*(self: CollectibleDetailsEntry): int {.slot.} =
|
||||||
if self.data == nil or isNone(self.data.communityInfo):
|
if self.data == nil or isNone(self.data.communityInfo):
|
||||||
return 0
|
return PrivilegesLevel.Community.int
|
||||||
return int(self.data.communityInfo.get().privilegesLevel)
|
return int(self.data.communityInfo.get().privilegesLevel)
|
||||||
|
|
||||||
QtProperty[int] communityPrivilegesLevel:
|
QtProperty[int] communityPrivilegesLevel:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import sequtils, sugar, times, options
|
import sequtils, sugar, times, options
|
||||||
import backend/collectibles as backend
|
import backend/collectibles as backend
|
||||||
import collectibles_item
|
import collectibles_item
|
||||||
|
import ../../../app_service/service/community_tokens/dto/community_token
|
||||||
|
|
||||||
proc collectibleToItem*(c: backend.CollectibleHeader, isPinned: bool = false) : Item =
|
proc collectibleToItem*(c: backend.CollectibleHeader, isPinned: bool = false) : Item =
|
||||||
var mediaUrl = c.animationUrl
|
var mediaUrl = c.animationUrl
|
||||||
@ -12,7 +13,7 @@ proc collectibleToItem*(c: backend.CollectibleHeader, isPinned: bool = false) :
|
|||||||
var communityId = ""
|
var communityId = ""
|
||||||
var communityName = ""
|
var communityName = ""
|
||||||
var communityColor = ""
|
var communityColor = ""
|
||||||
var communityPrivilegesLevel = 0
|
var communityPrivilegesLevel = PrivilegesLevel.Community.int
|
||||||
if isSome(c.communityHeader):
|
if isSome(c.communityHeader):
|
||||||
let communityHeader = c.communityHeader.get()
|
let communityHeader = c.communityHeader.get()
|
||||||
communityId = communityHeader.communityId
|
communityId = communityHeader.communityId
|
||||||
|
@ -143,13 +143,18 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
footer: WalletFooter {
|
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
|
visible: !root.showAllAccounts
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: root.showAllAccounts ? implicitHeight : 61
|
height: root.showAllAccounts ? implicitHeight : 61
|
||||||
walletStore: RootStore
|
walletStore: RootStore
|
||||||
networkConnectionStore: root.networkConnectionStore
|
networkConnectionStore: root.networkConnectionStore
|
||||||
isCommunityOwnershipTransfer: (!!walletStore.currentViewedCollectible && walletStore.currentViewedHoldingID !== "") ?
|
isCommunityOwnershipTransfer: footer.isHoldingSelected && footer.isOwnerCommunityCollectible
|
||||||
(walletStore.currentViewedCollectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false
|
|
||||||
communityName: !!walletStore.currentViewedCollectible ? walletStore.currentViewedCollectible.communityName : ""
|
communityName: !!walletStore.currentViewedCollectible ? walletStore.currentViewedCollectible.communityName : ""
|
||||||
onLaunchShareAddressModal: Global.openPopup(receiveModalComponent)
|
onLaunchShareAddressModal: Global.openPopup(receiveModalComponent)
|
||||||
onLaunchSendModal: {
|
onLaunchSendModal: {
|
||||||
|
@ -65,6 +65,7 @@ Item {
|
|||||||
isLoading: !!model.isLoading
|
isLoading: !!model.isLoading
|
||||||
privilegesLevel: model.communityPrivilegesLevel ?? Constants.TokenPrivilegesLevel.Community
|
privilegesLevel: model.communityPrivilegesLevel ?? Constants.TokenPrivilegesLevel.Community
|
||||||
ornamentColor: model.communityColor ?? "transparent"
|
ornamentColor: model.communityColor ?? "transparent"
|
||||||
|
communityId: model.communityId
|
||||||
|
|
||||||
onClicked: root.collectibleClicked(model.chainId, model.contractAddress, model.tokenId, model.uid)
|
onClicked: root.collectibleClicked(model.chainId, model.contractAddress, model.tokenId, model.uid)
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ Item {
|
|||||||
readonly property int isNarrowMode : width < 700
|
readonly property int isNarrowMode : width < 700
|
||||||
|
|
||||||
// Community related token props:
|
// 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 isOwnerTokenType: !!collectible ? (collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false
|
||||||
readonly property bool isTMasterTokenType: !!collectible ? (collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.TMaster) : false
|
readonly property bool isTMasterTokenType: !!collectible ? (collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.TMaster) : false
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ Item {
|
|||||||
PrivilegedTokenArtworkPanel {
|
PrivilegedTokenArtworkPanel {
|
||||||
id: privilegedCollectibleImage
|
id: privilegedCollectibleImage
|
||||||
|
|
||||||
visible: root.isOwnerTokenType || root.isTMasterTokenType
|
visible: root.isCommunityCollectible && (root.isOwnerTokenType || root.isTMasterTokenType)
|
||||||
size: root.isNarrowMode ? PrivilegedTokenArtworkPanel.Size.Medium : PrivilegedTokenArtworkPanel.Size.Large
|
size: root.isNarrowMode ? PrivilegedTokenArtworkPanel.Size.Medium : PrivilegedTokenArtworkPanel.Size.Large
|
||||||
artwork: collectible.imageUrl
|
artwork: collectible.imageUrl
|
||||||
color: !!collectible ? collectible.communityColor : "transparent"
|
color: !!collectible ? collectible.communityColor : "transparent"
|
||||||
|
@ -23,8 +23,10 @@ Control {
|
|||||||
property url fallbackImageUrl : ""
|
property url fallbackImageUrl : ""
|
||||||
property bool isLoading: false
|
property bool isLoading: false
|
||||||
property bool navigationIconVisible: false
|
property bool navigationIconVisible: false
|
||||||
|
property string communityId: ""
|
||||||
|
|
||||||
// Special Owner and TMaster token properties
|
// Special Owner and TMaster token properties
|
||||||
|
readonly property bool isCommunityCollectible: communityId !== ""
|
||||||
property int privilegesLevel: Constants.TokenPrivilegesLevel.Community
|
property int privilegesLevel: Constants.TokenPrivilegesLevel.Community
|
||||||
readonly property bool isPrivilegedToken: (privilegesLevel === Constants.TokenPrivilegesLevel.Owner) ||
|
readonly property bool isPrivilegedToken: (privilegesLevel === Constants.TokenPrivilegesLevel.Owner) ||
|
||||||
(privilegesLevel === Constants.TokenPrivilegesLevel.TMaster)
|
(privilegesLevel === Constants.TokenPrivilegesLevel.TMaster)
|
||||||
@ -52,7 +54,7 @@ Control {
|
|||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: width
|
Layout.preferredHeight: width
|
||||||
|
|
||||||
visible: !root.isPrivilegedToken
|
visible: !specialCollectible.visible
|
||||||
radius: 8
|
radius: 8
|
||||||
mediaUrl: root.mediaUrl
|
mediaUrl: root.mediaUrl
|
||||||
mediaType: root.mediaType
|
mediaType: root.mediaType
|
||||||
@ -70,12 +72,14 @@ Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PrivilegedTokenArtworkPanel {
|
PrivilegedTokenArtworkPanel {
|
||||||
|
id: specialCollectible
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Layout.margins: Style.current.halfPadding
|
Layout.margins: Style.current.halfPadding
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: width
|
Layout.preferredHeight: width
|
||||||
|
|
||||||
visible: root.isPrivilegedToken
|
visible: root.isCommunityCollectible && root.isPrivilegedToken
|
||||||
size: PrivilegedTokenArtworkPanel.Size.Medium
|
size: PrivilegedTokenArtworkPanel.Size.Medium
|
||||||
artwork: root.fallbackImageUrl
|
artwork: root.fallbackImageUrl
|
||||||
color: root.ornamentColor
|
color: root.ornamentColor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user