2020-08-18 19:10:30 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2021-09-28 15:04:06 +00:00
|
|
|
|
2021-10-26 14:21:08 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared.panels 1.0
|
2020-08-18 19:10:30 +00:00
|
|
|
|
|
|
|
Rectangle {
|
2021-09-28 15:04:06 +00:00
|
|
|
property url collectibleIconSource: "CryptoKitties"
|
2020-08-18 19:10:30 +00:00
|
|
|
property string collectibleName: "CryptoKitties"
|
|
|
|
property bool isLoading: true
|
|
|
|
property bool hovered: false
|
2020-08-18 20:11:36 +00:00
|
|
|
property var toggleCollectible: function () {}
|
2020-08-19 21:09:11 +00:00
|
|
|
property int collectiblesQty: 6
|
2020-08-18 19:10:30 +00:00
|
|
|
|
|
|
|
id: collectibleHeader
|
|
|
|
height: 64
|
|
|
|
width: parent.width
|
|
|
|
color: hovered ? Style.current.backgroundHover : Style.current.transparent
|
|
|
|
border.width: 0
|
|
|
|
radius: Style.current.radius
|
|
|
|
|
|
|
|
Image {
|
|
|
|
id: collectibleIconImage
|
|
|
|
source: collectibleHeader.collectibleIconSource
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2023-04-26 15:33:24 +00:00
|
|
|
cache: false
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
2020-09-25 16:52:06 +00:00
|
|
|
id: collectibleName
|
2020-08-18 19:10:30 +00:00
|
|
|
text: collectibleHeader.collectibleName
|
|
|
|
anchors.left: collectibleIconImage.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2020-09-25 16:52:06 +00:00
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
visible: collectiblesQty >= Constants.maxTokens
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Maximum number of collectibles to display reached")
|
2020-09-25 16:52:06 +00:00
|
|
|
font.pixelSize: 17
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
anchors.left: collectibleName.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
active: true
|
|
|
|
sourceComponent: collectibleHeader.isLoading ? loadingComponent : handleComponent
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: loadingComponent
|
|
|
|
|
2021-04-26 10:25:01 +00:00
|
|
|
StatusLoadingIndicator {}
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: handleComponent
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: element1
|
|
|
|
width: childrenRect.width
|
|
|
|
height: numberCollectibleText.height
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: numberCollectibleText
|
|
|
|
color: Style.current.secondaryText
|
2020-08-24 20:50:49 +00:00
|
|
|
text: !!error ? "-" : collectibleHeader.collectiblesQty
|
2020-08-18 19:10:30 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
|
|
|
|
SVGImage {
|
|
|
|
id: caretImg
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-09-28 15:04:06 +00:00
|
|
|
source: Style.svg("caret")
|
2020-08-18 19:10:30 +00:00
|
|
|
width: 11
|
|
|
|
anchors.left: numberCollectibleText.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
}
|
|
|
|
ColorOverlay {
|
|
|
|
anchors.fill: caretImg
|
|
|
|
source: caretImg
|
|
|
|
color: Style.current.black
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
enabled: !collectibleHeader.isLoading
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
collectibleHeader.hovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
collectibleHeader.hovered = false
|
|
|
|
}
|
|
|
|
onClicked: {
|
2020-08-18 20:11:36 +00:00
|
|
|
collectibleHeader.toggleCollectible()
|
2020-08-18 19:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|