status-desktop/ui/app/AppLayouts/Profile/views/WalletView.qml

132 lines
3.6 KiB
QML
Raw Normal View History

import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
2022-03-15 13:38:20 +00:00
import StatusQ.Controls 0.1
import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.popups 1.0
import shared.status 1.0
import "../controls"
import "../popups"
import "../panels"
import "./wallet"
SettingsContentBase {
id: root
property var emojiPopup
property var rootStore
property var walletStore
2022-03-15 13:38:20 +00:00
readonly property int mainViewIndex: 0;
readonly property int networksViewIndex: 1;
readonly property int accountOrderViewIndex: 2;
readonly property int accountViewIndex: 3;
readonly property int dappPermissionViewIndex: 4;
function resetStack() {
stackContainer.currentIndex = mainViewIndex;
2022-03-15 13:38:20 +00:00
}
StackLayout {
id: stackContainer
2022-03-02 12:54:58 +00:00
width: root.contentWidth
currentIndex: mainViewIndex
onCurrentIndexChanged: {
root.rootStore.backButtonName = ""
root.sectionTitle = qsTr("Wallet")
root.titleRowComponentLoader.sourceComponent = undefined
2022-03-15 13:38:20 +00:00
if(currentIndex == root.networksViewIndex) {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = qsTr("Networks")
2022-03-15 13:38:20 +00:00
root.titleRowComponentLoader.sourceComponent = testnetModeSwitchComponent
}
else if(currentIndex == root.accountViewIndex) {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = ""
}
else if(currentIndex == root.dappPermissionViewIndex) {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = qsTr("DApp Permissions")
}
else if(currentIndex == root.accountOrderViewIndex) {
root.rootStore.backButtonName = qsTr("Wallet")
root.sectionTitle = qsTr("Edit account order")
}
}
MainView {
id: main
2022-03-15 13:38:20 +00:00
Layout.fillWidth: true
2022-03-15 13:38:20 +00:00
walletStore: root.walletStore
onGoToNetworksView: {
stackContainer.currentIndex = networksViewIndex
}
onGoToAccountView: {
accountView.account = account
stackContainer.currentIndex = accountViewIndex
}
onGoToAccountOrderView: {
stackContainer.currentIndex = accountOrderViewIndex
}
onGoToDappPermissionsView: {
stackContainer.currentIndex = dappPermissionViewIndex
}
}
NetworksView {
walletStore: root.walletStore
onGoBack: {
stackContainer.currentIndex = mainViewIndex
}
}
AccountOrderView {
walletStore: root.walletStore
onGoBack: {
stackContainer.currentIndex = mainViewIndex
}
}
AccountView {
id: accountView
walletStore: root.walletStore
emojiPopup: root.emojiPopup
onGoBack: {
stackContainer.currentIndex = mainViewIndex
}
}
DappPermissionsView {
walletStore: root.walletStore
}
Component {
id: testnetModeSwitchComponent
StatusSwitch {
2022-07-21 12:15:02 +00:00
objectName: "testnetModeSwitch"
text: qsTr("Testnet Mode")
checked: walletStore.areTestNetworksEnabled
onClicked: walletStore.toggleTestNetworksEnabled()
}
}
}
}