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
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
2021-10-05 20:50:22 +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.controls 1.0
|
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../controls"
|
|
|
|
import "../popups"
|
|
|
|
import "../stores"
|
|
|
|
|
2022-02-09 09:43:23 +00:00
|
|
|
Rectangle {
|
2022-07-18 10:39:31 +00:00
|
|
|
id: root
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
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 () {
|
2022-07-18 10:39:31 +00:00
|
|
|
root.changeSelectedAccount(RootStore.accounts.rowCount() - 1)
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
color: Style.current.secondaryMenuBackground
|
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
AddAccountModal {
|
|
|
|
id: addAccountModal
|
|
|
|
anchors.centerIn: parent
|
|
|
|
onAfterAddAccount: root.onAfterAddAccount()
|
|
|
|
emojiPopup: root.emojiPopup
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: Style.current.padding
|
|
|
|
anchors.bottomMargin: Style.current.smallPadding
|
|
|
|
spacing: Style.current.padding
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
StyledText {
|
2022-07-18 10:39:31 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
text: qsTr("Wallet")
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 17
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
Item {
|
|
|
|
height: childrenRect.height
|
|
|
|
Layout.fillWidth: true
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
StyledTextEdit {
|
|
|
|
id: walletAmountValue
|
|
|
|
color: Style.current.textColor
|
|
|
|
text: {
|
2022-07-26 18:46:07 +00:00
|
|
|
Utils.toLocaleString(parseFloat(RootStore.totalCurrencyBalance).toFixed(2), localAppSettings.language, {"currency": true}) + " " + RootStore.currentCurrency.toUpperCase()
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
|
|
|
selectByMouse: true
|
|
|
|
cursorVisible: true
|
|
|
|
readOnly: true
|
|
|
|
width: parent.width
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 22
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
StyledText {
|
|
|
|
id: totalValue
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
text: qsTr("Total value")
|
2022-03-10 17:01:17 +00:00
|
|
|
width: parent.width
|
2022-07-18 10:39:31 +00:00
|
|
|
anchors.top: walletAmountValue.bottom
|
|
|
|
anchors.topMargin: 4
|
|
|
|
font.pixelSize: 12
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
StatusListView {
|
|
|
|
spacing: Style.current.smallPadding
|
2022-07-18 10:39:31 +00:00
|
|
|
Layout.fillWidth: true
|
2022-07-19 15:36:09 +00:00
|
|
|
Layout.fillHeight: true
|
2022-07-18 10:39:31 +00:00
|
|
|
Layout.topMargin: Style.current.halfPadding
|
|
|
|
|
2022-07-20 14:54:30 +00:00
|
|
|
// ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
delegate: StatusListItem {
|
|
|
|
width: ListView.view.width
|
|
|
|
highlighted: RootStore.currentAccount.name === model.name
|
|
|
|
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.primaryColor3
|
|
|
|
statusListItemTitle.font.weight: Font.Medium
|
|
|
|
color: sensor.containsMouse || highlighted ? Theme.palette.baseColor3 : "transparent"
|
|
|
|
onClicked: {
|
|
|
|
changeSelectedAccount(index)
|
|
|
|
showSavedAddresses(false)
|
2022-03-28 08:19:57 +00:00
|
|
|
}
|
2022-07-14 11:03:36 +00:00
|
|
|
}
|
2022-03-28 08:19:57 +00:00
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
footer: Item {
|
|
|
|
width: ListView.view.width
|
|
|
|
height: addAccountBtn.height + Style.current.xlPadding
|
|
|
|
StatusButton {
|
|
|
|
id: addAccountBtn
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.margins: Style.current.bigPadding
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.weight: Font.Medium
|
|
|
|
icon.name: "add"
|
|
|
|
text: qsTr("Add account")
|
|
|
|
onClicked: addAccountModal.open()
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-14 11:03:36 +00:00
|
|
|
|
|
|
|
model: RootStore.accounts
|
|
|
|
// model: RootStore.exampleWalletModel
|
2022-07-18 10:39:31 +00:00
|
|
|
}
|
2022-03-01 10:14:13 +00:00
|
|
|
|
2022-07-18 10:39:31 +00:00
|
|
|
StatusButton {
|
|
|
|
size: StatusBaseButton.Size.Small
|
|
|
|
topPadding: Style.current.halfPadding
|
|
|
|
bottomPadding: Style.current.halfPadding
|
|
|
|
normalColor: "transparent"
|
|
|
|
hoverColor: Theme.palette.primaryColor3
|
|
|
|
font.weight: Font.Medium
|
|
|
|
text: qsTr("Saved addresses")
|
|
|
|
icon.name: "address"
|
|
|
|
onClicked: showSavedAddresses(true)
|
2022-03-01 10:14:13 +00:00
|
|
|
}
|
|
|
|
}
|
2022-07-26 18:46:07 +00:00
|
|
|
}
|