2021-08-13 20:04:04 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
2021-09-14 16:23:02 +00:00
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.status 1.0
|
2021-09-14 16:23:02 +00:00
|
|
|
import "../controls"
|
|
|
|
import "../panels"
|
|
|
|
import "../popups"
|
2021-08-13 20:04:04 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: walletHeader
|
|
|
|
anchors.left: parent.left
|
2021-09-08 15:41:38 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
height: walletAddress.y + walletAddress.height
|
|
|
|
|
2021-09-14 16:23:02 +00:00
|
|
|
property var qrCode
|
|
|
|
property var accountsModel
|
|
|
|
property var currentAccount
|
|
|
|
property var enabledNetworksModel
|
|
|
|
property var allNetworksModel
|
|
|
|
signal copyText(string text)
|
2021-09-23 14:40:05 +00:00
|
|
|
signal toggleNetwork(int chainId)
|
2021-08-13 20:04:04 +00:00
|
|
|
|
2021-09-03 16:49:00 +00:00
|
|
|
Row {
|
|
|
|
id: accountRow
|
2021-09-14 16:23:02 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: 24
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 24
|
2021-09-03 16:49:00 +00:00
|
|
|
spacing: 8
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: title
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-09-14 16:23:02 +00:00
|
|
|
text: walletHeader.currentAccount.name
|
2021-09-03 16:49:00 +00:00
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 28
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: separatorDot
|
|
|
|
width: 8
|
|
|
|
height: 8
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.verticalCenterOffset: 1
|
|
|
|
color: Style.current.primary
|
|
|
|
radius: 50
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: walletBalance
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2021-09-14 16:23:02 +00:00
|
|
|
text: walletHeader.currentAccount.balance.toUpperCase()
|
2021-09-03 16:49:00 +00:00
|
|
|
font.pixelSize: 22
|
|
|
|
}
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
|
|
|
|
2021-09-03 16:49:00 +00:00
|
|
|
MouseArea {
|
|
|
|
anchors.fill: accountRow
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: {
|
2021-09-14 16:23:02 +00:00
|
|
|
//TOOD improve this to not use dynamic scoping
|
2021-09-03 16:49:00 +00:00
|
|
|
openPopup(shareModalComponent);
|
|
|
|
}
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
StatusExpandableAddress {
|
|
|
|
id: walletAddress
|
2021-09-03 16:49:00 +00:00
|
|
|
anchors.top: accountRow.bottom
|
|
|
|
anchors.left: accountRow.left
|
2021-08-13 20:04:04 +00:00
|
|
|
addressWidth: 180
|
2021-09-14 16:23:02 +00:00
|
|
|
address: walletHeader.currentAccount.address
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
|
|
|
|
2021-09-14 16:23:02 +00:00
|
|
|
NetworkSelectPanel {
|
2021-09-14 12:24:47 +00:00
|
|
|
id: networkSelect
|
2021-08-13 20:04:04 +00:00
|
|
|
anchors.right: parent.right
|
2021-09-14 16:23:02 +00:00
|
|
|
allNetworks: walletHeader.allNetworksModel
|
|
|
|
enabledNetworks: walletHeader.enabledNetworksModel
|
2021-09-23 14:40:05 +00:00
|
|
|
onToggleNetwork: {
|
|
|
|
walletHeader.toggleNetwork(chainId)
|
|
|
|
}
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|
2021-09-03 16:49:00 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: shareModalComponent
|
|
|
|
ShareModal {
|
2021-09-14 16:23:02 +00:00
|
|
|
anchors.centerIn: parent
|
|
|
|
qrCode: walletHeader.qrCode
|
|
|
|
accountsModel: walletHeader.accountsModel
|
|
|
|
selectedAccount: walletHeader.currentAccount
|
|
|
|
onCopy: {
|
|
|
|
walletHeader.copyText(text);
|
|
|
|
}
|
2021-09-03 16:49:00 +00:00
|
|
|
onClosed: {
|
2021-09-14 16:23:02 +00:00
|
|
|
this.destroy();
|
2021-09-03 16:49:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-13 20:04:04 +00:00
|
|
|
}
|