status-desktop/ui/app/AppLayouts/Wallet/views/CollectiblesView.qml

89 lines
2.3 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1
import shared.panels 1.0
import "collectibles"
2020-05-28 14:54:42 +00:00
Item {
2020-08-18 18:46:11 +00:00
id: root
property var collectiblesModel
width: parent.width
signal collectibleClicked(string collectionSlug, int collectibleId)
2020-07-28 18:19:46 +00:00
readonly property bool areCollectionsLoaded: root.collectiblesModel.collectionsLoaded
Loader {
id: contentLoader
width: parent.width
height: parent.height
sourceComponent: {
if (!root.areCollectionsLoaded)
{
return loading
} else if (root.collectiblesModel.collectionCount === 0) {
return empty;
} else if (root.collectiblesModel.count === 0) {
return loading
}
return loaded;
}
}
Component {
id: loading
Item {
id: loadingIndicator
height: 164
StatusLoadingIndicator {
width: 20
height: 20
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
Component {
id: empty
Item {
StyledText {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
color: Style.current.secondaryText
text: qsTr("Collectibles will appear here")
font.pixelSize: 15
}
}
}
2020-08-18 18:46:11 +00:00
Component {
id: loaded
StatusGridView {
id: gridView
anchors.fill: parent
model: root.collectiblesModel
cellHeight: 229
cellWidth: 176
delegate: Item {
height: gridView.cellHeight
width: gridView.cellWidth
CollectibleView {
collectibleModel: model
anchors.fill: parent
anchors.bottomMargin: 4
onCollectibleClicked: {
root.collectibleClicked(slug, collectibleId);
}
}
}
2020-08-18 18:46:11 +00:00
}
2020-07-28 18:19:46 +00:00
}
2020-05-28 14:54:42 +00:00
}