feat(dapps): Implemented Loading state while processing URL (#15346)

Closes #14675.
This commit is contained in:
Roman Chornii 2024-07-04 16:33:05 +03:00 committed by GitHub
parent 03f8f80c56
commit 85846c88e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 85 additions and 1 deletions

View File

@ -379,6 +379,7 @@ Item {
property string pairUri: "" property string pairUri: ""
property bool testNetworks: false property bool testNetworks: false
property bool enableSDK: true property bool enableSDK: true
property bool pending : false
property string customAccounts: "" property string customAccounts: ""
} }
} }

View File

@ -0,0 +1,74 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import shared.popups.walletconnect.PairWCModal 1.0
import Storybook 1.0
SplitView {
id: root
ColumnLayout {
SplitView.fillHeight: true
SplitView.fillWidth: true
WCUriInput {
id: wcInput
Layout.fillWidth: true
Layout.alignment: Qt.AlignCenter
Layout.margins: 16
}
Component.onCompleted: {
function onVisibilityChangedAfterCreation() {
let items = InspectionUtils.findVisualsByTypeName(wcInput, "StatusBaseInput")
if (items.length === 1) {
items[0].text = "wc:825fbaeb53eeeb08e53a8ddf40cec7996056f49647ab5c39663a2a102920d81c@2?expiryTimestamp=1719495004&relay-protocol=irn&symKey=2eaa97fa11774efb67fd7c93efe92773a7b60650c5cb2621abbdba02cdd4040c"
}
wcInput.visibleChanged.disconnect(onVisibilityChangedAfterCreation);
}
wcInput.visibleChanged.connect(onVisibilityChangedAfterCreation);
}
// Spacer
Item { Layout.fillHeight: true }
}
Pane {
Layout.fillWidth: true
ColumnLayout {
TextInput {
id: placeHolderInput
text: "Input state"
}
CheckBox {
id: pendingCheckBox
text: "pending"
checked: false
onCheckedChanged: {
let items = InspectionUtils.findVisualsByTypeName(wcInput, "StatusBaseInput")
if (items.length === 1) {
items[0].pending = pendingCheckBox.checked
}
}
}
CheckBox {
id: validCheckBox
text: "valid"
checked: true
onCheckedChanged: {
let items = InspectionUtils.findVisualsByTypeName(wcInput, "StatusBaseInput")
if (items.length === 1) {
items[0].valid = validCheckBox.checked
}
}
}
}
}
}
// category: Components

View File

@ -6,6 +6,7 @@ import QtQuick.Layouts 1.15
import StatusQ.Core 0.1 import StatusQ.Core 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
ColumnLayout { ColumnLayout {
@ -13,6 +14,7 @@ ColumnLayout {
readonly property bool valid: input.valid && input.text.length > 0 readonly property bool valid: input.valid && input.text.length > 0
readonly property alias text: input.text readonly property alias text: input.text
property alias pending: input.pending
StatusBaseInput { StatusBaseInput {
id: input id: input
@ -76,12 +78,18 @@ ColumnLayout {
readonly property bool showIcon: input.valid && input.text.length > 0 readonly property bool showIcon: input.valid && input.text.length > 0
StatusLoadingIndicator {
anchors.centerIn: parent
color: Theme.palette.blue
visible: showIcon && input.pending
}
StatusIcon { StatusIcon {
anchors.centerIn: parent anchors.centerIn: parent
icon: "tiny/tiny-checkmark" icon: "tiny/tiny-checkmark"
color: Theme.palette.green color: Theme.palette.green
visible: showIcon visible: showIcon && !input.pending
} }
StatusButton { StatusButton {

View File

@ -0,0 +1 @@
WCUriInput 1.0 WCUriInput.qml