From 4dbae17bb96821c6b99dcb0100db14a0025b1599 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Tue, 30 Jul 2024 12:46:02 +0200 Subject: [PATCH] fix(ConnectDAppModal): don't overflow texts - set the correct widths and elide mode - fixup the visuals of the NetworkFilter combo box (to disable it w/o making it look disabled) - fix passing the connection status down to DAppCard --- storybook/qmlTests/tests/tst_ConnectDAppModal.qml | 8 ++++---- ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml | 2 +- .../shared/popups/walletconnect/ConnectDAppModal.qml | 8 +++++--- .../popups/walletconnect/private/ContextCard.qml | 10 +++++++++- .../shared/popups/walletconnect/private/DAppCard.qml | 9 ++++++--- .../popups/walletconnect/private/PermissionsCard.qml | 10 +++++++--- 6 files changed, 32 insertions(+), 15 deletions(-) diff --git a/storybook/qmlTests/tests/tst_ConnectDAppModal.qml b/storybook/qmlTests/tests/tst_ConnectDAppModal.qml index ca8d92abc3..8c64d0e97c 100644 --- a/storybook/qmlTests/tests/tst_ConnectDAppModal.qml +++ b/storybook/qmlTests/tests/tst_ConnectDAppModal.qml @@ -180,14 +180,14 @@ Item { verify(chainSelector, "Chain selector should be present") compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) - // User should not be able to deselect a chain + // User should not be able to open the popup mouseClick(chainSelector) waitForItemPolished(chainSelector) const networkSelectorList = findChild(chainSelector, "networkSelectorList") verify(networkSelectorList, "Network selector list should be present") - mouseClick(networkSelectorList.itemAtIndex(0)) compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) compare(dappModal.selectedChains.length, NetworksModel.flatNetworks.count) + verify(!chainSelector.control.popup.opened) const connectionTag = findChild(dappModal, "connectionStatusTag") compare(connectionTag.visible, true) @@ -236,14 +236,14 @@ Item { verify(chainSelector, "Chain selector should be present") compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) - // User should not be able to deselect a chain + // User should not be able to open the popup mouseClick(chainSelector) waitForItemPolished(chainSelector) const networkSelectorList = findChild(chainSelector, "networkSelectorList") verify(networkSelectorList, "Network selector list should be present") - mouseClick(networkSelectorList.itemAtIndex(0)) compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) compare(dappModal.selectedChains.length, NetworksModel.flatNetworks.count) + verify(!chainSelector.control.popup.opened) const connectionTag = findChild(dappModal, "connectionStatusTag") compare(connectionTag.visible, true) diff --git a/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml b/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml index ea9e1351ad..fb07396f7c 100644 --- a/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml +++ b/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml @@ -61,7 +61,7 @@ StatusComboBox { control.indicator: SQP.StatusComboboxIndicator { x: root.control.mirrored ? root.control.horizontalPadding : root.width - width - root.control.horizontalPadding y: root.control.topPadding + (root.control.availableHeight - height) / 2 - visible: !d.selectionUnavailable + visible: !d.selectionUnavailable && root.selectionAllowed } control.contentItem: RowLayout { diff --git a/ui/imports/shared/popups/walletconnect/ConnectDAppModal.qml b/ui/imports/shared/popups/walletconnect/ConnectDAppModal.qml index 8b762a7ed2..92b29790ef 100644 --- a/ui/imports/shared/popups/walletconnect/ConnectDAppModal.qml +++ b/ui/imports/shared/popups/walletconnect/ConnectDAppModal.qml @@ -113,16 +113,18 @@ StatusDialog { DAppCard { id: dappCard - Layout.maximumWidth: root.availableWidth - Layout.leftMargin * 2 + Layout.maximumWidth: scrollView.availableWidth - Layout.leftMargin * 2 Layout.leftMargin: 12 Layout.rightMargin: Layout.leftMargin Layout.topMargin: 14 Layout.bottomMargin: Layout.topMargin + connectionSuccessful: d.connectionSuccessful + connectionAttempted: d.connectionAttempted } ContextCard { id: contextCard - Layout.maximumWidth: root.availableWidth + Layout.maximumWidth: scrollView.availableWidth Layout.fillWidth: true multipleChainSelection: root.multipleChainSelection @@ -140,7 +142,7 @@ StatusDialog { } PermissionsCard { - Layout.maximumWidth: root.availableWidth + Layout.maximumWidth: scrollView.availableWidth Layout.fillWidth: true Layout.leftMargin: 16 diff --git a/ui/imports/shared/popups/walletconnect/private/ContextCard.qml b/ui/imports/shared/popups/walletconnect/private/ContextCard.qml index 38489fe5fc..9de9c4e6a2 100644 --- a/ui/imports/shared/popups/walletconnect/private/ContextCard.qml +++ b/ui/imports/shared/popups/walletconnect/private/ContextCard.qml @@ -1,4 +1,5 @@ import QtQuick 2.15 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import StatusQ 0.1 @@ -83,7 +84,14 @@ Rectangle { multiSelection: root.multipleChainSelection showAllSelectedText: false selectionAllowed: false + + // disable interactions w/o looking disabled + control.hoverEnabled: false + MouseArea { + anchors.fill: parent + onPressed: mouse.accepted = true + } } } } -} \ No newline at end of file +} diff --git a/ui/imports/shared/popups/walletconnect/private/DAppCard.qml b/ui/imports/shared/popups/walletconnect/private/DAppCard.qml index eb4dcb6c9c..c4ae14b542 100644 --- a/ui/imports/shared/popups/walletconnect/private/DAppCard.qml +++ b/ui/imports/shared/popups/walletconnect/private/DAppCard.qml @@ -1,4 +1,5 @@ import QtQuick 2.15 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 import StatusQ 0.1 @@ -15,6 +16,8 @@ ColumnLayout { property alias name: appNameText.text property url dAppUrl: "" property url iconUrl: "" + property bool connectionSuccessful + property bool connectionAttempted spacing: Style.current.padding @@ -67,8 +70,8 @@ ColumnLayout { Layout.alignment: Qt.AlignHCenter Layout.maximumWidth: root.width objectName: "connectionStatusTag" - success: d.connectionSuccessful - visible: d.connectionAttempted + success: root.connectionSuccessful + visible: root.connectionAttempted } } -} \ No newline at end of file +} diff --git a/ui/imports/shared/popups/walletconnect/private/PermissionsCard.qml b/ui/imports/shared/popups/walletconnect/private/PermissionsCard.qml index 7769519780..733b2e556f 100644 --- a/ui/imports/shared/popups/walletconnect/private/PermissionsCard.qml +++ b/ui/imports/shared/popups/walletconnect/private/PermissionsCard.qml @@ -11,24 +11,28 @@ ColumnLayout { property string dappName: "" StatusBaseText { + Layout.fillWidth: true objectName: "permissionsTitle" text: qsTr("%1 will be able to:").arg(root.dappName) Layout.preferredHeight: 18 font.pixelSize: 13 + elide: Text.ElideMiddle color: Theme.palette.baseColor1 } StatusBaseText { text: qsTr("Check your account balance and activity") + Layout.fillWidth: true Layout.preferredHeight: 18 - + elide: Text.ElideRight font.pixelSize: 13 } StatusBaseText { text: qsTr("Request transactions and message signing") + Layout.fillWidth: true Layout.preferredHeight: 18 - + elide: Text.ElideRight font.pixelSize: 13 } -} \ No newline at end of file +}