From fc18b72848f2fcec02a886060d875e4fc1c237b8 Mon Sep 17 00:00:00 2001 From: Ivan Belyakov Date: Mon, 13 Mar 2023 14:51:57 +0300 Subject: [PATCH] feat(@desktop/wallet): Added menu items to check address activity on arbiscan and optmism explorer. Fix menu position to align right of the 'more' button Fixes: #9771 --- .../controls/SavedAddressesDelegate.qml | 46 +++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml b/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml index 0b4c17d48f..1ed9669cec 100644 --- a/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml +++ b/ui/app/AppLayouts/Wallet/controls/SavedAddressesDelegate.qml @@ -79,8 +79,17 @@ StatusListItem { radius: 8 icon.name: "more" onClicked: { - editDeleteMenu.openMenu(root.name, root.address, root.favourite, root.chainShortNames, root.ens); + editDeleteMenu.openMenu(this, x - editDeleteMenu.width - statusListItemComponentsSlot.spacing, y + height + Style.current.halfPadding, + { + name: root.name, + address: root.address, + favourite: root.favourite, + chainShortNames: root.chainShortNames, + ens: root.ens, + } + ); } + }, StatusRoundButton { visible: !root.name @@ -105,13 +114,18 @@ StatusListItem { property bool storeFavourite property string contactChainShortNames property string contactEns - function openMenu(name, address, favourite, chainShortNames, ens) { - contactName = name; - contactAddress = address; - storeFavourite = favourite; - contactChainShortNames = chainShortNames; - contactEns = ens; - popup(); + + readonly property int maxHeight: 341 + height: implicitHeight > maxHeight ? maxHeight : implicitHeight + contentWidth: 216 + + function openMenu(parent, x, y, model) { + contactName = model.name; + contactAddress = model.address; + storeFavourite = model.favourite; + contactChainShortNames = model.chainShortNames; + contactEns = model.ens; + popup(parent, x, y); } onClosed: { contactName = ""; @@ -156,6 +170,22 @@ StatusListItem { Global.openLink("https://etherscan.io/address/%1".arg(d.visibleAddress ? d.visibleAddress : root.ens)) } } + StatusAction { + text: qsTr("View on Arbiscan") + objectName: "viewOnArbiscanAction" + assetSettings.name: "external" + onTriggered: { + Global.openLink("https://arbiscan.io/address/%1".arg(d.visibleAddress ? d.visibleAddress : root.ens)) + } + } + StatusAction { + text: qsTr("View on Optimism Explorer") + objectName: "viewOnOptimismExplorerAction" + assetSettings.name: "external" + onTriggered: { + Global.openLink("https://optimistic.etherscan.io/address/%1".arg(d.visibleAddress ? d.visibleAddress : root.ens)) + } + } StatusMenuSeparator { } StatusAction { text: qsTr("Delete")