2021-10-05 20:50:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
import QtGraphicalEffects 1.13
|
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.controls 1.0
|
|
|
|
|
2022-03-01 10:14:13 +00:00
|
|
|
import StatusQ.Components 0.1
|
2022-03-10 17:01:17 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-03-28 08:19:57 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-03-01 10:14:13 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../controls"
|
|
|
|
import "../popups"
|
|
|
|
import "../stores"
|
|
|
|
|
2022-02-09 09:43:23 +00:00
|
|
|
Rectangle {
|
2021-10-05 20:50:22 +00:00
|
|
|
id: walletInfoContainer
|
|
|
|
|
|
|
|
property var changeSelectedAccount: function(){}
|
2022-03-01 10:14:13 +00:00
|
|
|
property var showSavedAddresses: function(showSavedAddresses){}
|
2022-03-10 17:01:17 +00:00
|
|
|
property var emojiPopup: null
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
function onAfterAddAccount () {
|
|
|
|
walletInfoContainer.changeSelectedAccount(RootStore.accounts.rowCount() - 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
color: Style.current.secondaryMenuBackground
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: title
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Wallet")
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: walletValueTextContainer
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.padding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.padding
|
|
|
|
anchors.top: title.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
|
|
|
height: childrenRect.height
|
|
|
|
|
|
|
|
StyledTextEdit {
|
|
|
|
id: walletAmountValue
|
|
|
|
color: Style.current.textColor
|
2021-10-21 08:22:05 +00:00
|
|
|
text: {
|
|
|
|
Utils.toLocaleString(parseFloat(RootStore.totalCurrencyBalance).toFixed(2), localAppSettings.locale, {"currency": true}) + " " + RootStore.currentCurrency.toUpperCase()
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
selectByMouse: true
|
|
|
|
cursorVisible: true
|
|
|
|
readOnly: true
|
|
|
|
anchors.left: parent.left
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 30
|
|
|
|
}
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
id: totalValue
|
|
|
|
color: Style.current.secondaryText
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Total value")
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.left: walletAmountValue.left
|
|
|
|
anchors.top: walletAmountValue.bottom
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 13
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-28 08:19:57 +00:00
|
|
|
AddAccountModal {
|
|
|
|
id: addAccountModal
|
2022-03-10 17:01:17 +00:00
|
|
|
anchors.centerIn: parent
|
2021-10-05 20:50:22 +00:00
|
|
|
onAfterAddAccount: walletInfoContainer.onAfterAddAccount()
|
2022-03-10 17:01:17 +00:00
|
|
|
emojiPopup: walletInfoContainer.emojiPopup
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ScrollView {
|
|
|
|
anchors.bottom: parent.bottom
|
2022-03-01 10:14:13 +00:00
|
|
|
anchors.bottomMargin: btnSavedAddresses.height + Style.current.padding
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.top: walletValueTextContainer.bottom
|
|
|
|
anchors.topMargin: Style.current.padding
|
2022-03-10 17:01:17 +00:00
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: 272
|
2021-10-05 20:50:22 +00:00
|
|
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
|
|
ScrollBar.vertical.policy: listView.contentHeight > listView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
|
2022-03-01 10:14:13 +00:00
|
|
|
clip: true
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: listView
|
|
|
|
|
|
|
|
spacing: 5
|
2022-03-01 10:14:13 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
width: parent.width
|
|
|
|
height: parent.height
|
2021-10-05 20:50:22 +00:00
|
|
|
boundsBehavior: Flickable.StopAtBounds
|
2022-03-01 10:14:13 +00:00
|
|
|
clip: true
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-03-10 17:01:17 +00:00
|
|
|
delegate: StatusListItem {
|
|
|
|
width: parent.width
|
2022-03-24 11:23:38 +00:00
|
|
|
highlighted: RootStore.currentAccount.name === model.name
|
2022-03-10 17:01:17 +00:00
|
|
|
title: model.name
|
|
|
|
subTitle: Utils.toLocaleString(model.currencyBalance.toFixed(2), RootStore.locale, {"model.currency": true}) + " " + RootStore.currentCurrency.toUpperCase()
|
|
|
|
icon.emoji: !!model.emoji ? model.emoji: ""
|
|
|
|
icon.color: model.color
|
|
|
|
icon.name: !model.emoji ? "filled-account": ""
|
|
|
|
icon.letterSize: 14
|
|
|
|
icon.isLetterIdenticon: !!model.emoji ? true : false
|
|
|
|
icon.background.color: Theme.palette.indirectColor1
|
2021-10-05 20:50:22 +00:00
|
|
|
onClicked: {
|
|
|
|
changeSelectedAccount(index)
|
2022-03-01 10:14:13 +00:00
|
|
|
showSavedAddresses(false)
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-28 08:19:57 +00:00
|
|
|
footer: Item {
|
|
|
|
width: parent.width
|
|
|
|
height: addAccountBtn.height + Style.current.xlPadding
|
|
|
|
StatusButton {
|
|
|
|
id: addAccountBtn
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.margins: Style.current.bigPadding
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Add account")
|
2022-03-28 08:19:57 +00:00
|
|
|
onClicked: addAccountModal.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
model: RootStore.accounts
|
|
|
|
// model: RootStore.exampleWalletModel
|
|
|
|
}
|
|
|
|
}
|
2022-03-01 10:14:13 +00:00
|
|
|
|
|
|
|
StatusNavigationListItem {
|
|
|
|
id: btnSavedAddresses
|
|
|
|
|
|
|
|
anchors.bottom: parent.bottom
|
|
|
|
anchors.bottomMargin: Style.current.halfPadding
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: Style.current.smallPadding
|
|
|
|
|
|
|
|
title: qsTr("Saved addresses")
|
|
|
|
icon.name: "address"
|
|
|
|
onClicked: {
|
|
|
|
showSavedAddresses(true)
|
|
|
|
}
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|