From 0676f49f4cc00eda7e9095358ba6e39c603d9bcf Mon Sep 17 00:00:00 2001 From: Alexandra Betouni <31625338+alexandraB99@users.noreply.github.com> Date: Fri, 11 Aug 2023 13:17:28 +0300 Subject: [PATCH] feat(BackUpSeedModal) added enter key press handling Closes #8309 --- .../pages/MintTokensSettingsPanelPage.qml | 4 - storybook/pages/RemotelyDestructPopupPage.qml | 23 +----- .../panels/MintTokensSettingsPanel.qml | 8 -- .../Communities/panels/TokenHoldersList.qml | 2 +- .../popups/RemotelyDestructPopup.qml | 73 +++---------------- .../Profile/popups/BackupSeedModal.qml | 4 + .../popups/backupseed/BackupSeedStepBase.qml | 7 ++ 7 files changed, 22 insertions(+), 99 deletions(-) diff --git a/storybook/pages/MintTokensSettingsPanelPage.qml b/storybook/pages/MintTokensSettingsPanelPage.qml index a57d9fe20c..7e4001be21 100644 --- a/storybook/pages/MintTokensSettingsPanelPage.qml +++ b/storybook/pages/MintTokensSettingsPanelPage.qml @@ -47,10 +47,6 @@ SplitView { MintTokensSettingsPanel { id: panel - chainName: "Optimism" - totalFeeText: "0.00001 ($123.7)" - feeErrorText: "frndeufire" - generalAccountErrorText: "fgreudfighlre" MintedTokensModel { id: mintedTokensModel diff --git a/storybook/pages/RemotelyDestructPopupPage.qml b/storybook/pages/RemotelyDestructPopupPage.qml index 3eaed351e0..ccbc41ebc1 100644 --- a/storybook/pages/RemotelyDestructPopupPage.qml +++ b/storybook/pages/RemotelyDestructPopupPage.qml @@ -9,23 +9,6 @@ import AppLayouts.Communities.popups 1.0 SplitView { Logs { id: logs } - ListModel { - id: accountsModel - - ListElement { - name: "Test account" - emoji: "😋" - address: "0x7F47C2e18a4BBf5487E6fb082eC2D9Ab0E6d7240" - color: "red" - } - - ListElement { - name: "Another account - generated" - emoji: "🚗" - address: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8888" - color: "blue" - } - } SplitView { orientation: Qt.Vertical @@ -52,11 +35,7 @@ SplitView { anchors.centerIn: parent collectibleName: editorCollectible.text model: TokenHoldersModel {} - accounts: accountsModel - chainName: "Optimism" - totalFeeText: "0.00001 ($123.7)" - feeErrorText: "ghreoghreui" - generalAccountErrorText: "fhirfghryeruof" + onRemotelyDestructClicked: logs.logEvent("RemoteSelfDestructPopup::onRemotelyDestructClicked") Component.onCompleted: { diff --git a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml index 77f5eb0469..850ccebad8 100644 --- a/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MintTokensSettingsPanel.qml @@ -54,9 +54,6 @@ StackView { property string feeText property string feeErrorText property bool isFeeLoading: true - property string chainName - property string totalFeeText - property string generalAccountErrorText: "" // Network related properties: property var layer1Networks @@ -633,11 +630,6 @@ StackView { collectibleName: view.token.name model: view.tokenOwnersModel || null - accounts: root.accounts - chainName: root.chainName - totalFeeText: root.totalFeeText - feeErrorText: root.feeErrorText - generalAccountErrorText: root.generalAccountErrorText onRemotelyDestructClicked: { remotelyDestructPopup.close() diff --git a/ui/app/AppLayouts/Communities/panels/TokenHoldersList.qml b/ui/app/AppLayouts/Communities/panels/TokenHoldersList.qml index 05c21ba16c..a49761d088 100644 --- a/ui/app/AppLayouts/Communities/panels/TokenHoldersList.qml +++ b/ui/app/AppLayouts/Communities/panels/TokenHoldersList.qml @@ -31,7 +31,7 @@ Item { readonly property alias sortBy: d.sortBy readonly property alias sortOrder: d.sorting readonly property bool bottomSeparatorVisible: ((listView.contentY > 0) && - (listView.contentY < (listView.contentHeight - listView.height))) + (listView.contentY < (listView.contentHeight - listView.height - 40/*margins*/))) signal selfDestructAmountChanged(string walletAddress, int amount) signal selfDestructRemoved(string walletAddress) diff --git a/ui/app/AppLayouts/Communities/popups/RemotelyDestructPopup.qml b/ui/app/AppLayouts/Communities/popups/RemotelyDestructPopup.qml index f03a9d7541..9c297eadc6 100644 --- a/ui/app/AppLayouts/Communities/popups/RemotelyDestructPopup.qml +++ b/ui/app/AppLayouts/Communities/popups/RemotelyDestructPopup.qml @@ -10,7 +10,6 @@ import StatusQ.Core.Theme 0.1 import StatusQ.Core.Utils 0.1 import AppLayouts.Communities.panels 1.0 -import SortFilterProxyModel 0.2 import utils 1.0 @@ -18,18 +17,10 @@ StatusDialog { id: root property alias model: tokenHoldersPanel.model - property string collectibleName - property string chainName - property string totalFeeText - property bool isFeeLoading - property string feeErrorText: "" - property string generalAccountErrorText: "" - property string feeLabel: qsTr("Remotely destruct %1 token on %2").arg(root.collectibleName).arg(root.chainName) - property string feePlaceholderText: qsTr("Select a hodler to see remote destruction gas fees") - // Account expected roles: address, name, color, emoji, walletType - property var accounts - signal remotelyDestructClicked(int tokenCount, var remotelyDestructTokensList) + property string collectibleName + + signal remotelyDestructClicked(int tokenCount, var remotelyDestructTokensList) QtObject { id: d @@ -72,58 +63,12 @@ StatusDialog { implicitWidth: 600 // by design padding: 0 - contentItem: ColumnLayout { - spacing: 16 - TokenHoldersPanel { - id: tokenHoldersPanel - tokenName: root.collectibleName - Layout.fillWidth: true - Layout.fillHeight: true - isSelectorMode: true - onSelfDestructAmountChanged: d.updateTokensToDestruct(walletAddress, amount) - onSelfDestructRemoved: d.clearTokensToDesctruct(walletAddress) - } - FeesBox { - Layout.fillWidth: true - Layout.bottomMargin: 16 - Layout.leftMargin: 16 - Layout.rightMargin: 16 - implicitWidth: 0 - totalFeeText: root.totalFeeText - generalErrorText: root.generalAccountErrorText - accountErrorText: root.feeErrorText - placeholderText: root.feePlaceholderText - showAccountsSelector: true - model: d.tokenCount > 0 ? singleFeeModel : undefined - accountsSelector.model: SortFilterProxyModel { - sourceModel: root.accounts - proxyRoles: [ - ExpressionRole { - name: "color" - function getColor(colorId) { - return Utils.getColorForId(colorId) - } - // Direct call for singleton function is not handled properly by - // SortFilterProxyModel that's why helper function is used instead. - expression: { return getColor(model.colorId) } - } - ] - filters: ValueFilter { - roleName: "walletType" - value: Constants.watchWalletType - inverted: true - } - } - - QtObject { - id: singleFeeModel - - readonly property string title: root.feeLabel - readonly property string feeText: root.isFeeLoading ? - "" : root.feeText - readonly property bool error: d.isFeeError - } - } + contentItem: TokenHoldersPanel { + id: tokenHoldersPanel + tokenName: root.collectibleName + isSelectorMode: true + onSelfDestructAmountChanged: d.updateTokensToDestruct(walletAddress, amount) + onSelfDestructRemoved: d.clearTokensToDesctruct(walletAddress) } footer: StatusDialogFooter { diff --git a/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml b/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml index 124e3b230f..8031147389 100644 --- a/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml +++ b/ui/app/AppLayouts/Profile/popups/BackupSeedModal.qml @@ -66,6 +66,7 @@ StatusStackModal { rightButtons: [ d.skipButton, nextButton, finishButton ] nextButton: StatusButton { + id: nextButton objectName: "BackupSeedModal_nextButton" enabled: { switch (root.currentIndex) { @@ -136,6 +137,9 @@ StatusStackModal { titleText: qsTr("Confirm word #%1 of your seed phrase").arg(d.firstRandomNo + 1) wordRandomNumber: d.firstRandomNo wordAtRandomNumber: root.privacyStore.getMnemonicWordAtIndex(d.firstRandomNo) + onEnterPressed: { + nextButton.clicked(); + } }, BackupSeedStepBase { id: confirmSecondWord diff --git a/ui/app/AppLayouts/Profile/popups/backupseed/BackupSeedStepBase.qml b/ui/app/AppLayouts/Profile/popups/backupseed/BackupSeedStepBase.qml index d457b7b998..182f9b448d 100644 --- a/ui/app/AppLayouts/Profile/popups/backupseed/BackupSeedStepBase.qml +++ b/ui/app/AppLayouts/Profile/popups/backupseed/BackupSeedStepBase.qml @@ -20,6 +20,8 @@ StatusScrollView { default property alias content: column.children + signal enterPressed() + function forceInputFocus() { inputText.input.edit.forceActiveFocus(); } @@ -54,6 +56,11 @@ StatusScrollView { } ] Layout.fillWidth: true + onKeyPressed: { + if ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && inputText.valid) { + root.enterPressed(); + } + } } } }