fix(desktop/profile) Bug in adding custom network

Network ID is not being displayed when adding a custom network
* Also replaced ModalPopup with StatusModal and other design
  related updates (eg top margins etc) in NewCustomNetworkModal.qml

Closes #3456
This commit is contained in:
Alexandra Betouni 2021-09-13 15:35:22 +03:00 committed by Iuri Matias
parent 67ca89483d
commit 46bdec6268
2 changed files with 116 additions and 98 deletions

View File

@ -62,6 +62,7 @@ ModalPopup {
Component {
id: addNetworkPopupComponent
NewCustomNetworkModal {
anchors.centerIn: parent
onClosed: {
destroy()
}

View File

@ -1,14 +1,18 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
ModalPopup {
import StatusQ.Popups 0.1
import StatusQ.Controls 0.1
StatusModal {
id: addNetworkPopup
//% "Add network"
title: qsTrId("add-network")
height: 650
header.title: qsTrId("add-network")
height: 644
property string nameValidationError: ""
property string rpcValidationError: ""
@ -62,12 +66,10 @@ ModalPopup {
networkValidationError = "";
}
footer: StatusButton {
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
rightButtons: [
StatusButton {
//% "Save"
text: qsTrId("save")
anchors.bottom: parent.bottom
enabled: nameInput.text !== "" && rpcInput.text !== ""
onClicked: {
if (!addNetworkPopup.validate()) {
@ -83,7 +85,16 @@ ModalPopup {
addNetworkPopup.close()
}
}
]
contentItem: Item {
anchors.fill: parent
anchors {
topMargin: (Style.current.padding + addNetworkPopup.topPadding)
leftMargin: Style.current.padding
rightMargin: Style.current.padding
bottomMargin: (Style.current.padding + addNetworkPopup.bottomPadding)
}
Input {
id: nameInput
//% "Name"
@ -101,7 +112,7 @@ ModalPopup {
placeholderText: qsTrId("specify-rpc-url")
validationError: addNetworkPopup.rpcValidationError
anchors.top: nameInput.bottom
anchors.topMargin: Style.current.bigPadding
anchors.topMargin: Style.current.padding
}
StatusSectionHeadline {
@ -109,17 +120,17 @@ ModalPopup {
//% "Network chain"
text: qsTrId("network-chain")
anchors.top: rpcInput.bottom
anchors.topMargin: Style.current.bigPadding
anchors.topMargin: Style.current.padding
}
Column {
spacing: Style.current.padding
id: radioButtonsColumn
anchors.top: networkChainHeadline.bottom
anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.leftMargin: Style.current.padding
spacing: 0
ButtonGroup {
id: networkChainGroup
@ -128,6 +139,7 @@ ModalPopup {
StatusRadioButtonRow {
id: mainnetRadioBtn
//% "Main network"
objectName: "main"
text: qsTrId("mainnet-network")
buttonGroup: networkChainGroup
checked: true
@ -166,18 +178,23 @@ ModalPopup {
StatusRadioButtonRow {
id: customRadioBtn
//% "Custom"
objectName: "custom"
text: qsTrId("custom")
buttonGroup: networkChainGroup
onRadioCheckedChanged: {
if (checked) {
addNetworkPopup.networkType = "";
}
networkInput.visible = checked;
}
}
}
Input {
id: networkInput
visible: customRadioBtn.checked
anchors.top: radioButtonsColumn.bottom
anchors.topMargin: Style.current.halfPadding
visible: false
//% "Network Id"
label: qsTrId("network-id")
//% "Specify the network id"