2024-07-01 15:56:44 +00:00
|
|
|
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
|
2024-07-04 11:55:16 +00:00
|
|
|
required property string networkShortName
|
2024-07-01 15:56:44 +00:00
|
|
|
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)
|
|
|
|
|
2024-07-04 11:55:16 +00:00
|
|
|
function getExplorerName() {
|
2024-11-15 05:04:00 +00:00
|
|
|
return Utils.getChainExplorerName(root.networkShortName)
|
2024-07-04 11:55:16 +00:00
|
|
|
}
|
|
|
|
|
2024-07-01 15:56:44 +00:00
|
|
|
StatusMenu {
|
|
|
|
id: moreMenu
|
|
|
|
|
|
|
|
StatusAction {
|
2024-07-04 11:55:16 +00:00
|
|
|
//: 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())
|
2024-07-01 15:56:44 +00:00
|
|
|
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"
|
2024-07-10 18:35:24 +00:00
|
|
|
autoDismissMenu: true
|
2024-08-27 14:35:52 +00:00
|
|
|
onTriggered: ClipboardUtils.setText(root.contractAddress)
|
2024-07-01 15:56:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|