feat: change network name and color based on network

This commit is contained in:
Jonathan Rainville 2020-10-15 15:08:56 -04:00 committed by Iuri Matias
parent b5859fffa8
commit 7ddb7c6c30
3 changed files with 25 additions and 9 deletions

View File

@ -46,13 +46,25 @@ Popup {
width: 8
height: 8
radius: width / 2
color: Style.current.green
color: {
switch (profileModel.network) {
case Constants.networkMainnet: return Style.current.green;
case Constants.networkRopsten: return Style.current.turquoise;
default: return Style.current.red
}
}
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
id: networkText
text: "Mainnet"
text: {
switch (profileModel.network) {
case Constants.networkMainnet: return qsTr("Mainnet");
case Constants.networkRopsten: return qsTr("Ropsten");
default: return qsTr("Unknown")
}
}
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
anchors.left: networkColorCircle.right
@ -61,7 +73,7 @@ Popup {
StyledText {
id: disconectBtn
text: "Disconnect"
text: qsTr("Disconnect")
font.pixelSize: 15
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
@ -70,7 +82,7 @@ Popup {
MouseArea {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: console.log('Disconnect')
onClicked: console.log('TODO Disconnect')
}
}
@ -122,7 +134,8 @@ Popup {
height: 20
anchors.right: sendBtn.left
anchors.rightMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.topMargin: Style.current.padding
textToCopy: accountSelector.selectedAccount.address
}
@ -132,7 +145,8 @@ Popup {
width: 20
height: 20
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.topMargin: Style.current.padding
iconColor: Style.current.primary
onClicked: {
sendModal.selectFromAccount.selectedAccount = accountSelector.selectedAccount

View File

@ -102,12 +102,12 @@ Item {
text: qsTrId("enable-testnet--ropsten--ncurrent-network---1").arg(profileModel.network)
}
StatusSwitch {
checked: profileModel.network === "testnet_rpc"
checked: profileModel.network === Constants.networkRopsten
onCheckedChanged: {
if (checked && profileModel.network === "testnet_rpc" || !checked && profileModel.network === "mainnet_rpc"){
if (checked && profileModel.network === Constants.networkRopsten || !checked && profileModel.network === Constants.networkMainnet){
return;
}
profileModel.network = checked ? "testnet_rpc" : "mainnet_rpc";
profileModel.network = checked ? Constants.networkRopsten : Constants.networkMainnet;
}
}
StyledText {

View File

@ -58,6 +58,8 @@ QtObject {
"#8B3131"
]
readonly property string networkRopsten: "testnet_rpc"
readonly property string networkMainnet: "mainnet_rpc"
readonly property string api_request: "api-request"
readonly property string web3SendAsyncReadOnly: "web3-send-async-read-only"