mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-11 06:47:01 +00:00
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:
parent
67ca89483d
commit
46bdec6268
@ -62,6 +62,7 @@ ModalPopup {
|
|||||||
Component {
|
Component {
|
||||||
id: addNetworkPopupComponent
|
id: addNetworkPopupComponent
|
||||||
NewCustomNetworkModal {
|
NewCustomNetworkModal {
|
||||||
|
anchors.centerIn: parent
|
||||||
onClosed: {
|
onClosed: {
|
||||||
destroy()
|
destroy()
|
||||||
}
|
}
|
||||||
|
@ -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,122 +66,135 @@ ModalPopup {
|
|||||||
networkValidationError = "";
|
networkValidationError = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: StatusButton {
|
rightButtons: [
|
||||||
anchors.right: parent.right
|
StatusButton {
|
||||||
anchors.rightMargin: Style.current.smallPadding
|
//% "Save"
|
||||||
//% "Save"
|
text: qsTrId("save")
|
||||||
text: qsTrId("save")
|
enabled: nameInput.text !== "" && rpcInput.text !== ""
|
||||||
anchors.bottom: parent.bottom
|
onClicked: {
|
||||||
enabled: nameInput.text !== "" && rpcInput.text !== ""
|
if (!addNetworkPopup.validate()) {
|
||||||
onClicked: {
|
return;
|
||||||
if (!addNetworkPopup.validate()) {
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (customRadioBtn.checked){
|
if (customRadioBtn.checked){
|
||||||
addNetworkPopup.networkId = parseInt(networkInput.text, 10);
|
addNetworkPopup.networkId = parseInt(networkInput.text, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
profileModel.network.add(nameInput.text, rpcInput.text, addNetworkPopup.networkId, addNetworkPopup.networkType)
|
profileModel.network.add(nameInput.text, rpcInput.text, addNetworkPopup.networkId, addNetworkPopup.networkType)
|
||||||
profileModel.network.reloadCustomNetworks();
|
profileModel.network.reloadCustomNetworks();
|
||||||
addNetworkPopup.close()
|
addNetworkPopup.close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
|
||||||
Input {
|
contentItem: Item {
|
||||||
id: nameInput
|
anchors.fill: parent
|
||||||
//% "Name"
|
anchors {
|
||||||
label: qsTrId("name")
|
topMargin: (Style.current.padding + addNetworkPopup.topPadding)
|
||||||
//% "Specify a name"
|
leftMargin: Style.current.padding
|
||||||
placeholderText: qsTrId("specify-name")
|
rightMargin: Style.current.padding
|
||||||
validationError: addNetworkPopup.nameValidationError
|
bottomMargin: (Style.current.padding + addNetworkPopup.bottomPadding)
|
||||||
}
|
}
|
||||||
|
Input {
|
||||||
Input {
|
id: nameInput
|
||||||
id: rpcInput
|
//% "Name"
|
||||||
//% "RPC URL"
|
label: qsTrId("name")
|
||||||
label: qsTrId("rpc-url")
|
//% "Specify a name"
|
||||||
//% "Specify a RPC URL"
|
placeholderText: qsTrId("specify-name")
|
||||||
placeholderText: qsTrId("specify-rpc-url")
|
validationError: addNetworkPopup.nameValidationError
|
||||||
validationError: addNetworkPopup.rpcValidationError
|
|
||||||
anchors.top: nameInput.bottom
|
|
||||||
anchors.topMargin: Style.current.bigPadding
|
|
||||||
}
|
|
||||||
|
|
||||||
StatusSectionHeadline {
|
|
||||||
id: networkChainHeadline
|
|
||||||
//% "Network chain"
|
|
||||||
text: qsTrId("network-chain")
|
|
||||||
anchors.top: rpcInput.bottom
|
|
||||||
anchors.topMargin: Style.current.bigPadding
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
spacing: Style.current.padding
|
|
||||||
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
|
|
||||||
|
|
||||||
ButtonGroup {
|
|
||||||
id: networkChainGroup
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusRadioButtonRow {
|
Input {
|
||||||
id: mainnetRadioBtn
|
id: rpcInput
|
||||||
//% "Main network"
|
//% "RPC URL"
|
||||||
text: qsTrId("mainnet-network")
|
label: qsTrId("rpc-url")
|
||||||
buttonGroup: networkChainGroup
|
//% "Specify a RPC URL"
|
||||||
checked: true
|
placeholderText: qsTrId("specify-rpc-url")
|
||||||
onRadioCheckedChanged: {
|
validationError: addNetworkPopup.rpcValidationError
|
||||||
if (checked) {
|
anchors.top: nameInput.bottom
|
||||||
addNetworkPopup.networkId = 1;
|
anchors.topMargin: Style.current.padding
|
||||||
addNetworkPopup.networkType = Constants.networkMainnet;
|
}
|
||||||
|
|
||||||
|
StatusSectionHeadline {
|
||||||
|
id: networkChainHeadline
|
||||||
|
//% "Network chain"
|
||||||
|
text: qsTrId("network-chain")
|
||||||
|
anchors.top: rpcInput.bottom
|
||||||
|
anchors.topMargin: Style.current.padding
|
||||||
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
|
id: radioButtonsColumn
|
||||||
|
anchors.top: networkChainHeadline.bottom
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Style.current.padding
|
||||||
|
anchors.leftMargin: Style.current.padding
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
ButtonGroup {
|
||||||
|
id: networkChainGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
StatusRadioButtonRow {
|
||||||
|
id: mainnetRadioBtn
|
||||||
|
//% "Main network"
|
||||||
|
objectName: "main"
|
||||||
|
text: qsTrId("mainnet-network")
|
||||||
|
buttonGroup: networkChainGroup
|
||||||
|
checked: true
|
||||||
|
onRadioCheckedChanged: {
|
||||||
|
if (checked) {
|
||||||
|
addNetworkPopup.networkId = 1;
|
||||||
|
addNetworkPopup.networkType = Constants.networkMainnet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
StatusRadioButtonRow {
|
StatusRadioButtonRow {
|
||||||
//% "Ropsten test network"
|
//% "Ropsten test network"
|
||||||
text: qsTrId("ropsten-network")
|
text: qsTrId("ropsten-network")
|
||||||
buttonGroup: networkChainGroup
|
buttonGroup: networkChainGroup
|
||||||
onRadioCheckedChanged: {
|
onRadioCheckedChanged: {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
addNetworkPopup.networkId = 3;
|
addNetworkPopup.networkId = 3;
|
||||||
addNetworkPopup.networkType = Constants.networkRopsten;
|
addNetworkPopup.networkType = Constants.networkRopsten;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
StatusRadioButtonRow {
|
StatusRadioButtonRow {
|
||||||
//% "Rinkeby test network"
|
//% "Rinkeby test network"
|
||||||
text: qsTrId("rinkeby-network")
|
text: qsTrId("rinkeby-network")
|
||||||
buttonGroup: networkChainGroup
|
buttonGroup: networkChainGroup
|
||||||
onRadioCheckedChanged: {
|
onRadioCheckedChanged: {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
addNetworkPopup.networkId = 4;
|
addNetworkPopup.networkId = 4;
|
||||||
addNetworkPopup.networkType = Constants.networkRinkeby;
|
addNetworkPopup.networkType = Constants.networkRinkeby;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
StatusRadioButtonRow {
|
StatusRadioButtonRow {
|
||||||
id: customRadioBtn
|
id: customRadioBtn
|
||||||
//% "Custom"
|
//% "Custom"
|
||||||
text: qsTrId("custom")
|
objectName: "custom"
|
||||||
buttonGroup: networkChainGroup
|
text: qsTrId("custom")
|
||||||
onRadioCheckedChanged: {
|
buttonGroup: networkChainGroup
|
||||||
if (checked) {
|
onRadioCheckedChanged: {
|
||||||
addNetworkPopup.networkType = "";
|
if (checked) {
|
||||||
|
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"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user