feat(savedaddresses): saved address added to wallet settings section

Part 2 of #13088
This commit is contained in:
Sale Djenic 2023-12-26 11:20:38 +01:00 committed by saledjenic
parent 3ac13a7678
commit 7983c97f7b
7 changed files with 73 additions and 5 deletions

View File

@ -185,7 +185,6 @@ StatusSectionLayout {
implicitWidth: parent.width implicitWidth: parent.width
implicitHeight: parent.height implicitHeight: parent.height
rootStore: root.store rootStore: root.store
walletStore: root.store.walletStore
tokensStore: root.tokensStore tokensStore: root.tokensStore
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.wallet) sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.wallet)

View File

@ -14,6 +14,8 @@ QtObject {
property var mainModuleInst: mainModule property var mainModuleInst: mainModule
property var profileSectionModuleInst: profileSectionModule property var profileSectionModuleInst: profileSectionModule
property var sendModalPopup
readonly property bool fetchingUpdate: aboutModuleInst.fetching readonly property bool fetchingUpdate: aboutModuleInst.fetching
property ContactsStore contactsStore: ContactsStore { property ContactsStore contactsStore: ContactsStore {

View File

@ -15,6 +15,7 @@ import shared.popups 1.0
import shared.popups.keypairimport 1.0 import shared.popups.keypairimport 1.0
import shared.status 1.0 import shared.status 1.0
import "../stores"
import "../controls" import "../controls"
import "../popups" import "../popups"
import "../panels" import "../panels"
@ -26,8 +27,8 @@ SettingsContentBase {
id: root id: root
property var emojiPopup property var emojiPopup
property var rootStore property ProfileSectionStore rootStore
property var walletStore property var walletStore: rootStore.walletStore
required property TokensStore tokensStore required property TokensStore tokensStore
readonly property int mainViewIndex: 0 readonly property int mainViewIndex: 0
@ -36,6 +37,7 @@ SettingsContentBase {
readonly property int accountOrderViewIndex: 3 readonly property int accountOrderViewIndex: 3
readonly property int accountViewIndex: 4 readonly property int accountViewIndex: 4
readonly property int manageTokensViewIndex: 5 readonly property int manageTokensViewIndex: 5
readonly property int savedAddressesViewIndex: 6
readonly property string walletSectionTitle: qsTr("Wallet") readonly property string walletSectionTitle: qsTr("Wallet")
readonly property string networksSectionTitle: qsTr("Networks") readonly property string networksSectionTitle: qsTr("Networks")
@ -86,6 +88,7 @@ SettingsContentBase {
stackContainer.currentIndex === root.editNetworksViewIndex ? editNetwork.height: stackContainer.currentIndex === root.editNetworksViewIndex ? editNetwork.height:
stackContainer.currentIndex === root.accountOrderViewIndex ? accountOrderView.height: stackContainer.currentIndex === root.accountOrderViewIndex ? accountOrderView.height:
stackContainer.currentIndex === root.manageTokensViewIndex ? manageTokensView.implicitHeight : stackContainer.currentIndex === root.manageTokensViewIndex ? manageTokensView.implicitHeight :
stackContainer.currentIndex === root.savedAddressesViewIndex ? savedAddressesView.height:
accountView.height accountView.height
currentIndex: mainViewIndex currentIndex: mainViewIndex
@ -134,6 +137,12 @@ SettingsContentBase {
root.rootStore.backButtonName = root.walletSectionTitle root.rootStore.backButtonName = root.walletSectionTitle
root.titleRowLeftComponentLoader.visible = false root.titleRowLeftComponentLoader.visible = false
root.sectionTitle = qsTr("Manage tokens") root.sectionTitle = qsTr("Manage tokens")
} else if(currentIndex == root.savedAddressesViewIndex) {
root.rootStore.backButtonName = root.walletSectionTitle
root.titleRowLeftComponentLoader.visible = false
root.sectionTitle = qsTr("Saved addresses")
root.titleRowComponentLoader.sourceComponent = addNewSavedAddressButtonComponent
} }
} }
@ -183,6 +192,9 @@ SettingsContentBase {
onGoToManageTokensView: { onGoToManageTokensView: {
stackContainer.currentIndex = manageTokensViewIndex stackContainer.currentIndex = manageTokensViewIndex
} }
onGoToSavedAddressesView: {
stackContainer.currentIndex = root.savedAddressesViewIndex
}
} }
NetworksView { NetworksView {
@ -288,6 +300,12 @@ SettingsContentBase {
} }
} }
SavedAddressesView {
id: savedAddressesView
contactsStore: root.rootStore.contactsStore
sendModal: root.rootStore.sendModalPopup
}
DappPermissionsView { DappPermissionsView {
walletStore: root.walletStore walletStore: root.walletStore
} }
@ -301,6 +319,17 @@ SettingsContentBase {
} }
} }
Component {
id: addNewSavedAddressButtonComponent
StatusButton {
text: qsTr("Add new address")
onClicked: {
Global.openAddEditSavedAddressesPopup({})
}
}
}
Component { Component {
id: networkIcon id: networkIcon
StatusRoundedImage { StatusRoundedImage {

View File

@ -25,11 +25,13 @@ Column {
signal goToAccountOrderView() signal goToAccountOrderView()
signal goToAccountView(var account, var keypair) signal goToAccountView(var account, var keypair)
signal goToDappPermissionsView() signal goToDappPermissionsView()
signal goToManageTokensView()
signal goToSavedAddressesView()
signal runRenameKeypairFlow(var model) signal runRenameKeypairFlow(var model)
signal runRemoveKeypairFlow(var model) signal runRemoveKeypairFlow(var model)
signal runMoveKeypairToKeycardFlow(var model) signal runMoveKeypairToKeycardFlow(var model)
signal runStopUsingKeycardFlow(var model) signal runStopUsingKeycardFlow(var model)
signal goToManageTokensView()
spacing: 8 spacing: 8
@ -155,6 +157,21 @@ Column {
Separator {} Separator {}
StatusListItem {
title: qsTr("Saved Addresses")
height: 64
width: parent.width
onClicked: goToSavedAddressesView()
components: [
StatusIcon {
icon: "next"
color: Theme.palette.baseColor1
}
]
}
Separator {}
Spacer { Spacer {
visible: root.walletStore.walletModule.hasPairedDevices visible: root.walletStore.walletModule.hasPairedDevices
width: parent.width width: parent.width

View File

@ -0,0 +1,18 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import AppLayouts.Wallet.views 1.0
import "../../stores"
ColumnLayout {
id: root
property ContactsStore contactsStore
property var sendModal
SavedAddresses {
sendModal: root.sendModal
contactsStore: root.contactsStore
}
}

View File

@ -7,3 +7,4 @@ MainView 1.0 MainView.qml
ManageTokensView 1.0 ManageTokensView.qml ManageTokensView 1.0 ManageTokensView.qml
NetworksView 1.0 NetworksView.qml NetworksView 1.0 NetworksView.qml
PermissionsListView 1.0 PermissionsListView.qml PermissionsListView 1.0 PermissionsListView.qml
SavedAddressesView 1.0 SavedAddressesView.qml

View File

@ -54,7 +54,9 @@ Item {
id: appMain id: appMain
property alias appLayout: appLayout property alias appLayout: appLayout
property RootStore rootStore: RootStore {} property RootStore rootStore: RootStore {
profileSectionStore.sendModalPopup: sendModal
}
property var rootChatStore: ChatStores.RootStore { property var rootChatStore: ChatStores.RootStore {
contactsStore: appMain.rootStore.contactStore contactsStore: appMain.rootStore.contactStore
communityTokensStore: appMain.communityTokensStore communityTokensStore: appMain.communityTokensStore