fix(ConnectDAppModal): add scrolling

- wrap the contents into a scroll view and don't hardcode the height

Fixes #15592
This commit is contained in:
Lukáš Tinkl 2024-07-29 10:41:47 +02:00 committed by Lukáš Tinkl
parent 8046bfeb6b
commit 0e0b264f4d
2 changed files with 48 additions and 45 deletions

View File

@ -65,7 +65,6 @@ Item {
verify(dappModal.flatNetworks, "ConnectDAppModal should have networks") verify(dappModal.flatNetworks, "ConnectDAppModal should have networks")
compare(dappModal.width, 480) compare(dappModal.width, 480)
compare(dappModal.height, 633)
compare(dappModal.dAppName, "") compare(dappModal.dAppName, "")
compare(dappModal.dAppUrl, "") compare(dappModal.dAppUrl, "")
compare(dappModal.dAppIconUrl, "") compare(dappModal.dAppIconUrl, "")
@ -318,4 +317,4 @@ Item {
// compare(connectButton.enabled, true) // compare(connectButton.enabled, true)
} }
} }
} }

View File

@ -1,11 +1,9 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import QtQml.Models 2.14 import QtQml.Models 2.15
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
import QtGraphicalEffects 1.15
import StatusQ 0.1 import StatusQ 0.1
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Utils 0.1 import StatusQ.Core.Utils 0.1
@ -93,56 +91,64 @@ StatusDialog {
signal disconnect() signal disconnect()
width: 480 width: 480
implicitHeight: !d.connectionAttempted ? 633 : 681
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
title: d.connectionSuccessful ? qsTr("dApp connected") : title: d.connectionSuccessful ? qsTr("dApp connected") :
qsTr("Connection request") qsTr("Connection request")
padding: 20 padding: 0
contentItem: ColumnLayout { StatusScrollView {
spacing: 20 id: scrollView
clip: true anchors.fill: parent
contentWidth: availableWidth
topPadding: 0
bottomPadding: 0
DAppCard { ColumnLayout {
id: dappCard spacing: 20
Layout.maximumWidth: root.availableWidth - Layout.leftMargin * 2 anchors.left: parent.left
Layout.leftMargin: 12 anchors.leftMargin: 4
Layout.rightMargin: Layout.leftMargin anchors.right: parent.right
Layout.topMargin: 14 anchors.rightMargin: 4
Layout.bottomMargin: Layout.topMargin
}
ContextCard { DAppCard {
id: contextCard id: dappCard
Layout.maximumWidth: root.availableWidth Layout.maximumWidth: root.availableWidth - Layout.leftMargin * 2
Layout.fillWidth: true Layout.leftMargin: 12
Layout.rightMargin: Layout.leftMargin
Layout.topMargin: 14
Layout.bottomMargin: Layout.topMargin
}
multipleChainSelection: root.multipleChainSelection ContextCard {
selectedAccountAddress: root.selectedAccountAddress id: contextCard
connectionAttempted: d.connectionAttempted Layout.maximumWidth: root.availableWidth
accountsModel: d.accountsProxy Layout.fillWidth: true
chainsModel: root.flatNetworks
chainSelection: d.selectedChains
onChainSelectionChanged: { multipleChainSelection: root.multipleChainSelection
if (d.selectedChains !== chainSelection) { selectedAccountAddress: root.selectedAccountAddress
d.selectedChains = chainSelection connectionAttempted: d.connectionAttempted
accountsModel: d.accountsProxy
chainsModel: root.flatNetworks
chainSelection: d.selectedChains
onChainSelectionChanged: {
if (d.selectedChains !== chainSelection) {
d.selectedChains = chainSelection
}
} }
} }
}
PermissionsCard { PermissionsCard {
Layout.maximumWidth: root.availableWidth Layout.maximumWidth: root.availableWidth
Layout.fillWidth: true Layout.fillWidth: true
Layout.leftMargin: 16 Layout.leftMargin: 16
Layout.rightMargin: Layout.leftMargin Layout.rightMargin: Layout.leftMargin
Layout.topMargin: 12 Layout.topMargin: 12
Layout.bottomMargin: Layout.topMargin Layout.bottomMargin: Layout.topMargin
dappName: dappCard.name dappName: dappCard.name
}
} }
} }
@ -172,9 +178,7 @@ StatusDialog {
StatusButton { StatusButton {
objectName: "primaryActionButton" objectName: "primaryActionButton"
height: 44 height: 44
text: d.connectionAttempted text: d.connectionAttempted ? qsTr("Close") : qsTr("Connect")
? qsTr("Close")
: qsTr("Connect")
enabled: { enabled: {
if (!d.connectionAttempted) if (!d.connectionAttempted)
return root.selectedChains.length > 0 return root.selectedChains.length > 0