2022-07-01 11:24:32 +00:00
|
|
|
|
import QtQuick 2.13
|
2022-05-19 08:53:57 +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
|
|
|
|
|
|
|
|
|
|
import "../controls"
|
|
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
|
implicitHeight: visible ? tabBar.height + stackLayout.height + 2* Style.current.xlPadding : 0
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
|
|
|
|
property var store
|
|
|
|
|
property var selectedAccount
|
|
|
|
|
property var selectedAsset
|
|
|
|
|
property double amountToSend: 0
|
|
|
|
|
property double requiredGasInEth: 0
|
2022-10-17 10:17:25 +00:00
|
|
|
|
property var bestRoutes
|
|
|
|
|
property bool isLoading: false
|
|
|
|
|
property bool advancedOrCustomMode: (tabBar.currentIndex === 1) || (tabBar.currentIndex === 2)
|
|
|
|
|
property bool errorMode: (tabBar.currentIndex === 1) ?
|
|
|
|
|
advancedNetworkRoutingPage.errorMode :
|
|
|
|
|
(tabBar.currentIndex === 2) ?
|
|
|
|
|
customNetworkRoutingPage.errorMode: false
|
|
|
|
|
property bool interactive: true
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
2022-10-17 10:17:25 +00:00
|
|
|
|
signal reCalculateSuggestedRoute()
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
2022-07-01 11:24:32 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
readonly property int backgroundRectRadius: 13
|
|
|
|
|
readonly property string backgroundRectColor: Theme.palette.indirectColor1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusSwitchTabBar {
|
|
|
|
|
id: tabBar
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
|
StatusSwitchTabButton {
|
|
|
|
|
text: qsTr("Simple")
|
|
|
|
|
}
|
|
|
|
|
StatusSwitchTabButton {
|
|
|
|
|
text: qsTr("Advanced")
|
|
|
|
|
}
|
2022-10-17 10:17:25 +00:00
|
|
|
|
// To-do Implementaion is not ready yet
|
|
|
|
|
// StatusSwitchTabButton {
|
|
|
|
|
// text: qsTr("Custom")
|
|
|
|
|
// }
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
|
|
|
|
StackLayout {
|
|
|
|
|
id: stackLayout
|
2022-07-01 11:24:32 +00:00
|
|
|
|
anchors.top: tabBar.bottom
|
|
|
|
|
anchors.topMargin: Style.current.bigPadding
|
|
|
|
|
height: currentIndex == 0 ? networksSimpleRoutingPage.height + networksSimpleRoutingPage.anchors.margins + Style.current.bigPadding:
|
|
|
|
|
currentIndex == 1 ? advancedNetworkRoutingPage.height + advancedNetworkRoutingPage.anchors.margins + Style.current.bigPadding:
|
|
|
|
|
customNetworkRoutingPage.height + customNetworkRoutingPage.anchors.margins + Style.current.bigPadding
|
2022-05-19 08:53:57 +00:00
|
|
|
|
width: parent.width
|
2022-07-01 11:24:32 +00:00
|
|
|
|
currentIndex: tabBar.currentIndex
|
2022-05-19 08:53:57 +00:00
|
|
|
|
|
2022-07-01 11:24:32 +00:00
|
|
|
|
Rectangle {
|
|
|
|
|
id: simple
|
|
|
|
|
radius: d.backgroundRectRadius
|
|
|
|
|
color: d.backgroundRectColor
|
|
|
|
|
NetworksSimpleRoutingView {
|
|
|
|
|
id: networksSimpleRoutingPage
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.margins: Style.current.padding
|
2022-07-27 21:10:00 +00:00
|
|
|
|
width: stackLayout.width - Style.current.bigPadding
|
2022-10-17 10:17:25 +00:00
|
|
|
|
bestRoutes: root.bestRoutes
|
2022-07-01 11:24:32 +00:00
|
|
|
|
amountToSend: root.amountToSend
|
2022-10-17 10:17:25 +00:00
|
|
|
|
isLoading: root.isLoading
|
|
|
|
|
weiToEth: function(wei) {
|
|
|
|
|
return "%1 %2".arg(LocaleUtils.numberToLocaleString(parseFloat(store.getWei2Eth(wei)))).arg(selectedAsset.symbol)
|
2022-05-19 08:53:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-01 11:24:32 +00:00
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: advanced
|
|
|
|
|
radius: d.backgroundRectRadius
|
|
|
|
|
color: d.backgroundRectColor
|
|
|
|
|
NetworksAdvancedCustomRoutingView {
|
|
|
|
|
id: advancedNetworkRoutingPage
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.margins: Style.current.padding
|
|
|
|
|
store: root.store
|
|
|
|
|
selectedAccount: root.selectedAccount
|
|
|
|
|
amountToSend: root.amountToSend
|
|
|
|
|
requiredGasInEth: root.requiredGasInEth
|
|
|
|
|
selectedAsset: root.selectedAsset
|
2022-10-17 10:17:25 +00:00
|
|
|
|
onReCalculateSuggestedRoute: root.reCalculateSuggestedRoute()
|
|
|
|
|
bestRoutes: root.bestRoutes
|
|
|
|
|
isLoading: root.isLoading
|
|
|
|
|
interactive: root.interactive
|
|
|
|
|
weiToEth: function(wei) {
|
|
|
|
|
return parseFloat(store.getWei2Eth(wei))
|
|
|
|
|
}
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: custom
|
|
|
|
|
radius: d.backgroundRectRadius
|
|
|
|
|
color: d.backgroundRectColor
|
|
|
|
|
NetworksAdvancedCustomRoutingView {
|
|
|
|
|
id: customNetworkRoutingPage
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
|
|
|
|
anchors.margins: Style.current.padding
|
|
|
|
|
customMode: true
|
|
|
|
|
store: root.store
|
|
|
|
|
selectedAccount: root.selectedAccount
|
|
|
|
|
amountToSend: root.amountToSend
|
|
|
|
|
requiredGasInEth: root.requiredGasInEth
|
|
|
|
|
selectedAsset: root.selectedAsset
|
2022-10-17 10:17:25 +00:00
|
|
|
|
onReCalculateSuggestedRoute: root.reCalculateSuggestedRoute()
|
|
|
|
|
bestRoutes: root.bestRoutes
|
|
|
|
|
isLoading: root.isLoading
|
|
|
|
|
interactive: root.interactive
|
|
|
|
|
weiToEth: function(wei) {
|
|
|
|
|
return parseFloat(store.getWei2Eth(wei))
|
|
|
|
|
}
|
2022-07-01 11:24:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-19 08:53:57 +00:00
|
|
|
|
}
|
2022-07-27 21:10:00 +00:00
|
|
|
|
}
|