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 { Component {
id: addNetworkPopupComponent id: addNetworkPopupComponent
NewCustomNetworkModal { NewCustomNetworkModal {
anchors.centerIn: parent
onClosed: { onClosed: {
destroy() destroy()
} }

View File

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