2022-11-28 21:05:57 +00:00
|
|
|
import QtQuick 2.14
|
2021-10-21 08:22:05 +00:00
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
2023-03-06 16:46:32 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2021-10-21 08:22:05 +00:00
|
|
|
|
2023-09-20 13:01:37 +00:00
|
|
|
import AppLayouts.Communities.panels 1.0
|
|
|
|
|
2022-07-28 20:56:44 +00:00
|
|
|
import utils 1.0
|
|
|
|
import shared.controls 1.0
|
2024-02-26 02:32:59 +00:00
|
|
|
import shared.views 1.0
|
2022-07-28 20:56:44 +00:00
|
|
|
|
2021-12-06 21:10:54 +00:00
|
|
|
import "../../stores"
|
2021-10-21 08:22:05 +00:00
|
|
|
import "../../controls"
|
|
|
|
|
2022-07-28 20:56:44 +00:00
|
|
|
Item {
|
2021-10-21 08:22:05 +00:00
|
|
|
id: root
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
signal launchTransactionDetail(string txID)
|
|
|
|
|
2024-02-26 02:32:59 +00:00
|
|
|
required property var rootStore
|
|
|
|
required property var walletRootStore
|
|
|
|
required property var communitiesStore
|
|
|
|
|
|
|
|
required property var collectible
|
|
|
|
property var activityModel
|
2023-07-17 23:56:40 +00:00
|
|
|
property bool isCollectibleLoading
|
2022-11-22 19:31:07 +00:00
|
|
|
|
2023-09-20 13:01:37 +00:00
|
|
|
// Community related token props:
|
2023-09-27 14:03:49 +00:00
|
|
|
readonly property bool isCommunityCollectible: !!collectible ? collectible.communityId !== "" : false
|
2023-09-20 13:01:37 +00:00
|
|
|
readonly property bool isOwnerTokenType: !!collectible ? (collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.Owner) : false
|
|
|
|
readonly property bool isTMasterTokenType: !!collectible ? (collectible.communityPrivilegesLevel === Constants.TokenPrivilegesLevel.TMaster) : false
|
|
|
|
|
2024-03-11 10:08:40 +00:00
|
|
|
readonly property var communityDetails: isCommunityCollectible ? root.communitiesStore.getCommunityDetailsAsJson(collectible.communityId) : null
|
|
|
|
|
2021-10-21 08:22:05 +00:00
|
|
|
CollectibleDetailsHeader {
|
|
|
|
id: collectibleHeader
|
2022-07-28 20:56:44 +00:00
|
|
|
anchors.top: parent.top
|
2021-10-21 08:22:05 +00:00
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
2024-03-11 10:08:40 +00:00
|
|
|
collectibleName: collectible.name
|
|
|
|
collectibleId: "#" + collectible.tokenId
|
|
|
|
collectionTag.tagPrimaryLabel.text: !!communityDetails ? communityDetails.name : collectible.collectionName
|
|
|
|
isCollection: !!collectible.collectionName
|
|
|
|
communityImage: !!communityDetails ? communityDetails.image: ""
|
2023-07-17 23:56:40 +00:00
|
|
|
networkShortName: collectible.networkShortName
|
|
|
|
networkColor: collectible.networkColor
|
|
|
|
networkIconURL: collectible.networkIconUrl
|
2024-03-11 10:08:40 +00:00
|
|
|
networkExplorerName: root.walletRootStore.getExplorerNameForNetwork(collectible.networkShortName)
|
|
|
|
onCollectionTagClicked: {
|
|
|
|
if (root.isCommunityCollectible) {
|
|
|
|
Global.switchToCommunity(collectible.communityId)
|
|
|
|
}
|
|
|
|
/* TODO for non community token link out to collection on opensea
|
|
|
|
https://github.com/status-im/status-desktop/issues/13918 */
|
|
|
|
|
|
|
|
}
|
|
|
|
onOpenCollectibleExternally: {
|
|
|
|
/* TODO add link out to opensea
|
|
|
|
https://github.com/status-im/status-desktop/issues/13918 */
|
|
|
|
}
|
2024-03-19 09:49:09 +00:00
|
|
|
onOpenCollectibleOnExplorer: Global.openLink(root.walletRootStore.getExplorerUrl(collectible.networkShortName, collectible.contractAddress, collectible.tokenId))
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
|
|
|
|
2022-07-28 20:56:44 +00:00
|
|
|
ColumnLayout {
|
2022-11-28 21:05:57 +00:00
|
|
|
id: collectibleBody
|
2021-10-21 08:22:05 +00:00
|
|
|
anchors.top: collectibleHeader.bottom
|
2022-11-28 21:05:57 +00:00
|
|
|
anchors.topMargin: 25
|
2022-07-28 20:56:44 +00:00
|
|
|
anchors.left: parent.left
|
2024-03-11 10:08:40 +00:00
|
|
|
anchors.leftMargin: 52
|
2022-07-28 20:56:44 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
|
|
|
|
spacing: Style.current.padding
|
2021-10-21 08:22:05 +00:00
|
|
|
|
|
|
|
Row {
|
|
|
|
id: collectibleImageDetails
|
2023-09-20 13:01:37 +00:00
|
|
|
|
|
|
|
readonly property real visibleImageHeight: (collectibleimage.visible ? collectibleimage.height : privilegedCollectibleImage.height)
|
|
|
|
readonly property real visibleImageWidth: (collectibleimage.visible ? collectibleimage.width : privilegedCollectibleImage.width)
|
|
|
|
|
|
|
|
Layout.preferredHeight: collectibleImageDetails.visibleImageHeight
|
2022-07-28 20:56:44 +00:00
|
|
|
Layout.preferredWidth: parent.width
|
2021-10-21 08:22:05 +00:00
|
|
|
spacing: 24
|
|
|
|
|
2023-09-20 13:01:37 +00:00
|
|
|
// Special artwork representation for community `Owner and Master Token` token types:
|
|
|
|
PrivilegedTokenArtworkPanel {
|
|
|
|
id: privilegedCollectibleImage
|
|
|
|
|
2023-09-27 14:03:49 +00:00
|
|
|
visible: root.isCommunityCollectible && (root.isOwnerTokenType || root.isTMasterTokenType)
|
2024-03-11 10:08:40 +00:00
|
|
|
size: PrivilegedTokenArtworkPanel.Size.Large
|
2023-09-20 13:01:37 +00:00
|
|
|
artwork: collectible.imageUrl
|
2024-02-26 02:32:59 +00:00
|
|
|
color: !!collectible && root.isCommunityCollectible? collectible.communityColor : "transparent"
|
2023-09-20 13:01:37 +00:00
|
|
|
isOwner: root.isOwnerTokenType
|
|
|
|
}
|
|
|
|
|
2023-04-03 15:38:05 +00:00
|
|
|
StatusRoundedMedia {
|
2021-10-21 08:22:05 +00:00
|
|
|
id: collectibleimage
|
2023-09-20 13:01:37 +00:00
|
|
|
|
|
|
|
visible: !privilegedCollectibleImage.visible
|
2024-03-11 10:08:40 +00:00
|
|
|
width: 248
|
|
|
|
height: width
|
|
|
|
radius: Style.current.radius
|
2023-07-17 23:56:40 +00:00
|
|
|
color: collectible.backgroundColor
|
2021-10-21 08:22:05 +00:00
|
|
|
border.color: Theme.palette.directColor8
|
|
|
|
border.width: 1
|
2024-02-26 02:32:59 +00:00
|
|
|
mediaUrl: collectible.mediaUrl ?? ""
|
|
|
|
mediaType: collectible.mediaType ?? ""
|
2023-07-17 23:56:40 +00:00
|
|
|
fallbackImageUrl: collectible.imageUrl
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
2022-11-28 21:05:57 +00:00
|
|
|
|
|
|
|
Column {
|
|
|
|
id: collectibleNameAndDescription
|
|
|
|
spacing: 12
|
|
|
|
|
2023-09-20 13:01:37 +00:00
|
|
|
width: parent.width - collectibleImageDetails.visibleImageWidth - Style.current.bigPadding
|
2022-11-28 21:05:57 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: collectibleName
|
|
|
|
width: parent.width
|
|
|
|
height: 24
|
|
|
|
|
2024-03-11 10:08:40 +00:00
|
|
|
text: root.isCommunityCollectible && !!communityDetails ? qsTr("Minted by %1").arg(root.communityDetails.name): root.collectible.collectionName
|
2022-11-28 21:05:57 +00:00
|
|
|
color: Theme.palette.directColor1
|
|
|
|
font.pixelSize: 17
|
|
|
|
lineHeight: 24
|
2024-03-11 10:08:40 +00:00
|
|
|
lineHeightMode: Text.FixedHeight
|
2022-11-28 21:05:57 +00:00
|
|
|
elide: Text.ElideRight
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusScrollView {
|
|
|
|
id: descriptionScrollView
|
|
|
|
width: parent.width
|
|
|
|
height: collectibleImageDetails.height - collectibleName.height - parent.spacing
|
|
|
|
|
|
|
|
contentWidth: availableWidth
|
|
|
|
|
|
|
|
padding: 0
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
id: descriptionText
|
|
|
|
width: descriptionScrollView.availableWidth
|
|
|
|
|
2023-07-17 23:56:40 +00:00
|
|
|
text: collectible.description
|
2022-11-28 21:05:57 +00:00
|
|
|
textFormat: Text.MarkdownText
|
|
|
|
color: Theme.palette.directColor4
|
|
|
|
font.pixelSize: 15
|
|
|
|
lineHeight: 22
|
|
|
|
lineHeightMode: Text.FixedHeight
|
|
|
|
elide: Text.ElideRight
|
|
|
|
wrapMode: Text.Wrap
|
|
|
|
}
|
|
|
|
}
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-07-28 20:56:44 +00:00
|
|
|
StatusTabBar {
|
|
|
|
id: collectiblesDetailsTab
|
|
|
|
Layout.fillWidth: true
|
2024-03-11 10:08:40 +00:00
|
|
|
Layout.topMargin: Style.current.xlPadding
|
2023-07-17 23:56:40 +00:00
|
|
|
visible: collectible.traits.count > 0
|
2021-10-21 08:22:05 +00:00
|
|
|
|
2022-07-28 20:56:44 +00:00
|
|
|
StatusTabButton {
|
|
|
|
leftPadding: 0
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Properties")
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
2024-02-26 02:32:59 +00:00
|
|
|
StatusTabButton {
|
|
|
|
rightPadding: 0
|
|
|
|
width: implicitWidth
|
|
|
|
text: qsTr("Activity")
|
|
|
|
}
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
|
|
|
|
2022-11-28 21:05:57 +00:00
|
|
|
StatusScrollView {
|
|
|
|
id: scrollView
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2023-05-31 20:58:23 +00:00
|
|
|
contentWidth: availableWidth
|
2024-02-26 02:32:59 +00:00
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: tabLoader
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
sourceComponent: {
|
|
|
|
switch (collectiblesDetailsTab.currentIndex) {
|
|
|
|
case 0: return traitsView
|
|
|
|
case 1: return activityView
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: traitsView
|
|
|
|
Flow {
|
|
|
|
width: scrollView.availableWidth
|
|
|
|
spacing: 10
|
|
|
|
Repeater {
|
|
|
|
model: collectible.traits
|
|
|
|
InformationTile {
|
|
|
|
maxWidth: parent.width
|
|
|
|
primaryText: model.traitType
|
|
|
|
secondaryText: model.value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: activityView
|
|
|
|
StatusListView {
|
|
|
|
width: scrollView.availableWidth
|
|
|
|
height: scrollView.availableHeight
|
|
|
|
model: root.activityModel
|
|
|
|
delegate: TransactionDelegate {
|
|
|
|
required property var model
|
|
|
|
required property int index
|
|
|
|
width: parent.width
|
|
|
|
modelData: model.activityEntry
|
|
|
|
timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000, true) : ""
|
|
|
|
rootStore: root.rootStore
|
|
|
|
walletRootStore: root.walletRootStore
|
|
|
|
showAllAccounts: root.walletRootStore.showAllAccounts
|
|
|
|
displayValues: true
|
|
|
|
community: isModelDataValid && !!communityId && !!root.communitiesStore ? root.communitiesStore.getCommunityDetailsAsJson(communityId) : null
|
|
|
|
loading: false
|
|
|
|
onClicked: {
|
2024-02-29 14:53:08 +00:00
|
|
|
if (mouse.button === Qt.RightButton) {
|
|
|
|
// TODO: Implement context menu
|
|
|
|
} else {
|
|
|
|
root.launchTransactionDetail(modelData.id)
|
|
|
|
}
|
2024-02-26 02:32:59 +00:00
|
|
|
}
|
|
|
|
}
|
2021-10-21 08:22:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|