2022-08-31 17:09:07 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
import QtQml.Models 2.14
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2024-01-16 12:42:22 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0 as WalletStore
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2023-05-18 18:28:46 +00:00
|
|
|
property string keyPairKeyUid: ""
|
2022-08-31 17:09:07 +00:00
|
|
|
property string keyPairName: ""
|
|
|
|
property string keyPairIcon: ""
|
|
|
|
property string keyPairImage: ""
|
|
|
|
property string keyPairDerivedFrom: ""
|
2023-05-18 18:28:46 +00:00
|
|
|
property bool keyPairCardLocked: false
|
2022-12-16 09:37:08 +00:00
|
|
|
property var keyPairAccounts
|
2022-08-31 17:09:07 +00:00
|
|
|
|
2022-10-14 08:30:23 +00:00
|
|
|
color: Theme.palette.baseColor2
|
2022-08-31 17:09:07 +00:00
|
|
|
radius: Style.current.halfPadding
|
|
|
|
implicitWidth: 448
|
|
|
|
implicitHeight: 198
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
|
|
|
StatusListItem {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
color: "transparent"
|
|
|
|
title: root.keyPairName
|
|
|
|
|
2022-09-02 11:04:59 +00:00
|
|
|
asset {
|
2023-05-18 18:28:46 +00:00
|
|
|
width: root.keyPairIcon? 24 : 40
|
|
|
|
height: root.keyPairIcon? 24 : 40
|
|
|
|
name: root.keyPairImage? root.keyPairImage : root.keyPairIcon
|
|
|
|
isImage: !!root.keyPairImage
|
|
|
|
color: root.keyPairKeyUid === userProfile.keyUid?
|
|
|
|
Utils.colorForPubkey(userProfile.pubKey) :
|
|
|
|
root.keyPairCardLocked? Theme.palette.dangerColor1 : Theme.palette.primaryColor1
|
2022-09-13 10:03:25 +00:00
|
|
|
letterSize: Math.max(4, asset.width / 2.4)
|
2022-08-31 17:09:07 +00:00
|
|
|
charactersLen: 2
|
2023-05-18 18:28:46 +00:00
|
|
|
isLetterIdenticon: !root.keyPairIcon && !asset.name.toString()
|
|
|
|
bgColor: root.keyPairCardLocked? Theme.palette.dangerColor3 : Theme.palette.primaryColor3
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
color: Style.current.grey3
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.preferredWidth: parent.width - 2 * Style.current.padding
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
text: qsTr("Active Accounts")
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
}
|
|
|
|
|
2022-12-27 13:20:58 +00:00
|
|
|
StatusListView {
|
2022-08-31 17:09:07 +00:00
|
|
|
id: accounts
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
Layout.bottomMargin: Style.current.padding
|
|
|
|
clip: true
|
|
|
|
spacing: Style.current.halfPadding * 0.5
|
2022-12-16 09:37:08 +00:00
|
|
|
model: root.keyPairAccounts
|
2022-08-31 17:09:07 +00:00
|
|
|
|
|
|
|
delegate: Rectangle {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: parent.width - 2 * Style.current.padding
|
|
|
|
height: Style.current.xlPadding * 2
|
|
|
|
color: Theme.palette.statusModal.backgroundColor
|
|
|
|
radius: Style.current.halfPadding
|
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
|
|
|
|
ColumnLayout {
|
2023-02-24 09:08:51 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: balance
|
|
|
|
StatusBaseText {
|
2024-01-16 12:42:22 +00:00
|
|
|
text: LocaleUtils.currencyAmountToLocaleString(model.account.balance)
|
2023-02-24 09:08:51 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: fetchingBalance
|
|
|
|
StatusLoadingIndicator {
|
|
|
|
width: 12
|
|
|
|
height: 12
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: path
|
|
|
|
StatusBaseText {
|
|
|
|
text: model.account.path
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-31 17:09:07 +00:00
|
|
|
Row {
|
|
|
|
spacing: 0
|
|
|
|
padding: 0
|
|
|
|
StatusBaseText {
|
|
|
|
id: address
|
2022-12-16 09:37:08 +00:00
|
|
|
text: StatusQUtils.Utils.elideText(model.account.address, 6, 4)
|
2022-08-31 17:09:07 +00:00
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
font.pixelSize: Constants.keycard.general.fontSize2
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
height: 20
|
|
|
|
width: 20
|
|
|
|
icon.name: "external"
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
onClicked: {
|
2024-01-16 12:42:22 +00:00
|
|
|
let link = Utils.getUrlForAddressOnNetwork(Constants.networkShortChainNames.mainnet,
|
|
|
|
WalletStore.RootStore.areTestNetworksEnabled,
|
|
|
|
WalletStore.RootStore.isSepoliaEnabled,
|
|
|
|
model.account.address)
|
|
|
|
Global.openLink(link)
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-02-24 09:08:51 +00:00
|
|
|
Loader {
|
|
|
|
active: Global.appIsReady
|
|
|
|
sourceComponent: path
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: parent.height
|
|
|
|
}
|
|
|
|
|
2023-02-13 17:19:08 +00:00
|
|
|
Loader {
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2023-02-24 09:08:51 +00:00
|
|
|
sourceComponent: Global.appIsReady?
|
|
|
|
(model.account.balanceFetched? balance : fetchingBalance)
|
|
|
|
: path
|
2022-08-31 17:09:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|