From e3086fd52cfd8ef1775fb74d94c078ba2f00cbf4 Mon Sep 17 00:00:00 2001 From: Ivan Belyakov Date: Fri, 20 Jan 2023 00:14:23 +0300 Subject: [PATCH] chore: Removed duplicated AddEditSavedAddressPopup.qml, fixed dependencies fixes #8229 --- .../controls/SavedAddressesDelegate.qml | 0 .../popups/AddEditSavedAddressPopup.qml | 5 +- ui/app/AppLayouts/Wallet/qmldir | 1 - .../Wallet}/views/AssetsDetailView.qml | 2 +- .../Wallet}/views/TransactionDetailView.qml | 2 +- ui/imports/shared/controls/qmldir | 1 - .../popups/AddEditSavedAddressPopup.qml | 118 ------------------ ui/imports/shared/popups/qmldir | 3 +- ui/imports/shared/stores/qmldir | 2 + ui/imports/shared/views/qmldir | 2 - 10 files changed, 8 insertions(+), 128 deletions(-) rename ui/{imports/shared => app/AppLayouts/Wallet}/controls/SavedAddressesDelegate.qml (100%) rename ui/{imports/shared => app/AppLayouts/Wallet}/views/AssetsDetailView.qml (99%) rename ui/{imports/shared => app/AppLayouts/Wallet}/views/TransactionDetailView.qml (99%) delete mode 100644 ui/imports/shared/popups/AddEditSavedAddressPopup.qml diff --git a/ui/imports/shared/controls/SavedAddressesDelegate.qml b/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml similarity index 100% rename from ui/imports/shared/controls/SavedAddressesDelegate.qml rename to ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml diff --git a/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml b/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml index 936ba71fca..c257e9c654 100644 --- a/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml +++ b/ui/app/AppLayouts/Wallet/popups/AddEditSavedAddressPopup.qml @@ -18,6 +18,7 @@ StatusDialog { id: root property bool edit: false + property bool addAddress: false property string address property alias name: nameInput.text property bool favourite: false @@ -44,7 +45,7 @@ StatusDialog { } onOpened: { - if(edit) { + if(edit || addAddress) { addressInput.input.text = root.address } nameInput.input.edit.forceActiveFocus(Qt.MouseFocusReason) @@ -98,7 +99,7 @@ StatusDialog { onSelectedRecipientChanged: { root.address = selectedRecipient.address } - readOnly: root.edit + readOnly: root.edit || root.addAddress wrongInputValidationError: qsTr("Please enter a valid ENS name OR Ethereum Address") ownAddressError: qsTr("Can't add yourself as a saved address") } diff --git a/ui/app/AppLayouts/Wallet/qmldir b/ui/app/AppLayouts/Wallet/qmldir index 23a179a35e..3f86f08fec 100644 --- a/ui/app/AppLayouts/Wallet/qmldir +++ b/ui/app/AppLayouts/Wallet/qmldir @@ -1,5 +1,4 @@ LeftTabView 1.0 LeftTabView.qml WalletHeader 1.0 WalletHeader.qml -AssetsView 1.0 AssetsView.qml CollectiblesView 1.0 CollectiblesView.qml WalletLayout 1.0 WalletLayout.qml diff --git a/ui/imports/shared/views/AssetsDetailView.qml b/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml similarity index 99% rename from ui/imports/shared/views/AssetsDetailView.qml rename to ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml index a4e1fce350..5313d09e29 100644 --- a/ui/imports/shared/views/AssetsDetailView.qml +++ b/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml @@ -11,8 +11,8 @@ import StatusQ.Controls 0.1 import utils 1.0 import shared.views 1.0 import shared.controls 1.0 +import shared.stores 1.0 -import "../stores" /// \beware: heavy shortcuts here, refactor to match the requirements when touching this again /// \todo split into token history and balance views; they have different requirements that introduce unnecessary complexity diff --git a/ui/imports/shared/views/TransactionDetailView.qml b/ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml similarity index 99% rename from ui/imports/shared/views/TransactionDetailView.qml rename to ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml index 7cd14a2ea2..99c2ba7fe8 100644 --- a/ui/imports/shared/views/TransactionDetailView.qml +++ b/ui/app/AppLayouts/Wallet/views/TransactionDetailView.qml @@ -11,8 +11,8 @@ import StatusQ.Popups 0.1 import shared.controls 1.0 import utils 1.0 +import shared.stores 1.0 -import "../stores" import "../controls" Item { diff --git a/ui/imports/shared/controls/qmldir b/ui/imports/shared/controls/qmldir index f30277e105..9c2b418241 100644 --- a/ui/imports/shared/controls/qmldir +++ b/ui/imports/shared/controls/qmldir @@ -29,5 +29,4 @@ SocialLinkPreview 1.0 SocialLinkPreview.qml AssetsDetailsHeader 1.0 AssetsDetailsHeader.qml InformationTag 1.0 InformationTag.qml TransactionDetailsHeader.qml 1.0 TransactionDetailsHeader.qml -SavedAddressesDelegate 1.0 SavedAddressesDelegate.qml TokenDelegate 1.0 TokenDelegate.qml diff --git a/ui/imports/shared/popups/AddEditSavedAddressPopup.qml b/ui/imports/shared/popups/AddEditSavedAddressPopup.qml deleted file mode 100644 index c257e9c654..0000000000 --- a/ui/imports/shared/popups/AddEditSavedAddressPopup.qml +++ /dev/null @@ -1,118 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 -import QtQml.Models 2.14 - -import utils 1.0 -import shared.controls 1.0 -import shared.panels 1.0 - -import StatusQ.Core 0.1 -import StatusQ.Core.Theme 0.1 -import StatusQ.Controls 0.1 -import StatusQ.Controls.Validators 0.1 -import StatusQ.Popups.Dialog 0.1 - -import "../stores" - -StatusDialog { - id: root - - property bool edit: false - property bool addAddress: false - property string address - property alias name: nameInput.text - property bool favourite: false - property var contactsStore - - signal save(string name, string address) - - QtObject { - id: d - property int validationMode: root.edit ? - StatusInput.ValidationMode.Always - : StatusInput.ValidationMode.OnlyWhenDirty - property bool valid: addressInput.isValid && nameInput.valid // TODO: Add network preference and emoji - property bool dirty: nameInput.input.dirty - } - - width: 574 - height: 490 - - header: StatusDialogHeader { - headline.title: edit ? qsTr("Edit saved address") : qsTr("Add saved address") - headline.subtitle: edit ? name : "" - actions.closeButton.onClicked: root.close() - } - - onOpened: { - if(edit || addAddress) { - addressInput.input.text = root.address - } - nameInput.input.edit.forceActiveFocus(Qt.MouseFocusReason) - } - - Column { - width: parent.width - height: childrenRect.height - topPadding: Style.current.xlPadding - - spacing: Style.current.bigPadding - - StatusInput { - id: nameInput - implicitWidth: parent.width - input.edit.objectName: "savedAddressNameInput" - minimumHeight: 56 - maximumHeight: 56 - placeholderText: qsTr("Enter a name") - label: qsTr("Name") - validators: [ - StatusMinLengthValidator { - minLength: 1 - errorMessage: qsTr("Name must not be blank") - }, - StatusRegularExpressionValidator { - regularExpression: /^[^<>]+$/ - errorMessage: qsTr("This is not a valid account name") - } - ] - charLimit: 40 - validationMode: d.validationMode - } - - // To-Do use StatusInput within the below component - RecipientSelector { - id: addressInput - implicitWidth: parent.width - inputWidth: implicitWidth - accounts: RootStore.accounts - contactsStore: root.contactsStore - label: qsTr("Address") - input.textField.objectName: "savedAddressAddressInput" - input.placeholderText: qsTr("Enter ENS Name or Ethereum Address") - labelFont.pixelSize: 15 - labelFont.weight: Font.Normal - input.implicitHeight: 56 - input.textField.anchors.rightMargin: 0 - isSelectorVisible: false - addContactEnabled: false - onSelectedRecipientChanged: { - root.address = selectedRecipient.address - } - readOnly: root.edit || root.addAddress - wrongInputValidationError: qsTr("Please enter a valid ENS name OR Ethereum Address") - ownAddressError: qsTr("Can't add yourself as a saved address") - } - } - - footer: StatusDialogFooter { - rightButtons: ObjectModel { - StatusButton { - text: root.edit ? qsTr("Save") : qsTr("Add address") - enabled: d.valid && d.dirty - onClicked: root.save(name, address) - objectName: "addSavedAddress" - } - } - } -} diff --git a/ui/imports/shared/popups/qmldir b/ui/imports/shared/popups/qmldir index c2e2a040fe..04b05c058d 100644 --- a/ui/imports/shared/popups/qmldir +++ b/ui/imports/shared/popups/qmldir @@ -22,6 +22,5 @@ ProfileDialog 1.0 ProfileDialog.qml ImageCropWorkflow 1.0 ImageCropWorkflow.qml ImportCommunityPopup 1.0 ImportCommunityPopup.qml DisplayNamePopup 1.0 DisplayNamePopup.qml -AddEditSavedAddressPopup 1.0 AddEditSavedAddressPopup.qml SendContactRequestModal 1.0 SendContactRequestModal.qml -AccountsModalHeader 1.0 AccountsModalHeader.qml \ No newline at end of file +AccountsModalHeader 1.0 AccountsModalHeader.qml diff --git a/ui/imports/shared/stores/qmldir b/ui/imports/shared/stores/qmldir index afc37975f9..cae58916be 100644 --- a/ui/imports/shared/stores/qmldir +++ b/ui/imports/shared/stores/qmldir @@ -2,3 +2,5 @@ singleton RootStore 1.0 RootStore.qml CurrenciesStore 1.0 CurrenciesStore.qml TransactionStore 1.0 TransactionStore.qml BIP39_en 1.0 BIP39_en.qml +TokenBalanceHistoryStore 1.0 TokenBalanceHistoryStore.qml +TokenMarketValuesStore 1.0 TokenMarketValuesStore.qml diff --git a/ui/imports/shared/views/qmldir b/ui/imports/shared/views/qmldir index 947b3e7976..9442733470 100644 --- a/ui/imports/shared/views/qmldir +++ b/ui/imports/shared/views/qmldir @@ -10,5 +10,3 @@ PasswordView 1.0 PasswordView.qml ProfileDialogView 1.0 ProfileDialogView.qml AssetsView 1.0 AssetsView.qml HistoryView 1.0 HistoryView.qml -AssetsDetailView 1.0 AssetsDetailView.qml -TransactionDetailView 1.0 TransactionDetailView.qml