From 991e04ef955f853cb34efddc3d1ef2529f2d0375 Mon Sep 17 00:00:00 2001 From: Boris Melnik Date: Tue, 12 Apr 2022 12:10:55 +0300 Subject: [PATCH] fix(Browser): Add new send modal Closes: #5475 --- ui/app/AppLayouts/Browser/BrowserLayout.qml | 44 ++++++++++----------- ui/app/mainui/AppMain.qml | 14 ++++++- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/ui/app/AppLayouts/Browser/BrowserLayout.qml b/ui/app/AppLayouts/Browser/BrowserLayout.qml index e8a052c51d..a2e0badc6e 100644 --- a/ui/app/AppLayouts/Browser/BrowserLayout.qml +++ b/ui/app/AppLayouts/Browser/BrowserLayout.qml @@ -152,28 +152,28 @@ Rectangle { return _internal.accessDialogComponent.createObject(browserWindow) } createSendTransactionModalComponent: function(request) { - return _internal.sendTransactionModalComponent.createObject(browserWindow, { - trxData: request.payload.params[0].data || "", - selectedAccount: { - name: WalletStore.dappBrowserAccount.name, - address: request.payload.params[0].from, - iconColor: WalletStore.dappBrowserAccount.color, - assets: WalletStore.dappBrowserAccount.assets - }, - selectedRecipient: { - address: request.payload.params[0].to, - identicon: "", - name: RootStore.activeChannelName, - type: RecipientSelector.Type.Address - }, - selectedAsset: { - name: "ETH", - symbol: "ETH", - address: Constants.zeroAddress - }, - selectedFiatAmount: "42", // TODO calculate that - selectedAmount: RootStore.getWei2Eth(request.payload.params[0].value, 18) - }) + browserWindow.sendTransactionModal.selectedAccount = { + name: WalletStore.dappBrowserAccount.name, + address: request.payload.params[0].from, + iconColor: WalletStore.dappBrowserAccount.color, + assets: WalletStore.dappBrowserAccount.assets + } + browserWindow.sendTransactionModal.selectedRecipient = { + address: request.payload.params[0].to, + identicon: "", + name: RootStore.activeChannelName, + type: RecipientSelector.Type.Address + } + + browserWindow.sendTransactionModal.selectedAmountAsset = { + name: "ETH", + symbol: "ETH", + address: Constants.zeroAddress + } + browserWindow.sendTransactionModal.selectedAmount = RootStore.getWei2Eth(request.payload.params[0].value, 18) + + + browserWindow.sendTransactionModal.open() } createSignMessageModalComponent: function(request) { return _internal.signMessageModalComponent.createObject(browserWindow, { diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index a76644cfb4..d6af5c5c18 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -800,6 +800,9 @@ Item { this.active = false } property var selectedAccount + property var selectedRecipient + property var selectedAmount + property var selectedAmountAsset sourceComponent: SendModal { anchors.centerIn: parent store: appMain.rootStore @@ -813,9 +816,18 @@ Item { } } onLoaded: { - if(!!sendModal.selectedAccount) { + if (!!sendModal.selectedAccount) { item.preSelectedAccount = sendModal.selectedAccount } + if (!!sendModal.selectedRecipient) { + item.preSelectedRecipient = sendModal.selectedRecipient + } + if (!!sendModal.selectedAmount) { + item.advancedHeader.amountToSendInput.text = sendModal.selectedAmount + } + if (!!sendModal.selectedAmountAsset) { + item.advancedHeader.assetSelector.selectedAsset = sendModal.selectedAmountAsset + } } }