fix(ConnectDAppModal): don't overflow texts (#15907)

- 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
This commit is contained in:
Lukáš Tinkl 2024-07-31 19:32:28 +02:00 committed by GitHub
parent 8343fe3076
commit 415572246d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 32 additions and 15 deletions

View File

@ -180,14 +180,14 @@ Item {
verify(chainSelector, "Chain selector should be present") verify(chainSelector, "Chain selector should be present")
compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) 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) mouseClick(chainSelector)
waitForItemPolished(chainSelector) waitForItemPolished(chainSelector)
const networkSelectorList = findChild(chainSelector, "networkSelectorList") const networkSelectorList = findChild(chainSelector, "networkSelectorList")
verify(networkSelectorList, "Network selector list should be present") verify(networkSelectorList, "Network selector list should be present")
mouseClick(networkSelectorList.itemAtIndex(0))
compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) compare(chainSelector.selection.length, NetworksModel.flatNetworks.count)
compare(dappModal.selectedChains.length, NetworksModel.flatNetworks.count) compare(dappModal.selectedChains.length, NetworksModel.flatNetworks.count)
verify(!chainSelector.control.popup.opened)
const connectionTag = findChild(dappModal, "connectionStatusTag") const connectionTag = findChild(dappModal, "connectionStatusTag")
compare(connectionTag.visible, true) compare(connectionTag.visible, true)
@ -236,14 +236,14 @@ Item {
verify(chainSelector, "Chain selector should be present") verify(chainSelector, "Chain selector should be present")
compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) 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) mouseClick(chainSelector)
waitForItemPolished(chainSelector) waitForItemPolished(chainSelector)
const networkSelectorList = findChild(chainSelector, "networkSelectorList") const networkSelectorList = findChild(chainSelector, "networkSelectorList")
verify(networkSelectorList, "Network selector list should be present") verify(networkSelectorList, "Network selector list should be present")
mouseClick(networkSelectorList.itemAtIndex(0))
compare(chainSelector.selection.length, NetworksModel.flatNetworks.count) compare(chainSelector.selection.length, NetworksModel.flatNetworks.count)
compare(dappModal.selectedChains.length, NetworksModel.flatNetworks.count) compare(dappModal.selectedChains.length, NetworksModel.flatNetworks.count)
verify(!chainSelector.control.popup.opened)
const connectionTag = findChild(dappModal, "connectionStatusTag") const connectionTag = findChild(dappModal, "connectionStatusTag")
compare(connectionTag.visible, true) compare(connectionTag.visible, true)

View File

@ -61,7 +61,7 @@ StatusComboBox {
control.indicator: SQP.StatusComboboxIndicator { control.indicator: SQP.StatusComboboxIndicator {
x: root.control.mirrored ? root.control.horizontalPadding : root.width - width - root.control.horizontalPadding x: root.control.mirrored ? root.control.horizontalPadding : root.width - width - root.control.horizontalPadding
y: root.control.topPadding + (root.control.availableHeight - height) / 2 y: root.control.topPadding + (root.control.availableHeight - height) / 2
visible: !d.selectionUnavailable visible: !d.selectionUnavailable && root.selectionAllowed
} }
control.contentItem: RowLayout { control.contentItem: RowLayout {

View File

@ -113,16 +113,18 @@ StatusDialog {
DAppCard { DAppCard {
id: dappCard id: dappCard
Layout.maximumWidth: root.availableWidth - Layout.leftMargin * 2 Layout.maximumWidth: scrollView.availableWidth - Layout.leftMargin * 2
Layout.leftMargin: 12 Layout.leftMargin: 12
Layout.rightMargin: Layout.leftMargin Layout.rightMargin: Layout.leftMargin
Layout.topMargin: 14 Layout.topMargin: 14
Layout.bottomMargin: Layout.topMargin Layout.bottomMargin: Layout.topMargin
connectionSuccessful: d.connectionSuccessful
connectionAttempted: d.connectionAttempted
} }
ContextCard { ContextCard {
id: contextCard id: contextCard
Layout.maximumWidth: root.availableWidth Layout.maximumWidth: scrollView.availableWidth
Layout.fillWidth: true Layout.fillWidth: true
multipleChainSelection: root.multipleChainSelection multipleChainSelection: root.multipleChainSelection
@ -140,7 +142,7 @@ StatusDialog {
} }
PermissionsCard { PermissionsCard {
Layout.maximumWidth: root.availableWidth Layout.maximumWidth: scrollView.availableWidth
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16

View File

@ -1,4 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import StatusQ 0.1 import StatusQ 0.1
@ -83,7 +84,14 @@ Rectangle {
multiSelection: root.multipleChainSelection multiSelection: root.multipleChainSelection
showAllSelectedText: false showAllSelectedText: false
selectionAllowed: false selectionAllowed: false
// disable interactions w/o looking disabled
control.hoverEnabled: false
MouseArea {
anchors.fill: parent
onPressed: mouse.accepted = true
}
} }
} }
} }
} }

View File

@ -1,4 +1,5 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import StatusQ 0.1 import StatusQ 0.1
@ -15,6 +16,8 @@ ColumnLayout {
property alias name: appNameText.text property alias name: appNameText.text
property url dAppUrl: "" property url dAppUrl: ""
property url iconUrl: "" property url iconUrl: ""
property bool connectionSuccessful
property bool connectionAttempted
spacing: Style.current.padding spacing: Style.current.padding
@ -67,8 +70,8 @@ ColumnLayout {
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: root.width Layout.maximumWidth: root.width
objectName: "connectionStatusTag" objectName: "connectionStatusTag"
success: d.connectionSuccessful success: root.connectionSuccessful
visible: d.connectionAttempted visible: root.connectionAttempted
} }
} }
} }

View File

@ -11,24 +11,28 @@ ColumnLayout {
property string dappName: "" property string dappName: ""
StatusBaseText { StatusBaseText {
Layout.fillWidth: true
objectName: "permissionsTitle" objectName: "permissionsTitle"
text: qsTr("%1 will be able to:").arg(root.dappName) text: qsTr("%1 will be able to:").arg(root.dappName)
Layout.preferredHeight: 18 Layout.preferredHeight: 18
font.pixelSize: 13 font.pixelSize: 13
elide: Text.ElideMiddle
color: Theme.palette.baseColor1 color: Theme.palette.baseColor1
} }
StatusBaseText { StatusBaseText {
text: qsTr("Check your account balance and activity") text: qsTr("Check your account balance and activity")
Layout.fillWidth: true
Layout.preferredHeight: 18 Layout.preferredHeight: 18
elide: Text.ElideRight
font.pixelSize: 13 font.pixelSize: 13
} }
StatusBaseText { StatusBaseText {
text: qsTr("Request transactions and message signing") text: qsTr("Request transactions and message signing")
Layout.fillWidth: true
Layout.preferredHeight: 18 Layout.preferredHeight: 18
elide: Text.ElideRight
font.pixelSize: 13 font.pixelSize: 13
} }
} }