status-desktop/ui/app/AppLayouts/Wallet/panels/ContractInfoButtonWithMenu.qml
Lukáš Tinkl 38d155f590 feat(SwapModal): Integrate Sign and Approve modals
- remove old popup and related components/adaptors
- simplify the API of the Sign/Approve modals to take pre-formatted
amounts as strings
- correct login/auth icon
- SB: make it possible to open the new secondary modals
- SB: fix the `fetchSuggestedRoutes` response handling, pass around the
`uuid` and inject it to the mocked suggested routes
- adjust SB pages and tests

Fixes #15443
2024-07-12 16:04:21 +02:00

62 lines
2.1 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import StatusQ 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
import utils 1.0
StatusFlatButton {
id: root
required property string symbol
required property string contractAddress
required property string networkName
required property string networkShortName
required property string networkBlockExplorerUrl
signal openLink(string link)
icon.name: "more"
icon.color: highlighted ? Theme.palette.directColor1 : Theme.palette.directColor5
highlighted: moreMenu.opened
onClicked: moreMenu.popup(-moreMenu.width + width, height + 4)
function getExplorerName() {
if (root.networkShortName === Constants.networkShortChainNames.arbitrum || root.networkShortName === Constants.networkShortChainNames.arbitrum_goerli) {
return qsTr("Arbiscan")
}
if (root.networkShortName === Constants.networkShortChainNames.optimism || root.networkShortName === Constants.networkShortChainNames.optimism_goerli) {
return qsTr("Optimistic")
}
return qsTr("Etherscan")
}
StatusMenu {
id: moreMenu
StatusAction {
//: e.g. "View Optimism (DAI) contract address on Optimistic"
text: !!root.symbol ? qsTr("View %1 %2 contract address on %3").arg(root.networkName).arg(root.symbol).arg(getExplorerName())
: qsTr("View %1 contract address on %2").arg(root.networkName).arg(getExplorerName())
icon.name: "external-link"
onTriggered: {
var link = "%1/%2/%3".arg(root.networkBlockExplorerUrl).arg(Constants.networkExplorerLinks.addressPath).arg(root.contractAddress)
root.openLink(link)
}
}
StatusSuccessAction {
text: qsTr("Copy contract address")
successText: qsTr("Copied")
icon.name: "copy"
autoDismissMenu: true
onTriggered: Utils.copyToClipboard(root.contractAddress)
}
}
}