status-desktop/ui/app/AppLayouts/Wallet/CollectiblesTab.qml

126 lines
3.4 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
2020-08-18 18:46:11 +00:00
import QtGraphicalEffects 1.13
import "../../../imports"
import "../../../shared"
import "./components/collectiblesComponents"
2020-05-28 14:54:42 +00:00
Item {
2020-08-18 18:46:11 +00:00
property bool isLoading: true
id: root
2020-07-28 18:19:46 +00:00
Loader {
2020-08-18 18:46:11 +00:00
active: true
sourceComponent: true || root.isLoading || walletModel.collectibles.rowCount() > 0 ? collectiblesListComponent
: noCollectiblesComponent
width: parent.width
}
Component {
2020-08-18 18:46:11 +00:00
id: noCollectiblesComponent
StyledText {
color: Style.current.secondaryText
text: qsTr("Collectibles will appear here")
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 15
visible: !root.isLoading && walletModel.collectibles.rowCount() === 0
}
}
CollectiblesModal {
id: collectiblesModalComponent
}
2020-08-18 18:46:11 +00:00
Component {
id: collectiblesListComponent
CollectiblesContainer {
collectibleName: "CryptoKitties"
collectibleIconSource: "../../img/collectibles/CryptoKitties.png"
isLoading: root.isLoading
collectiblesModal: collectiblesModalComponent
buttonText: qsTr("View in Cryptokitties")
getLink: function (id) {
return `https://www.cryptokitties.co/kitty/${id}`
}
2020-08-18 18:46:11 +00:00
}
2020-07-28 18:19:46 +00:00
}
Connections {
target: walletModel
onLoadingCollectibles: {
2020-08-18 18:46:11 +00:00
root.isLoading= isLoading
2020-07-28 18:19:46 +00:00
}
}
Component {
id: collectiblesViewDelegate
Item {
id: element
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
height: 132
SVGImage {
id: collectibleImage
width: 128
height: 128
source: image
anchors.left: parent.left
anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
id: collectibleName
text: name
anchors.verticalCenter: parent.verticalCenter
anchors.left: collectibleImage.right
anchors.leftMargin: Style.current.padding
2020-06-18 15:24:44 +00:00
font.pixelSize: 15
}
StyledText {
2020-06-18 15:24:44 +00:00
id: collectibleIdText
text: collectibleId
anchors.leftMargin: Style.current.padding
2020-06-18 15:24:44 +00:00
anchors.verticalCenter: parent.verticalCenter
anchors.left: collectibleName.right
color: Style.current.darkGrey
font.pixelSize: 15
}
}
}
ListModel {
id: exampleModel
ListElement {
name: "Kitty cat"
image: "../../img/token-icons/eth.svg"
2020-06-18 15:24:44 +00:00
collectibleId: "1337"
}
}
2020-08-18 18:46:11 +00:00
// ListView {
// id: assetListView
// spacing: Style.current.smallPadding
// anchors.topMargin: Style.current.bigPadding
// anchors.fill: parent
//// model: exampleModel
// model: walletModel.collectibles
// delegate: collectiblesViewDelegate
// }
2020-05-28 14:54:42 +00:00
}
2020-06-17 19:18:31 +00:00
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
2020-06-17 19:18:31 +00:00
}
##^##*/