From 7983c97f7b0420bd9857c688dc91906f36b82372 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Tue, 26 Dec 2023 11:20:38 +0100 Subject: [PATCH] feat(savedaddresses): saved address added to wallet settings section Part 2 of #13088 --- ui/app/AppLayouts/Profile/ProfileLayout.qml | 1 - .../Profile/stores/ProfileSectionStore.qml | 2 ++ .../AppLayouts/Profile/views/WalletView.qml | 33 +++++++++++++++++-- .../Profile/views/wallet/MainView.qml | 19 ++++++++++- .../views/wallet/SavedAddressesView.qml | 18 ++++++++++ ui/app/AppLayouts/Profile/views/wallet/qmldir | 1 + ui/app/mainui/AppMain.qml | 4 ++- 7 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index efa0e46723..9e9f99d1a4 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -185,7 +185,6 @@ StatusSectionLayout { implicitWidth: parent.width implicitHeight: parent.height rootStore: root.store - walletStore: root.store.walletStore tokensStore: root.tokensStore emojiPopup: root.emojiPopup sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.wallet) diff --git a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml index 2b129cc6b2..818078f400 100644 --- a/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml +++ b/ui/app/AppLayouts/Profile/stores/ProfileSectionStore.qml @@ -14,6 +14,8 @@ QtObject { property var mainModuleInst: mainModule property var profileSectionModuleInst: profileSectionModule + property var sendModalPopup + readonly property bool fetchingUpdate: aboutModuleInst.fetching property ContactsStore contactsStore: ContactsStore { diff --git a/ui/app/AppLayouts/Profile/views/WalletView.qml b/ui/app/AppLayouts/Profile/views/WalletView.qml index 13fd6b7a07..71880d0e69 100644 --- a/ui/app/AppLayouts/Profile/views/WalletView.qml +++ b/ui/app/AppLayouts/Profile/views/WalletView.qml @@ -15,6 +15,7 @@ import shared.popups 1.0 import shared.popups.keypairimport 1.0 import shared.status 1.0 +import "../stores" import "../controls" import "../popups" import "../panels" @@ -26,8 +27,8 @@ SettingsContentBase { id: root property var emojiPopup - property var rootStore - property var walletStore + property ProfileSectionStore rootStore + property var walletStore: rootStore.walletStore required property TokensStore tokensStore readonly property int mainViewIndex: 0 @@ -36,6 +37,7 @@ SettingsContentBase { readonly property int accountOrderViewIndex: 3 readonly property int accountViewIndex: 4 readonly property int manageTokensViewIndex: 5 + readonly property int savedAddressesViewIndex: 6 readonly property string walletSectionTitle: qsTr("Wallet") readonly property string networksSectionTitle: qsTr("Networks") @@ -86,6 +88,7 @@ SettingsContentBase { stackContainer.currentIndex === root.editNetworksViewIndex ? editNetwork.height: stackContainer.currentIndex === root.accountOrderViewIndex ? accountOrderView.height: stackContainer.currentIndex === root.manageTokensViewIndex ? manageTokensView.implicitHeight : + stackContainer.currentIndex === root.savedAddressesViewIndex ? savedAddressesView.height: accountView.height currentIndex: mainViewIndex @@ -134,6 +137,12 @@ SettingsContentBase { root.rootStore.backButtonName = root.walletSectionTitle root.titleRowLeftComponentLoader.visible = false 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: { stackContainer.currentIndex = manageTokensViewIndex } + onGoToSavedAddressesView: { + stackContainer.currentIndex = root.savedAddressesViewIndex + } } NetworksView { @@ -288,6 +300,12 @@ SettingsContentBase { } } + SavedAddressesView { + id: savedAddressesView + contactsStore: root.rootStore.contactsStore + sendModal: root.rootStore.sendModalPopup + } + DappPermissionsView { walletStore: root.walletStore } @@ -301,6 +319,17 @@ SettingsContentBase { } } + Component { + id: addNewSavedAddressButtonComponent + + StatusButton { + text: qsTr("Add new address") + onClicked: { + Global.openAddEditSavedAddressesPopup({}) + } + } + } + Component { id: networkIcon StatusRoundedImage { diff --git a/ui/app/AppLayouts/Profile/views/wallet/MainView.qml b/ui/app/AppLayouts/Profile/views/wallet/MainView.qml index aef20c8b6f..42beeca323 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/MainView.qml +++ b/ui/app/AppLayouts/Profile/views/wallet/MainView.qml @@ -25,11 +25,13 @@ Column { signal goToAccountOrderView() signal goToAccountView(var account, var keypair) signal goToDappPermissionsView() + signal goToManageTokensView() + signal goToSavedAddressesView() + signal runRenameKeypairFlow(var model) signal runRemoveKeypairFlow(var model) signal runMoveKeypairToKeycardFlow(var model) signal runStopUsingKeycardFlow(var model) - signal goToManageTokensView() spacing: 8 @@ -155,6 +157,21 @@ Column { Separator {} + StatusListItem { + title: qsTr("Saved Addresses") + height: 64 + width: parent.width + onClicked: goToSavedAddressesView() + components: [ + StatusIcon { + icon: "next" + color: Theme.palette.baseColor1 + } + ] + } + + Separator {} + Spacer { visible: root.walletStore.walletModule.hasPairedDevices width: parent.width diff --git a/ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml b/ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml new file mode 100644 index 0000000000..98bdbf09f1 --- /dev/null +++ b/ui/app/AppLayouts/Profile/views/wallet/SavedAddressesView.qml @@ -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 + } +} diff --git a/ui/app/AppLayouts/Profile/views/wallet/qmldir b/ui/app/AppLayouts/Profile/views/wallet/qmldir index e99e65c3d2..6ed7d9b055 100644 --- a/ui/app/AppLayouts/Profile/views/wallet/qmldir +++ b/ui/app/AppLayouts/Profile/views/wallet/qmldir @@ -7,3 +7,4 @@ MainView 1.0 MainView.qml ManageTokensView 1.0 ManageTokensView.qml NetworksView 1.0 NetworksView.qml PermissionsListView 1.0 PermissionsListView.qml +SavedAddressesView 1.0 SavedAddressesView.qml \ No newline at end of file diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 3a64f53f1a..cea16afcf1 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -54,7 +54,9 @@ Item { id: appMain property alias appLayout: appLayout - property RootStore rootStore: RootStore {} + property RootStore rootStore: RootStore { + profileSectionStore.sendModalPopup: sendModal + } property var rootChatStore: ChatStores.RootStore { contactsStore: appMain.rootStore.contactStore communityTokensStore: appMain.communityTokensStore