2020-06-17 19:18:31 +00:00
|
|
|
import QtQuick 2.13
|
2020-06-04 20:56:44 +00:00
|
|
|
import "./components"
|
2020-06-24 15:42:56 +00:00
|
|
|
import "./data"
|
2020-06-16 09:46:26 +00:00
|
|
|
import "../../../imports"
|
2020-06-19 18:06:58 +00:00
|
|
|
import "../../../shared"
|
2020-05-28 14:54:42 +00:00
|
|
|
|
|
|
|
Item {
|
2020-07-29 19:17:48 +00:00
|
|
|
Loader {
|
|
|
|
id: loadingImg
|
|
|
|
active: false
|
|
|
|
sourceComponent: loadingImageComponent
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.currentPadding
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: loadingImageComponent
|
|
|
|
LoadingImage {}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: walletModel
|
|
|
|
onLoadingTrxHistory: {
|
|
|
|
loadingImg.active = isLoading
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-16 09:46:26 +00:00
|
|
|
Component {
|
2020-06-17 16:02:33 +00:00
|
|
|
id: transactionListItemCmp
|
2020-06-16 09:46:26 +00:00
|
|
|
|
2020-06-17 16:02:33 +00:00
|
|
|
Rectangle {
|
|
|
|
id: transactionListItem
|
|
|
|
property bool isHovered: false
|
2020-06-24 15:42:56 +00:00
|
|
|
property string symbol: ""
|
2020-06-16 09:46:26 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.left: parent.left
|
|
|
|
height: 64
|
2020-07-16 12:06:08 +00:00
|
|
|
color: isHovered ? Style.current.secondaryBackground : Style.current.transparent
|
|
|
|
radius: 8
|
2020-06-17 16:02:33 +00:00
|
|
|
|
2020-06-24 15:42:56 +00:00
|
|
|
Component.onCompleted: {
|
2020-09-02 19:20:52 +00:00
|
|
|
// TODO: test if this work. I could not obtain any transaction history
|
|
|
|
for (let i = 0; i < walletModel.defaultTokenList.items.count; i++) {
|
|
|
|
let token = walletModel.defaultTokenList.items.get(i)
|
2020-06-24 15:42:56 +00:00
|
|
|
if (token.address == contract) {
|
|
|
|
transactionListItem.symbol = token.symbol
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-17 16:02:33 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
onClicked: transactionModal.open()
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
hoverEnabled: true
|
|
|
|
onEntered: {
|
|
|
|
transactionListItem.isHovered = true
|
|
|
|
}
|
|
|
|
onExited: {
|
|
|
|
transactionListItem.isHovered = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TransactionModal{
|
|
|
|
id: transactionModal
|
|
|
|
}
|
2020-06-16 09:46:26 +00:00
|
|
|
|
|
|
|
Item {
|
2020-06-24 15:42:56 +00:00
|
|
|
Image {
|
|
|
|
id: assetIcon
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
source: "../../img/tokens/" + (transactionListItem.symbol != "" ? transactionListItem.symbol : "ETH") + ".png"
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 12
|
|
|
|
onStatusChanged: {
|
|
|
|
if (assetIcon.status == Image.Error) {
|
|
|
|
assetIcon.source = "../../img/tokens/0-native.png"
|
|
|
|
}
|
|
|
|
}
|
2020-07-16 12:06:08 +00:00
|
|
|
|
|
|
|
anchors.leftMargin: Style.current.padding
|
2020-06-16 09:46:26 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-16 09:46:26 +00:00
|
|
|
id: transferIcon
|
|
|
|
anchors.topMargin: 25
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.left: assetIcon.right
|
|
|
|
anchors.leftMargin: 22
|
|
|
|
height: 15
|
|
|
|
width: 15
|
|
|
|
color: to != walletModel.currentAccount.address ? "#4360DF" : "green"
|
|
|
|
text: to != walletModel.currentAccount.address ? "↑" : "↓"
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-16 09:46:26 +00:00
|
|
|
id: transactionValue
|
|
|
|
anchors.left: transferIcon.right
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
2020-06-16 09:46:26 +00:00
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2020-06-16 09:46:26 +00:00
|
|
|
font.pixelSize: 15
|
2020-06-24 15:42:56 +00:00
|
|
|
text: value + " " + transactionListItem.symbol
|
2020-06-16 09:46:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
anchors.right: timeInfo.left
|
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2020-06-16 09:46:26 +00:00
|
|
|
width: children[0].width + children[1].width
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-16 09:46:26 +00:00
|
|
|
text: to != walletModel.currentAccount.address ? "To " : "From "
|
|
|
|
anchors.right: addressValue.left
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.darkGrey
|
2020-06-16 09:46:26 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.strikeout: false
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-16 09:46:26 +00:00
|
|
|
id: addressValue
|
2020-07-02 15:14:31 +00:00
|
|
|
font.family: Style.current.fontHexRegular.name
|
2020-06-16 09:46:26 +00:00
|
|
|
text: to
|
|
|
|
width: 100
|
|
|
|
elide: Text.ElideMiddle
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: parent.top
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: timeInfo
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: parent.top
|
2020-07-02 15:14:31 +00:00
|
|
|
anchors.topMargin: Style.current.bigPadding
|
2020-06-16 09:46:26 +00:00
|
|
|
width: children[0].width + children[1].width + children[2].width
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-16 09:46:26 +00:00
|
|
|
text: "• "
|
|
|
|
font.weight: Font.Bold
|
|
|
|
anchors.right: timeIndicator.left
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.darkGrey
|
2020-06-16 09:46:26 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-16 09:46:26 +00:00
|
|
|
id: timeIndicator
|
|
|
|
text: "At "
|
|
|
|
anchors.right: timeValue.left
|
2020-07-02 15:14:31 +00:00
|
|
|
color: Style.current.darkGrey
|
2020-06-16 09:46:26 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.strikeout: false
|
|
|
|
}
|
|
|
|
|
2020-06-19 18:06:58 +00:00
|
|
|
StyledText {
|
2020-06-16 09:46:26 +00:00
|
|
|
id: timeValue
|
|
|
|
text: timestamp
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.top: parent.top
|
|
|
|
font.pixelSize: 15
|
2020-07-16 12:06:08 +00:00
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
2020-06-16 09:46:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
2020-06-17 16:02:33 +00:00
|
|
|
anchors.topMargin: 20
|
|
|
|
anchors.fill: parent
|
|
|
|
model: walletModel.transactions
|
|
|
|
delegate: transactionListItemCmp
|
2020-05-28 14:54:42 +00:00
|
|
|
}
|
|
|
|
}
|
2020-06-17 22:58:39 +00:00
|
|
|
|
|
|
|
/*##^##
|
|
|
|
Designer {
|
|
|
|
D{i:0;autoSize:true;height:480;width:640}
|
|
|
|
}
|
|
|
|
##^##*/
|