2020-08-18 20:11:36 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtGraphicalEffects 1.13
|
2020-08-19 21:09:11 +00:00
|
|
|
import QtQml.Models 2.13
|
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
|
2021-10-20 10:21:23 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2020-08-18 20:11:36 +00:00
|
|
|
ScrollView {
|
2021-10-05 20:50:22 +00:00
|
|
|
id: collectiblesContent
|
|
|
|
|
2020-08-18 20:11:36 +00:00
|
|
|
readonly property int imageSize: 164
|
2020-08-19 15:58:25 +00:00
|
|
|
property var collectiblesModal
|
|
|
|
property string buttonText: "View in Cryptokitties"
|
|
|
|
property var getLink: function () {}
|
2020-08-20 21:59:07 +00:00
|
|
|
property var collectibles: []
|
2020-08-18 20:11:36 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
signal reloadCollectibles(string collectibleType)
|
|
|
|
|
2020-08-24 20:50:49 +00:00
|
|
|
height: visible ? contentLoader.item.height : 0
|
2020-08-18 20:11:36 +00:00
|
|
|
width: parent.width
|
|
|
|
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
|
|
|
|
clip: true
|
|
|
|
|
2020-08-24 20:50:49 +00:00
|
|
|
Loader {
|
|
|
|
id: contentLoader
|
|
|
|
active: true
|
|
|
|
width: parent.width
|
2021-10-05 20:50:22 +00:00
|
|
|
height: collectiblesContent.imageSize
|
2020-08-24 20:50:49 +00:00
|
|
|
sourceComponent: !!error ? errorComponent : collectiblesContentComponent
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: errorComponent
|
2020-08-18 20:11:36 +00:00
|
|
|
|
2020-08-24 20:50:49 +00:00
|
|
|
Item {
|
|
|
|
width: parent.width
|
2021-10-05 20:50:22 +00:00
|
|
|
height: collectiblesContent.imageSize
|
2020-08-18 20:11:36 +00:00
|
|
|
|
2020-08-24 20:50:49 +00:00
|
|
|
Item {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
height: childrenRect.height
|
|
|
|
width: somethingWentWrongText.width
|
2020-08-18 20:11:36 +00:00
|
|
|
|
2020-08-24 20:50:49 +00:00
|
|
|
StyledText {
|
|
|
|
id: somethingWentWrongText
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Something went wrong")
|
2020-08-24 20:50:49 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
font.pixelSize: 13
|
2020-08-18 20:11:36 +00:00
|
|
|
}
|
2020-08-19 15:58:25 +00:00
|
|
|
|
2021-01-28 11:04:10 +00:00
|
|
|
StatusButton {
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Reload")
|
2020-08-24 20:50:49 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: somethingWentWrongText.bottom
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
2020-08-19 15:58:25 +00:00
|
|
|
onClicked: {
|
2021-12-06 21:10:54 +00:00
|
|
|
reloadCollectibles(collectibleType);
|
2020-08-24 20:50:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: collectiblesContentComponent
|
|
|
|
|
|
|
|
Row {
|
|
|
|
id: contentRow
|
|
|
|
bottomPadding: Style.current.padding
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
model: collectibles
|
|
|
|
|
2020-08-27 14:41:50 +00:00
|
|
|
Item {
|
2020-08-24 20:50:49 +00:00
|
|
|
width: collectibleImage.width
|
|
|
|
height: collectibleImage.height
|
2020-08-27 14:41:50 +00:00
|
|
|
clip: true
|
2020-08-24 20:50:49 +00:00
|
|
|
|
2020-10-06 04:16:36 +00:00
|
|
|
RoundedImage {
|
2020-08-24 20:50:49 +00:00
|
|
|
id: collectibleImage
|
2021-10-05 20:50:22 +00:00
|
|
|
width: collectiblesContent.imageSize
|
|
|
|
height: collectiblesContent.imageSize
|
2020-10-06 04:16:36 +00:00
|
|
|
border.width: 1
|
|
|
|
border.color: Style.current.border
|
|
|
|
radius: 16
|
2020-08-24 20:50:49 +00:00
|
|
|
source: modelData.image
|
|
|
|
fillMode: Image.PreserveAspectCrop
|
2020-08-27 14:41:50 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
2020-08-24 20:50:49 +00:00
|
|
|
onClicked: {
|
|
|
|
collectiblesModal.openModal({
|
|
|
|
name: modelData.name,
|
|
|
|
id: modelData.id,
|
|
|
|
description: modelData.description,
|
2021-10-05 20:50:22 +00:00
|
|
|
buttonText: collectiblesContent.buttonText,
|
|
|
|
link: collectiblesContent.getLink(modelData.id, modelData.externalUrl),
|
2020-08-24 20:50:49 +00:00
|
|
|
image: modelData.image
|
|
|
|
})
|
|
|
|
}
|
2020-08-19 15:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-18 20:11:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|