2023-01-20 00:44:35 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.1
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2023-01-31 10:49:07 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2023-01-20 00:44:35 +00:00
|
|
|
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
2023-01-31 10:49:07 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2023-01-20 00:44:35 +00:00
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
2023-01-31 10:49:07 +00:00
|
|
|
property var collectibleModel
|
|
|
|
property bool isLoadingDelegate
|
2023-01-20 00:44:35 +00:00
|
|
|
|
|
|
|
signal collectibleClicked(string slug, int collectibleId)
|
|
|
|
|
2023-01-31 10:49:07 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property bool modeDataValid: !!root.collectibleModel && root.collectibleModel !== undefined
|
|
|
|
readonly property bool isLoaded: modeDataValid ? root.collectibleModel.collectionCollectiblesLoaded : false
|
|
|
|
}
|
|
|
|
|
|
|
|
implicitHeight: 225
|
|
|
|
implicitWidth: 176
|
2023-01-20 00:44:35 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
width: parent.width
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
StatusRoundedImage {
|
|
|
|
id: image
|
|
|
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
|
|
|
|
Layout.topMargin: 8
|
|
|
|
Layout.bottomMargin: 0
|
|
|
|
implicitWidth: 160
|
|
|
|
implicitHeight: 160
|
|
|
|
radius: 12
|
2023-01-31 10:49:07 +00:00
|
|
|
image.source: d.modeDataValid ? root.collectibleModel.imageUrl : ""
|
2023-01-20 00:44:35 +00:00
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
border.width: 1
|
|
|
|
showLoadingIndicator: true
|
2023-01-31 10:49:07 +00:00
|
|
|
color: d.modeDataValid ? root.collectibleModel.backgroundColor : "transparent"
|
|
|
|
Loader {
|
|
|
|
anchors.fill: parent
|
|
|
|
active: root.isLoadingDelegate
|
|
|
|
sourceComponent: LoadingComponent {radius: image.radius}
|
|
|
|
}
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
2023-01-31 10:49:07 +00:00
|
|
|
StatusTextWithLoadingState {
|
2023-01-20 00:44:35 +00:00
|
|
|
id: collectibleLabel
|
2023-01-31 10:49:07 +00:00
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.leftMargin: 8
|
2023-01-20 00:44:35 +00:00
|
|
|
Layout.topMargin: 9
|
2023-01-31 10:49:07 +00:00
|
|
|
Layout.preferredWidth: isLoadingDelegate ? 134 : 144
|
2023-01-20 00:44:35 +00:00
|
|
|
Layout.preferredHeight: 21
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
font.pixelSize: 15
|
2023-01-31 10:49:07 +00:00
|
|
|
customColor: Theme.palette.directColor1
|
2023-01-20 00:44:35 +00:00
|
|
|
font.weight: Font.DemiBold
|
|
|
|
elide: Text.ElideRight
|
2023-01-31 10:49:07 +00:00
|
|
|
text: isLoadingDelegate ? Constants.dummyText : d.isLoaded && d.modeDataValid ? root.collectibleModel.name : "..."
|
|
|
|
loading: root.isLoadingDelegate
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
2023-01-31 10:49:07 +00:00
|
|
|
StatusTextWithLoadingState {
|
2023-01-20 00:44:35 +00:00
|
|
|
id: collectionLabel
|
2023-01-31 10:49:07 +00:00
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
|
|
Layout.leftMargin: 8
|
|
|
|
Layout.preferredWidth: isLoadingDelegate ? 88 : 144
|
2023-01-20 00:44:35 +00:00
|
|
|
Layout.preferredHeight: 18
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
font.pixelSize: 13
|
2023-01-31 10:49:07 +00:00
|
|
|
customColor: Theme.palette.baseColor1
|
2023-01-20 00:44:35 +00:00
|
|
|
elide: Text.ElideRight
|
2023-01-31 10:49:07 +00:00
|
|
|
text: isLoadingDelegate ? Constants.dummyText : d.modeDataValid ? root.collectibleModel.collectionName : ""
|
|
|
|
loading: root.isLoadingDelegate
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
radius: 18
|
|
|
|
border.width: 1
|
|
|
|
border.color: Theme.palette.primaryColor1
|
|
|
|
color: Theme.palette.indirectColor3
|
2023-01-31 10:49:07 +00:00
|
|
|
visible: d.isLoaded && mouse.containsMouse
|
2023-01-20 00:44:35 +00:00
|
|
|
}
|
|
|
|
MouseArea {
|
|
|
|
id: mouse
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onClicked: {
|
2023-01-31 10:49:07 +00:00
|
|
|
if (d.isLoaded) {
|
2023-01-20 00:44:35 +00:00
|
|
|
root.collectibleClicked(root.collectibleModel.collectionSlug, root.collectibleModel.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-01-31 10:49:07 +00:00
|
|
|
}
|