fix(@desktop): StatusScrollView fixes for wallet
This commit is contained in:
parent
58e0fce819
commit
667db7038a
|
@ -14,6 +14,7 @@ Rectangle {
|
||||||
id: walletFooter
|
id: walletFooter
|
||||||
|
|
||||||
property var sendModal
|
property var sendModal
|
||||||
|
property var walletStore
|
||||||
|
|
||||||
height: 61
|
height: 61
|
||||||
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
||||||
|
@ -57,7 +58,7 @@ Rectangle {
|
||||||
Component {
|
Component {
|
||||||
id: receiveModalComponent
|
id: receiveModalComponent
|
||||||
ReceiveModal {
|
ReceiveModal {
|
||||||
selectedAccount: walletHeader.walletStore.currentAccount
|
selectedAccount: walletStore.currentAccount
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ Popup {
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: content
|
id: content
|
||||||
width: popup.width
|
width: scrollView.availableWidth
|
||||||
spacing: Style.current.padding
|
spacing: Style.current.padding
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|
|
@ -78,6 +78,7 @@ Item {
|
||||||
Layout.leftMargin: -root.StackView.view.anchors.leftMargin
|
Layout.leftMargin: -root.StackView.view.anchors.leftMargin
|
||||||
Layout.rightMargin: -root.StackView.view.anchors.rightMargin
|
Layout.rightMargin: -root.StackView.view.anchors.rightMargin
|
||||||
sendModal: root.sendModal
|
sendModal: root.sendModal
|
||||||
|
walletStore: RootStore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,134 +266,123 @@ StatusModal {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
anchors.top: border.bottom
|
anchors.top: border.bottom
|
||||||
anchors.topMargin: Style.current.halfPadding
|
anchors.topMargin: Style.current.halfPadding
|
||||||
anchors.left: parent.left
|
|
||||||
contentHeight: recipientSelector.height + addressSelector.height + networkSelector.height +
|
|
||||||
fees.height + Style.current.halfPadding
|
|
||||||
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
width: scrollView.availableWidth
|
||||||
|
spacing: Style.current.halfPadding
|
||||||
// To-do use standard StatusInput component once the flow for ens name resolution is clear
|
// To-do use standard StatusInput component once the flow for ens name resolution is clear
|
||||||
RecipientSelector {
|
RecipientSelector {
|
||||||
anchors.top: parent.top
|
id: recipientSelector
|
||||||
anchors.topMargin: Style.current.halfPadding
|
accounts: popup.store.accounts
|
||||||
anchors.right: parent.right
|
contactsStore: popup.contactsStore
|
||||||
anchors.left: parent.left
|
label: qsTr("To")
|
||||||
|
input.placeholderText: qsTr("Enter an ENS name or address")
|
||||||
id: recipientSelector
|
input.anchors.leftMargin: 0
|
||||||
accounts: popup.store.accounts
|
input.anchors.rightMargin: 0
|
||||||
contactsStore: popup.contactsStore
|
labelFont.pixelSize: 15
|
||||||
label: qsTr("To")
|
labelFont.weight: Font.Normal
|
||||||
Layout.fillWidth: true
|
input.height: 56
|
||||||
input.placeholderText: qsTr("Enter an ENS name or address")
|
isSelectorVisible: false
|
||||||
input.anchors.leftMargin: 0
|
addContactEnabled: false
|
||||||
input.anchors.rightMargin: 0
|
onSelectedRecipientChanged: gasSelector.estimateGas()
|
||||||
labelFont.pixelSize: 15
|
Layout.fillWidth: true
|
||||||
labelFont.weight: Font.Normal
|
|
||||||
input.height: 56
|
|
||||||
isSelectorVisible: false
|
|
||||||
addContactEnabled: false
|
|
||||||
onSelectedRecipientChanged: gasSelector.estimateGas()
|
|
||||||
}
|
|
||||||
|
|
||||||
TabAddressSelectorView {
|
|
||||||
id: addressSelector
|
|
||||||
anchors.top: recipientSelector.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.left: parent.left
|
|
||||||
store: popup.store
|
|
||||||
onContactSelected: {
|
|
||||||
recipientSelector.input.text = address
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
NetworkSelector {
|
TabAddressSelectorView {
|
||||||
id: networkSelector
|
id: addressSelector
|
||||||
store: popup.store
|
store: popup.store
|
||||||
selectedAccount: popup.selectedAccount
|
onContactSelected: {
|
||||||
anchors.top: addressSelector.bottom
|
recipientSelector.input.text = address
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.left: parent.left
|
|
||||||
amountToSend: isNaN(parseFloat(amountToSendInput.text)) ? 0 : parseFloat(amountToSendInput.text)
|
|
||||||
requiredGasInEth: gasSelector.selectedGasEthValue
|
|
||||||
assets: popup.selectedAccount.assets
|
|
||||||
selectedAsset: assetSelector.selectedAsset
|
|
||||||
onNetworkChanged: function(chainId) {
|
|
||||||
gasSelector.suggestedFees = popup.store.suggestedFees(chainId)
|
|
||||||
gasSelector.updateGasEthValue()
|
|
||||||
}
|
|
||||||
onReCalculateSuggestedRoute: popup.recalculateRoutesAndFees(disabledChainIds)
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: fees
|
|
||||||
radius: 13
|
|
||||||
color: Theme.palette.indirectColor1
|
|
||||||
anchors.top: networkSelector.bottom
|
|
||||||
width: parent.width
|
|
||||||
height: gasSelector.visible || gasValidator.visible ? feesLayout.height + gasValidator.height : 0
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
id: feesLayout
|
|
||||||
spacing: 10
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.margins: Style.current.padding
|
|
||||||
|
|
||||||
StatusRoundIcon {
|
|
||||||
id: feesIcon
|
|
||||||
Layout.alignment: Qt.AlignTop
|
|
||||||
radius: 8
|
|
||||||
icon.name: "fees"
|
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignTop
|
}
|
||||||
GasSelector {
|
|
||||||
id: gasSelector
|
|
||||||
Layout.preferredWidth: fees.width - feesIcon.width - Style.current.xlPadding
|
|
||||||
getGasEthValue: popup.store.getGasEthValue
|
|
||||||
getFiatValue: popup.store.getFiatValue
|
|
||||||
getEstimatedTime: popup.store.getEstimatedTime
|
|
||||||
defaultCurrency: popup.store.currentCurrency
|
|
||||||
chainId: networkSelector.selectedNetwork && networkSelector.selectedNetwork.chainId ? networkSelector.selectedNetwork.chainId : 1
|
|
||||||
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
|
|
||||||
if (!(popup.selectedAccount && popup.selectedAccount.address &&
|
|
||||||
recipientSelector.selectedRecipient && recipientSelector.selectedRecipient.address &&
|
|
||||||
assetSelector.selectedAsset && assetSelector.selectedAsset.symbol &&
|
|
||||||
amountToSendInput.text)) {
|
|
||||||
selectedGasLimit = 250000
|
|
||||||
defaultGasLimit = selectedGasLimit
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
var chainID = networkSelector.selectedNetwork ? networkSelector.selectedNetwork.chainId: 1
|
NetworkSelector {
|
||||||
|
id: networkSelector
|
||||||
|
store: popup.store
|
||||||
|
selectedAccount: popup.selectedAccount
|
||||||
|
amountToSend: isNaN(parseFloat(amountToSendInput.text)) ? 0 : parseFloat(amountToSendInput.text)
|
||||||
|
requiredGasInEth: gasSelector.selectedGasEthValue
|
||||||
|
assets: popup.selectedAccount.assets
|
||||||
|
selectedAsset: assetSelector.selectedAsset
|
||||||
|
onNetworkChanged: function(chainId) {
|
||||||
|
gasSelector.suggestedFees = popup.store.suggestedFees(chainId)
|
||||||
|
gasSelector.updateGasEthValue()
|
||||||
|
}
|
||||||
|
onReCalculateSuggestedRoute: popup.recalculateRoutesAndFees(disabledChainIds)
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
let gasEstimate = JSON.parse(popup.store.estimateGas(
|
Rectangle {
|
||||||
popup.selectedAccount.address,
|
id: fees
|
||||||
recipientSelector.selectedRecipient.address,
|
radius: 13
|
||||||
assetSelector.selectedAsset.symbol,
|
color: Theme.palette.indirectColor1
|
||||||
amountToSendInput.text,
|
implicitHeight: gasSelector.visible || gasValidator.visible ? feesLayout.height + gasValidator.height : 0
|
||||||
chainID || Global.currentChainId,
|
Layout.fillWidth: true
|
||||||
""))
|
|
||||||
|
|
||||||
if (!gasEstimate.success) {
|
RowLayout {
|
||||||
console.warn("error estimating gas: %1").arg(gasEstimate.error.message)
|
id: feesLayout
|
||||||
return
|
spacing: 10
|
||||||
}
|
anchors.top: parent.top
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.margins: Style.current.padding
|
||||||
|
|
||||||
selectedGasLimit = gasEstimate.result
|
StatusRoundIcon {
|
||||||
defaultGasLimit = selectedGasLimit
|
id: feesIcon
|
||||||
})
|
Layout.alignment: Qt.AlignTop
|
||||||
|
radius: 8
|
||||||
|
icon.name: "fees"
|
||||||
}
|
}
|
||||||
GasValidator {
|
ColumnLayout {
|
||||||
id: gasValidator
|
Layout.alignment: Qt.AlignTop
|
||||||
anchors.horizontalCenter: undefined
|
GasSelector {
|
||||||
Layout.alignment: Qt.AlignHCenter
|
id: gasSelector
|
||||||
selectedAccount: popup.selectedAccount
|
Layout.preferredWidth: fees.width - feesIcon.width - Style.current.xlPadding
|
||||||
selectedAmount: amountToSendInput.text === "" ? 0.0 :
|
getGasEthValue: popup.store.getGasEthValue
|
||||||
parseFloat(amountToSendInput.text)
|
getFiatValue: popup.store.getFiatValue
|
||||||
selectedAsset: assetSelector.selectedAsset
|
getEstimatedTime: popup.store.getEstimatedTime
|
||||||
selectedGasEthValue: gasSelector.selectedGasEthValue
|
defaultCurrency: popup.store.currentCurrency
|
||||||
selectedNetwork: networkSelector.selectedNetwork ? networkSelector.selectedNetwork: null
|
chainId: networkSelector.selectedNetwork && networkSelector.selectedNetwork.chainId ? networkSelector.selectedNetwork.chainId : 1
|
||||||
|
property var estimateGas: Backpressure.debounce(gasSelector, 600, function() {
|
||||||
|
if (!(popup.selectedAccount && popup.selectedAccount.address &&
|
||||||
|
recipientSelector.selectedRecipient && recipientSelector.selectedRecipient.address &&
|
||||||
|
assetSelector.selectedAsset && assetSelector.selectedAsset.symbol &&
|
||||||
|
amountToSendInput.text)) {
|
||||||
|
selectedGasLimit = 250000
|
||||||
|
defaultGasLimit = selectedGasLimit
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var chainID = networkSelector.selectedNetwork ? networkSelector.selectedNetwork.chainId: 1
|
||||||
|
|
||||||
|
let gasEstimate = JSON.parse(popup.store.estimateGas(
|
||||||
|
popup.selectedAccount.address,
|
||||||
|
recipientSelector.selectedRecipient.address,
|
||||||
|
assetSelector.selectedAsset.symbol,
|
||||||
|
amountToSendInput.text,
|
||||||
|
chainID || Global.currentChainId,
|
||||||
|
""))
|
||||||
|
|
||||||
|
if (!gasEstimate.success) {
|
||||||
|
console.warn("error estimating gas: %1").arg(gasEstimate.error.message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
selectedGasLimit = gasEstimate.result
|
||||||
|
defaultGasLimit = selectedGasLimit
|
||||||
|
})
|
||||||
|
}
|
||||||
|
GasValidator {
|
||||||
|
id: gasValidator
|
||||||
|
anchors.horizontalCenter: undefined
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
selectedAccount: popup.selectedAccount
|
||||||
|
selectedAmount: amountToSendInput.text === "" ? 0.0 :
|
||||||
|
parseFloat(amountToSendInput.text)
|
||||||
|
selectedAsset: assetSelector.selectedAsset
|
||||||
|
selectedGasEthValue: gasSelector.selectedGasEthValue
|
||||||
|
selectedNetwork: networkSelector.selectedNetwork ? networkSelector.selectedNetwork: null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue