status-desktop/ui/app/AppLayouts/WalletV2/panels/WalletHeaderPanel.qml
Alexandra Betouni f0b39ce4f6 Refactor: Moved openPopup function to Global
The openPopup function was declared in AppMain
and used via dynamic scoping in many places in the
application. Moved function to Global component
and updated all places to call it via Global instead.

Closes #4267
2022-02-01 11:38:46 +01:00

104 lines
2.6 KiB
QML

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"
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)
signal toggleNetwork(int chainId)
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
}
}
MouseArea {
anchors.fill: accountRow
cursorShape: Qt.PointingHandCursor
onClicked: {
Global.openPopup(shareModalComponent);
}
}
StatusExpandableAddress {
id: walletAddress
anchors.top: accountRow.bottom
anchors.left: accountRow.left
addressWidth: 180
address: walletHeader.currentAccount.address
}
NetworkSelectPanel {
id: networkSelect
anchors.right: parent.right
allNetworks: walletHeader.allNetworksModel
enabledNetworks: walletHeader.enabledNetworksModel
onToggleNetwork: {
walletHeader.toggleNetwork(chainId)
}
}
Component {
id: shareModalComponent
ShareModal {
anchors.centerIn: parent
qrCode: walletHeader.qrCode
accountsModel: walletHeader.accountsModel
selectedAccount: walletHeader.currentAccount
onCopy: {
walletHeader.copyText(text);
}
onClosed: {
this.destroy();
}
}
}
}