2023-02-17 14:09:15 +00:00
|
|
|
|
import QtQuick 2.13
|
2022-07-01 11:24:32 +00:00
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-08-15 18:21:51 +00:00
|
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
|
|
|
|
import "../controls"
|
|
|
|
|
|
|
|
|
|
ColumnLayout {
|
2022-10-17 10:17:25 +00:00
|
|
|
|
id: root
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
|
|
|
|
property var store
|
2024-05-06 09:58:12 +00:00
|
|
|
|
property var selectedRecipient
|
2023-02-01 10:44:22 +00:00
|
|
|
|
property string ensAddressOrEmpty: ""
|
2023-02-17 12:56:31 +00:00
|
|
|
|
property double amountToSend
|
2023-02-17 14:09:15 +00:00
|
|
|
|
property int minSendCryptoDecimals: 0
|
|
|
|
|
property int minReceiveCryptoDecimals: 0
|
2022-07-01 11:24:32 +00:00
|
|
|
|
property bool customMode: false
|
|
|
|
|
property var selectedAsset
|
2022-10-17 10:17:25 +00:00
|
|
|
|
property bool isLoading: false
|
2022-07-01 11:24:32 +00:00
|
|
|
|
property bool errorMode: networksLoader.item ? networksLoader.item.errorMode : false
|
2022-10-17 10:17:25 +00:00
|
|
|
|
property var weiToEth: function(wei) {}
|
|
|
|
|
property bool interactive: true
|
2022-12-09 09:10:05 +00:00
|
|
|
|
property bool isBridgeTx: false
|
2024-07-03 08:51:15 +00:00
|
|
|
|
property var toNetworksList
|
|
|
|
|
property var fromNetworksList
|
2022-12-19 13:02:56 +00:00
|
|
|
|
property int errorType: Constants.NoError
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
|
signal reCalculateSuggestedRoute()
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
|
|
|
|
RowLayout {
|
2023-07-05 19:32:02 +00:00
|
|
|
|
Layout.fillWidth: true
|
2022-07-01 11:24:32 +00:00
|
|
|
|
spacing: 10
|
|
|
|
|
|
|
|
|
|
StatusRoundIcon {
|
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
|
radius: 8
|
2022-08-11 11:55:08 +00:00
|
|
|
|
asset.name: "flash"
|
2022-12-14 21:06:14 +00:00
|
|
|
|
asset.color: Theme.palette.directColor1
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
|
|
|
|
ColumnLayout {
|
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
RowLayout {
|
2023-07-05 19:32:02 +00:00
|
|
|
|
Layout.fillWidth: true
|
2022-07-01 11:24:32 +00:00
|
|
|
|
StatusBaseText {
|
2023-07-05 19:32:02 +00:00
|
|
|
|
Layout.fillWidth: true
|
2022-07-01 11:24:32 +00:00
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
font.weight: Font.Medium
|
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
|
text: qsTr("Networks")
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
}
|
|
|
|
|
StatusButton {
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
Layout.preferredHeight: 22
|
2022-12-01 15:48:44 +00:00
|
|
|
|
verticalPadding: -1
|
|
|
|
|
checkable: true
|
2022-07-01 11:24:32 +00:00
|
|
|
|
size: StatusBaseButton.Size.Small
|
2022-12-01 15:48:44 +00:00
|
|
|
|
icon.name: checked ? "show" : "hide"
|
|
|
|
|
icon.height: 16
|
|
|
|
|
icon.width: 16
|
|
|
|
|
text: checked ? qsTr("Hide Unpreferred Networks"): qsTr("Show Unpreferred Networks")
|
2022-12-09 09:10:05 +00:00
|
|
|
|
visible: !isBridgeTx
|
2023-08-15 18:21:51 +00:00
|
|
|
|
checked: root.store.showUnPreferredChains
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.store.toggleShowUnPreferredChains()
|
|
|
|
|
root.reCalculateSuggestedRoute()
|
|
|
|
|
}
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
StatusBaseText {
|
2023-07-05 19:32:02 +00:00
|
|
|
|
Layout.fillWidth: true
|
2022-07-01 11:24:32 +00:00
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
color: Theme.palette.baseColor1
|
2024-07-08 20:14:30 +00:00
|
|
|
|
text: qsTr("The networks where the recipient will receive tokens. Amounts calculated automatically for the lowest cost.")
|
2022-07-01 11:24:32 +00:00
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
}
|
|
|
|
|
Loader {
|
|
|
|
|
id: networksLoader
|
2023-07-05 19:32:02 +00:00
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: item.height
|
2022-07-01 11:24:32 +00:00
|
|
|
|
Layout.topMargin: Style.current.padding
|
|
|
|
|
visible: active
|
|
|
|
|
sourceComponent: NetworkCardsComponent {
|
2022-10-17 10:17:25 +00:00
|
|
|
|
store: root.store
|
2023-08-15 18:21:51 +00:00
|
|
|
|
receiverIdentityText: root.ensAddressOrEmpty.length > 0 ?
|
2024-05-06 09:58:12 +00:00
|
|
|
|
root.ensAddressOrEmpty : !!root.selectedRecipient ?
|
|
|
|
|
StatusQUtils.Utils.elideText(root.selectedRecipient.address, 6, 4).toUpperCase() : ""
|
2022-10-17 10:17:25 +00:00
|
|
|
|
amountToSend: root.amountToSend
|
2023-02-17 14:09:15 +00:00
|
|
|
|
minSendCryptoDecimals: root.minSendCryptoDecimals
|
|
|
|
|
minReceiveCryptoDecimals: root.minReceiveCryptoDecimals
|
2022-10-17 10:17:25 +00:00
|
|
|
|
customMode: root.customMode
|
|
|
|
|
selectedAsset: root.selectedAsset
|
2022-11-15 11:22:03 +00:00
|
|
|
|
reCalculateSuggestedRoute: function() {
|
|
|
|
|
root.reCalculateSuggestedRoute()
|
|
|
|
|
}
|
2024-07-03 08:51:15 +00:00
|
|
|
|
toNetworksList: root.toNetworksList
|
|
|
|
|
fromNetworksList: root.fromNetworksList
|
2022-10-17 10:17:25 +00:00
|
|
|
|
weiToEth: root.weiToEth
|
|
|
|
|
interactive: root.interactive
|
2022-12-19 13:02:56 +00:00
|
|
|
|
errorType: root.errorType
|
|
|
|
|
isLoading: root.isLoading
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|