status-desktop/ui/app/AppLayouts/WalletV2/panels/WalletHeaderPanel.qml

105 lines
2.6 KiB
QML
Raw Normal View History

2021-08-13 20:04:04 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.status 1.0
import "../controls"
import "../panels"
import "../popups"
2021-08-13 20:04:04 +00:00
Item {
id: walletHeader
anchors.left: parent.left
anchors.right: parent.right
height: walletAddress.y + walletAddress.height
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
Row {
id: accountRow
anchors.top: parent.top
anchors.topMargin: 24
anchors.left: parent.left
anchors.leftMargin: 24
spacing: 8
StyledText {
id: title
anchors.verticalCenter: parent.verticalCenter
text: walletHeader.currentAccount.name
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
text: walletHeader.currentAccount.balance.toUpperCase()
font.pixelSize: 22
}
2021-08-13 20:04:04 +00:00
}
MouseArea {
anchors.fill: accountRow
cursorShape: Qt.PointingHandCursor
onClicked: {
//TOOD improve this to not use dynamic scoping
openPopup(shareModalComponent);
}
2021-08-13 20:04:04 +00:00
}
StatusExpandableAddress {
id: walletAddress
anchors.top: accountRow.bottom
anchors.left: accountRow.left
2021-08-13 20:04:04 +00:00
addressWidth: 180
address: walletHeader.currentAccount.address
2021-08-13 20:04:04 +00:00
}
NetworkSelectPanel {
id: networkSelect
2021-08-13 20:04:04 +00:00
anchors.right: parent.right
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
}
Component {
id: shareModalComponent
ShareModal {
anchors.centerIn: parent
qrCode: walletHeader.qrCode
accountsModel: walletHeader.accountsModel
selectedAccount: walletHeader.currentAccount
onCopy: {
walletHeader.copyText(text);
}
onClosed: {
this.destroy();
}
}
}
2021-08-13 20:04:04 +00:00
}