chore: remove unused components

This commit is contained in:
Dario Gabriel Lipicar 2024-11-08 14:40:29 -03:00 committed by dlipicar
parent a53eb6001f
commit 3e9e8bfe07
11 changed files with 0 additions and 1512 deletions

View File

@ -1,133 +0,0 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import utils 1.0
import AppLayouts.Wallet.controls 1.0
import AppLayouts.Wallet.panels 1.0
import StatusQ.Controls 0.1
import StatusQ.Core.Theme 0.1
import Storybook 1.0
import Models 1.0
SplitView {
id: root
Logs { id: logs }
orientation: Qt.Vertical
QtObject {
id: d
property var dummyTx: ({
id: 0xb501e3042105c382a498819b07aba58de3422984e1150655c1583bd1aae144ef,
txType: "erc20",
address: 0x9d41ac74e7d1f981e98f4ec0d631cde0857a2b9c,
blockNumber: 0x7b7935,
blockHash: 0,
timestamp: 1670419848,
nonce: 0x36,
txStatus: 0x1,
chainId: 5,
txHash: 0x82de33a9e81f7c06ea03ad742bc666c4eacb7ec771bac4544ef70a12b2c46d04,
symbol: "ETH",
})
}
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
Column {
anchors.centerIn: parent
spacing: 100
StatusTxProgressBar {
id: progressBar
anchors.horizontalCenter: parent.horizontalCenter
width: 500
error: failureCheckBox.checked
networkLayer: mainnetCheckbox.checked ? 1 : 2
confirmations: confirmationsSlider.value
duration: durationSlider.to
progress: durationSlider.value
chainName: isLayer1 ? "Mainnet" : "Optimism"
}
Rectangle {
width: root.width
height: 200
border.width: 2
WalletTxProgressBlock {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 20
width: 500
error: failureCheckBox.checked
inNetworkConfirmations: confirmationsSlider.value
outNetworkConfirmations: confirmationsSlider.value
inChainName: progressBar.isLayer1 ? "Mainnet" : "Optimism"
outChainName: inChainName
inNetworkTimestamp: 1670419847
outNetworkTimestamp: 1670419848
}
}
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 250
logsView.logText: logs.logText
Column {
CheckBox {
id: mainnetCheckbox
text: "Mainnet"
checked: true
}
CheckBox {
id: failureCheckBox
text: "Failed"
}
Slider {
id: confirmationsSlider
width: 600
value: 0
from: 0
to: 1000
stepSize: 1
Text {
anchors.left: parent.right
anchors.verticalCenter: parent.verticalCenter
text: "Confirmations = " + confirmationsSlider.value
}
}
TextField {
id: duration
placeholderText: "Duration for finalisation"
text: "7"
visible: !mainnetCheckbox.checked && !failureCheckBox.checked
}
Slider {
id: durationSlider
width: 600
value: 0
from: 0
to: Number(duration.text)*24
stepSize: 1
Text {
anchors.left: parent.right
anchors.verticalCenter: parent.verticalCenter
text: "Finalisation = " + durationSlider.value
}
visible: !mainnetCheckbox.checked && !failureCheckBox.checked
}
}
}
}
// category: Wallet

View File

@ -1,213 +0,0 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Storybook 1.0
import StatusQ.Core.Theme 0.1
import shared.controls 1.0
import utils 1.0
SplitView {
id: root
orientation: Qt.Vertical
property bool globalUtilsReady: false
property bool mainModuleReady: false
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
Rectangle {
anchors.fill: loader
anchors.margins: -1
color: "transparent"
border.width: 1
border.color: "#20000000"
}
// globalUtilsInst mock
QtObject {
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
function getColorHashAsJson(publicKey) {
return JSON.stringify([{"segmentLength":1,"colorId":12},{"segmentLength":5,"colorId":18},
{"segmentLength":3,"colorId":25},{"segmentLength":3,"colorId":23},
{"segmentLength":1,"colorId":10},{"segmentLength":3,"colorId":26},
{"segmentLength":2,"colorId":30},{"segmentLength":1,"colorId":18},
{"segmentLength":4,"colorId":28},{"segmentLength":1,"colorId":17},
{"segmentLength":2,"colorId":2}])
}
function isCompressedPubKey(publicKey) { return true }
function getColorId(publicKey) { return Math.floor(Math.random() * 10) }
Component.onCompleted: {
Utils.globalUtilsInst = this
root.globalUtilsReady = true
}
Component.onDestruction: {
root.globalUtilsReady = false
Utils.globalUtilsInst = {}
}
}
// mainModuleInst mock
QtObject {
function getContactDetailsAsJson(publicKey, getVerification) {
return JSON.stringify({
displayName: "ArianaP",
displayIcon: "",
publicKey: publicKey,
name: "",
alias: "",
localNickname: "",
isContact: d.isContact
})
}
function isEnsVerified(publicKey) { return false }
Component.onCompleted: {
Utils.mainModuleInst = this
root.mainModuleReady = true
}
Component.onDestruction: {
root.mainModuleReady = false
Utils.mainModuleInst = {}
}
}
QtObject {
id: d
property string addressName: "Ariana Pearlona"
property bool isContact: true
property bool isWallet: false
property bool isSavedAccount: false
readonly property string displayAddress: "0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"
}
QtObject {
id: contactsStoreMockup
readonly property var myContactsModel: QtObject {
signal itemChanged(address: string)
}
function getContactPublicKeyByAddress(address) {
return d.isContact ? "zQ3shWU7xpM5YoG19KP5JDRiSs1AdWtjpnrWEerMkxfQnYo7x" : ""
}
}
QtObject {
id: rootStoreMockup
readonly property var accounts: QtObject {
signal itemChanged(address: string)
}
readonly property var savedAddresses: QtObject {
readonly property var sourceModel: QtObject {
signal itemChanged(address: string)
}
}
function getNameForSavedWalletAddress(address) {
return d.isSavedAccount ? d.addressName : ""
}
function getEmojiForWalletAddress(address) {
return '<img class="emoji" draggable="false" alt="??" src="' + Theme.emoji("1f61b") + '?72x72" width="16" height="16" style="vertical-align: top"/>'
}
function getColorForWalletAddress(address) {
return "blue"
}
function getNameForWalletAddress(address) {
return d.isWallet ? d.addressName : ""
}
}
Loader {
id: loader
anchors.centerIn: parent
width: 400
active: root.globalUtilsReady && root.mainModuleReady
sourceComponent: TransactionAddress {
width: parent.width
address: d.displayAddress
rootStore: rootStoreMockup
contactsStore: contactsStoreMockup
}
}
}
LogsAndControlsPanel {
SplitView.minimumHeight: 100
SplitView.preferredHeight: 150
SplitView.fillWidth: true
ColumnLayout {
spacing: 5
Label {
text: "Account type"
}
RadioButton {
text: "contact"
checked: d.isContact
onClicked: {
d.isContact = true
d.isWallet = false
d.isSavedAccount = false
rootStoreMockup.accounts.itemChanged(d.displayAddress)
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
}
}
RadioButton {
text: "wallet"
checked: d.isWallet
onClicked: {
d.isContact = false
d.isWallet = true
d.isSavedAccount = false
rootStoreMockup.accounts.itemChanged(d.displayAddress)
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
}
}
RadioButton {
text: "saved address"
checked: d.isSavedAccount
onClicked: {
d.isContact = false
d.isWallet = false
d.isSavedAccount = true
rootStoreMockup.accounts.itemChanged(d.displayAddress)
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
}
}
RadioButton {
text: "unkown"
onClicked: {
d.isContact = false
d.isWallet = false
d.isSavedAccount = false
rootStoreMockup.accounts.itemChanged(d.displayAddress)
rootStoreMockup.savedAddresses.sourceModel.itemChanged(d.displayAddress)
contactsStoreMockup.myContactsModel.itemChanged(d.displayAddress)
}
}
Label {
text: "Name:"
}
RowLayout {
TextField {
text: d.addressName
onTextChanged: d.addressName = text
}
}
}
}
}
// category: Wallet

View File

@ -1,160 +0,0 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Storybook 1.0
import StatusQ.Core.Theme 0.1
import shared.controls 1.0
import utils 1.0
import AppLayouts.Profile.stores 1.0
SplitView {
id: root
orientation: Qt.Vertical
property bool globalUtilsReady: false
property bool mainModuleReady: false
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
// globalUtilsInst mock
QtObject {
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
function getColorHashAsJson(publicKey) {
return JSON.stringify([{"segmentLength":1,"colorId":12},{"segmentLength":5,"colorId":18},
{"segmentLength":3,"colorId":25},{"segmentLength":3,"colorId":23},
{"segmentLength":1,"colorId":10},{"segmentLength":3,"colorId":26},
{"segmentLength":2,"colorId":30},{"segmentLength":1,"colorId":18},
{"segmentLength":4,"colorId":28},{"segmentLength":1,"colorId":17},
{"segmentLength":2,"colorId":2}])
}
function isCompressedPubKey(publicKey) { return true }
function getColorId(publicKey) { return Math.floor(Math.random() * 10) }
Component.onCompleted: {
Utils.globalUtilsInst = this
root.globalUtilsReady = true
}
Component.onDestruction: {
root.globalUtilsReady = false
Utils.globalUtilsInst = {}
}
}
// mainModuleInst mock
QtObject {
function getContactDetailsAsJson(publicKey, getVerification) {
return JSON.stringify({
displayName: "ArianaP",
displayIcon: "",
publicKey: publicKey,
name: "",
alias: "",
localNickname: "",
isContact: true
})
}
function isEnsVerified(publicKey) { return false }
Component.onCompleted: {
Utils.mainModuleInst = this
root.mainModuleReady = true
}
Component.onDestruction: {
root.mainModuleReady = false
Utils.mainModuleInst = {}
}
}
ContactsStore {
id: contactsStoreMockup
readonly property var myContactsModel: QtObject {
signal itemChanged(address: string)
}
function getContactPublicKeyByAddress(address) {
return address.includes("0x29D7d1dd5B6f9C864d9db560D72a247c178aE86C") ? "zQ3shWU7xpM5YoG19KP5JDRiSs1AdWtjpnrWEerMkxfQnYo7x" : ""
}
}
QtObject {
id: mockupRootStore
function getNameForAddress(address) {
const nameList = [ 'Alice', 'Bob', 'Charlie', 'Dave', 'Eve','Frank', 'Grace', 'Hank', 'Iris', 'Jack' ];
const randomIndex = Math.floor(Math.random() * nameList.length);
return nameList[randomIndex];
}
function getNameForSavedWalletAddress(address) {
if (address.includes("0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc35")) {
return ""
}
return getNameForAddress(address)
}
function getEmojiForWalletAddress(address) {
return '<img class="emoji" draggable="false" alt="??" src="' + Theme.emoji("1f61b") + '?72x72" width="16" height="16" style="vertical-align: top"/>'
}
function getColorForWalletAddress(address) {
return "blue"
}
function getNameForWalletAddress(address) {
if (address.includes("0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc35") || address.includes("0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc36")) {
return ""
}
return getNameForAddress(address)
}
}
Loader {
id: loader
anchors.centerIn: parent
width: 500
active: root.globalUtilsReady && root.mainModuleReady
sourceComponent: Column {
id: content
spacing: 0
TransactionAddressTile {
title: "From"
width: parent.width
rootStore: mockupRootStore
contactsStore: contactsStoreMockup
addresses: [
"0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B"
]
}
TransactionAddressTile {
title: "To"
width: parent.width
rootStore: mockupRootStore
contactsStore: contactsStoreMockup
addresses: [
"0x29D7d1dd5B6f9C864d9db560D72a247c178aE86C",
"eth:arb1:oeth:0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc35",
"0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc35",
"eth:oeth:arb1:0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc35",
"eth:oeth:arb1:0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B",
"0x29D7d1dd5B6f9C864d9db560D72a247c178aE86B",
"eth:oeth:arb1:0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc36"
]
}
}
}
}
LogsAndControlsPanel {
SplitView.minimumHeight: 100
SplitView.preferredHeight: 150
SplitView.fillWidth: true
}
}
// category: Wallet

View File

@ -1,116 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtGraphicalEffects 1.15
import StatusQ.Core.Theme 0.1
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import shared.controls 1.0
import utils 1.0
ColumnLayout {
id: root
property string nftName
property string nftUrl
property string tokenId
property string tokenAddress
property bool strikethrough: false
property bool areTestNetworksEnabled: false
spacing: Theme.padding
StatusBaseText {
Layout.fillWidth: true
font.pixelSize: 15
color: Theme.palette.directColor5
text: qsTr("Preview")
elide: Text.ElideRight
}
Rectangle {
radius: 8
Layout.fillWidth: true
Layout.preferredHeight: nftPreviewColumn.height + Theme.bigPadding
color: nftPreviewSensor.hovered ? Theme.palette.baseColor2 : "transparent"
border.width: 1
border.color: Theme.palette.separator
HoverHandler {
id: nftPreviewSensor
target: parent
}
Column {
// NOTE Using Column instead of Layout to handle image fill mode properly
id: nftPreviewColumn
spacing: Theme.padding
anchors {
left: parent.left
top: parent.top
right: parent.right
margins: Theme.bigPadding / 2
}
height: childrenRect.height
StatusRoundedMedia {
id: nftPreviewImage
width: parent.width
height: width
mediaUrl: root.nftUrl
mediaType: "image"
radius: 8
}
RowLayout {
width: parent.width
spacing: Theme.smallPadding
ColumnLayout {
Layout.fillWidth: true
Layout.rightMargin: button.visible ? 0 : button.width + parent.spacing
Layout.topMargin: Theme.smallPadding
Layout.alignment: Qt.AlignLeft
spacing: 4
StatusBaseText {
Layout.fillWidth: true
font.pixelSize: 15
font.strikeout: root.strikethrough
text: root.nftName
visible: !!text
elide: Text.ElideRight
}
StatusBaseText {
Layout.fillWidth: true
font.pixelSize: 15
color: Theme.palette.directColor5
text: root.tokenId
visible: !!text
elide: Text.ElideRight
}
}
StatusRoundButton {
id: button
implicitWidth: 32
implicitHeight: 32
Layout.alignment: Qt.AlignRight | Qt.AlignTop
icon.color: hovered ? Theme.palette.directColor1 : Theme.palette.baseColor1
icon.name: "external"
type: StatusRoundButton.Type.Quinary
radius: 8
visible: nftPreviewSensor.hovered && !!root.tokenId && !!root.tokenAddress
onClicked: {
let link = Constants.networkExplorerLinks.etherscan
if (areTestNetworksEnabled) {
link = Constants.networkExplorerLinks.sepoliaEtherscan
}
Global.openLink("%1/nft/%2/%3".arg(link).arg(root.tokenAddress).arg(root.tokenId))
}
}
}
}
}
}

View File

@ -1,116 +0,0 @@
import QtQuick 2.13
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import utils 1.0
import shared.panels 1.0
import "../controls"
ColumnLayout {
id: root
property bool error: false
property bool pending: false
property int outNetworkLayer: 0
property int inNetworkLayer: 0
property double outNetworkTimestamp: 0
property double inNetworkTimestamp: 0
property string outChainName
property string inChainName
property int outNetworkConfirmations: 0
property int inNetworkConfirmations: 0
spacing: 32
StatusTxProgressBar {
id: progressBarOut
Layout.topMargin: 8
Layout.fillWidth: true
error: root.error
networkLayer: root.outNetworkLayer
confirmations: root.outNetworkConfirmations
timestamp: root.outNetworkTimestamp
chainName: root.outChainName
}
TextColumn {
visible: progressBarOut.isValid && progressBarOut.error
text: qsTr("Failed on %1").arg(progressBarOut.chainName)
timestamp: progressBarOut.timestamp
}
StatusTxProgressBar {
id: progressBarIn
Layout.topMargin: 8
Layout.fillWidth: true
error: root.error
networkLayer: root.inNetworkLayer
confirmations: root.inNetworkConfirmations
timestamp: root.inNetworkTimestamp
chainName: root.inChainName
}
TextColumn {
visible: progressBarOut.isValid && progressBarOut.confirmed
text: qsTr("Confirmed on %1").arg(progressBarOut.chainName)
timestamp: progressBarOut.confirmationTimeStamp
}
TextColumn {
visible: progressBarIn.isValid && progressBarIn.confirmed
text: qsTr("Confirmed on %1").arg(progressBarIn.chainName)
timestamp: progressBarIn.confirmationTimeStamp
}
TextColumn {
visible: progressBarOut.isValid && progressBarOut.finalized
text: qsTr("Finalised on %1").arg(progressBarOut.chainName)
timestamp: progressBarOut.finalisationTimeStamp
}
TextColumn {
visible: progressBarIn.isValid && progressBarIn.finalized
text: qsTr("Finalised on %1").arg(progressBarIn.chainName)
timestamp: progressBarIn.finalisationTimeStamp
}
TextColumn {
visible: progressBarIn.isValid && progressBarIn.error
text: qsTr("Failed on %1").arg(progressBarIn.chainName)
timestamp: progressBarIn.timestamp
}
component TextColumn: Column {
id: textColumn
property string text
property int timestamp
spacing: 4
StatusBaseText {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 13
color: Theme.palette.baseColor1
lineHeight: 18
lineHeightMode: Text.FixedHeight
text: textColumn.text
}
StatusBaseText {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 13
color: Theme.palette.directColor1
lineHeight: 18
lineHeightMode: Text.FixedHeight
text: textColumn.timestamp > 0 ? LocaleUtils.formatDateTime(textColumn.timestamp * 1000, Locale.LongFormat) : ""
}
}
}

View File

@ -12,5 +12,3 @@ SignInfoBox 1.0 SignInfoBox.qml
SwapInputPanel 1.0 SwapInputPanel.qml
TokenSelectorPanel 1.0 TokenSelectorPanel.qml
WalletHeader 1.0 WalletHeader.qml
WalletNftPreview 1.0 WalletNftPreview.qml
WalletTxProgressBlock 1.0 WalletTxProgressBlock.qml

View File

@ -1,354 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import QtQuick.Controls 2.15
import QtQuick.Window 2.15
import StatusQ 0.1
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import shared.controls 1.0
import utils 1.0
import shared.stores 1.0
import "../stores" as WalletStores
import AppLayouts.Profile.stores 1.0 as ProfileStores
////////////////////////////////////////////////////////////////////////////////
// NOTE:
//
// The address should be marked as shown (calling `mainModule.addressWasShown(address)`) if the user interacts with
// actions in the menu that reveals the address.
//
// That call is not added now, just because the only place where this menu is used is in the transaction details view
// and the address will be already marked as shown when the user opens the transaction details view.
//
// This note here is just to remember that if this menu is used in other places, the address should be marked as shown.
////////////////////////////////////////////////////////////////////////////////
StatusMenu {
id: root
property ProfileStores.ContactsStore contactsStore
property NetworkConnectionStore networkConnectionStore
property bool areTestNetworksEnabled: false
signal openSendModal(address: string)
enum AddressType {
Address,
Sender,
Receiver,
Tx,
InputData,
Contract
}
QtObject {
id: d
property string selectedAddress: ""
property string cleanSelectedAddress: d.selectedAddress.split(":").pop()
property string addressName: ""
property string addressEns: ""
property string colorId: ""
property string contractName: ""
property int addressType: TransactionAddressMenu.AddressType.Address
readonly property QtObject exp: Constants.networkExplorerLinks
readonly property QtObject chains: Constants.networkShortChainNames
readonly property bool isAddress: d.addressType !== TransactionAddressMenu.Tx
function getViewText(target) {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Contract:
if (d.contractName.length > 0)
return qsTr("View %1 contract address on %2").arg(d.contractName).arg(target)
return qsTr("View contract address on %1").arg(target)
case TransactionAddressMenu.AddressType.InputData:
return qsTr("View input data on %1").arg(target)
case TransactionAddressMenu.AddressType.Tx:
return qsTr("View transaction on %1").arg(target)
case TransactionAddressMenu.AddressType.Sender:
return qsTr("View sender address on %1").arg(target)
case TransactionAddressMenu.AddressType.Receiver:
return qsTr("View receiver address on %1").arg(target)
default:
return qsTr("View address on %1").arg(target)
}
}
function refreshShowOnActionsVisiblity(shortChainNameList) {
for (let i = 0 ; i < shortChainNameList.length ; i++) {
switch(shortChainNameList[i].toLowerCase()) {
case d.chains.arbitrum:
showOnArbiscanAction.enabled = true
break
case d.chains.optimism:
showOnOptimismAction.enabled = true
break
default:
showOnEtherscanAction.enabled = true
break
}
}
}
function openMenu(delegate) {
const x = delegate.width - 40
const y = delegate.height / 2 + 20
root.popup(delegate, x, y)
}
readonly property TextMetrics contentMetrics: TextMetrics {
id: contentMetrics
font.pixelSize: root.fontSettings.pixelSize
font.family: Theme.baseFont.name
text: {
// Getting longest possible text
if (showOnEtherscanAction.enabled) {
return showOnEtherscanAction.text
} else if (showOnArbiscanAction.enabled) {
return showOnArbiscanAction.text
}
return showOnOptimismAction.text
}
}
}
function openSenderMenu(delegate, address, chainShortNameList = []) {
d.addressType = TransactionAddressMenu.AddressType.Sender
openEthAddressMenu(delegate, address, chainShortNameList)
}
function openReceiverMenu(delegate, address, chainShortNameList = []) {
d.addressType = TransactionAddressMenu.AddressType.Receiver
openEthAddressMenu(delegate, address, chainShortNameList)
}
function openEthAddressMenu(delegate, address, chainShortNameList = []) {
d.selectedAddress = address
address = address.toLowerCase()
const contactPubKey = "" // TODO retrive contact public key or contact data directly from address
let contactData = Utils.getContactDetailsAsJson(contactPubKey)
let isWalletAccount = false
const isContact = contactData.isContact
if (isContact) {
d.addressName = contactData.name
} else {
// Revisit here after this issue (resolving source for preferred chains...):
// https://github.com/status-im/status-desktop/issues/13109
d.addressName = WalletStores.RootStore.getNameForWalletAddress(address)
isWalletAccount = d.addressName.length > 0
if (!isWalletAccount) {
let savedAddress = WalletStores.RootStore.getSavedAddress(address)
d.addressName = savedAddress.name
d.addressEns = savedAddress.ens
d.colorId = savedAddress.colorId
}
}
showOnEtherscanAction.enabled = true
showOnArbiscanAction.enabled = address.includes(d.chains.arbitrum + ":")
showOnOptimismAction.enabled = address.includes(d.chains.optimism + ":")
d.refreshShowOnActionsVisiblity(chainShortNameList)
saveAddressAction.enabled = d.addressName.length === 0
editAddressAction.enabled = !isWalletAccount && !isContact && d.addressName.length > 0
if (root.networkConnectionStore.sendBuyBridgeEnabled)
sendToAddressAction.enabled = true
showQrAction.enabled = true
d.openMenu(delegate)
}
function openTxMenu(delegate, address, chainShortNameList=[]) {
d.addressType = TransactionAddressMenu.AddressType.Tx
d.selectedAddress = address
d.refreshShowOnActionsVisiblity(chainShortNameList)
d.openMenu(delegate)
}
function openContractMenu(delegate, address, chainShortNameList=[], name="") {
d.addressType = TransactionAddressMenu.AddressType.Contract
d.contractName = name
d.selectedAddress = address
d.refreshShowOnActionsVisiblity(chainShortNameList)
d.openMenu(delegate)
}
function openInputDataMenu(delegate, address) {
d.addressType = TransactionAddressMenu.AddressType.InputData
d.selectedAddress = address
d.openMenu(delegate)
}
onClosed: {
d.addressType = TransactionAddressMenu.AddressType.Address
d.contractName = ""
showOnEtherscanAction.enabled = false
showOnArbiscanAction.enabled = false
showOnOptimismAction.enabled = false
showQrAction.enabled = false
saveAddressAction.enabled = false
editAddressAction.enabled = false
sendToAddressAction.enabled = false
}
// Additional offset for menu icon
contentWidth: contentMetrics.width + 50
hideDisabledItems: true
StatusAction {
id: showOnEtherscanAction
enabled: false
text: d.getViewText(qsTr("Etherscan"))
icon.name: "link"
onTriggered: {
let url = Utils.getEtherscanUrl(d.chains.mainnet, root.areTestNetworksEnabled, d.cleanSelectedAddress, d.isAddress)
Global.openLink(url)
}
}
StatusAction {
id: showOnArbiscanAction
enabled: false
text: d.getViewText(qsTr("Arbiscan"))
icon.name: "link"
onTriggered: {
let url = Utils.getEtherscanUrl(d.chains.arbitrum, root.areTestNetworksEnabled, d.cleanSelectedAddress, d.isAddress)
Global.openLink(url)
}
}
StatusAction {
id: showOnOptimismAction
enabled: false
text: d.getViewText(qsTr("Optimism Explorer"))
icon.name: "link"
onTriggered: {
let url = Utils.getEtherscanUrl(d.chains.optimism, root.areTestNetworksEnabled, d.cleanSelectedAddress, d.isAddress)
Global.openLink(url)
}
}
StatusSuccessAction {
id: copyAddressAction
successText: {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Contract:
return qsTr("Contract address copied")
case TransactionAddressMenu.AddressType.InputData:
return qsTr("Input data copied")
case TransactionAddressMenu.AddressType.Tx:
return qsTr("Tx hash copied")
case TransactionAddressMenu.AddressType.Sender:
return qsTr("Sender address copied")
case TransactionAddressMenu.AddressType.Receiver:
return qsTr("Receiver address copied")
default:
return qsTr("Address copied")
}
}
text: {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Contract:
return qsTr("Copy contract address")
case TransactionAddressMenu.AddressType.InputData:
return qsTr("Copy input data")
case TransactionAddressMenu.AddressType.Tx:
return qsTr("Copy Tx hash")
case TransactionAddressMenu.AddressType.Sender:
return qsTr("Copy sender address")
case TransactionAddressMenu.AddressType.Receiver:
return qsTr("Copy receiver address")
default:
return qsTr("Copy address")
}
}
icon.name: "copy"
onTriggered: ClipboardUtils.setText(d.selectedAddress)
}
StatusAction {
id: showQrAction
enabled: false
text: {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Sender:
return qsTr("Show sender address QR")
case TransactionAddressMenu.AddressType.Receiver:
return qsTr("Show receiver address QR")
default:
return qsTr("Show address QR")
}
}
icon.name: "qr"
onTriggered: {
onTriggered: Global.openShowQRPopup({
showSingleAccount: true,
switchingAccounsEnabled: false,
hasFloatingButtons: false,
name: d.addressName,
address: d.selectedAddress,
colorId: d.colorId,
})
}
}
StatusAction {
id: saveAddressAction
enabled: false
text: {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Sender:
return qsTr("Save sender address")
case TransactionAddressMenu.AddressType.Receiver:
return qsTr("Save receiver address")
default:
return qsTr("Save address")
}
}
icon.name: "star-icon-outline"
onTriggered: {
Global.openAddEditSavedAddressesPopup({
addAddress: true,
address: d.selectedAddress,
ens: d.addressEns
})
}
}
StatusAction {
id: editAddressAction
enabled: false
text: qsTr("Edit saved address")
icon.name: "pencil-outline"
onTriggered: Global.openAddEditSavedAddressesPopup({
edit: true,
name: d.addressName,
address: d.selectedAddress,
ens: d.addressEns,
colorId: d.colorId})
}
StatusAction {
id: sendToAddressAction
enabled: false
text: {
switch(d.addressType) {
case TransactionAddressMenu.AddressType.Sender:
return qsTr("Send to sender address")
case TransactionAddressMenu.AddressType.Receiver:
return qsTr("Send to receiver address")
default:
return qsTr("Send to address")
}
}
icon.name: "send"
onTriggered: root.openSendModal(d.selectedAddress)
}
}

View File

@ -1,201 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.13
import StatusQ.Core 0.1
import StatusQ.Components 0.1
import StatusQ.Controls 0.1
import StatusQ.Core.Theme 0.1
import AppLayouts.Wallet 1.0
import AppLayouts.Wallet.stores 1.0 as WalletStores
import AppLayouts.Profile.stores 1.0 as ProfileStores
import utils 1.0
/*!
\qmltype TransactionAddress
\inherits Item
\inqmlmodule shared.controls
\since shared.controls 1.0
\brief It displays transaction address in depending on amount of data provided.
The \c TransactionAddress should be used to display transaction activity data.
\qml
TransactionAddress {
address: "0x29D7d1dd5B6f9C864d9db560D72a247c208aE86B"
}
\endqml
*/
Item {
id: root
/*!
\qmlproperty string TransactionAddress::address
This property holds wallet address.
*/
property string address
/* /internal Property hold reference to contacts store to refresh contact data on any change. */
property ProfileStores.ContactsStore contactsStore
/* /internal Property hold reference to root store to refresh wallet data on any change. */
property WalletStores.RootStore rootStore
/*!
\qmlproperty \l{StatusAssetSettings} TransactionAddress::asset
Property holds asset settings for contact icon.
*/
property StatusAssetSettings asset: StatusAssetSettings {
id: statusAssetSettings
width: 36
height: 36
color: d.isContact ? Utils.colorForPubkey(root.contactPubKey) : d.walletAddressColor
name: {
if (d.isContact) {
return isImage ? d.contactData.thumbnailImage : nameText.text
} else if (d.isWallet && !d.walletAddressEmoji) {
return "filled-account"
}
return ""
}
isImage: d.isContact && statusAssetSettings.isImgSrc(d.contactData.thumbnailImage)
emoji: d.isWallet && !!d.walletAddressEmoji ? d.walletAddressEmoji : ""
isLetterIdenticon: d.isContact && !isImage
charactersLen: 2
}
implicitHeight: Math.max(44, contentColumn.height) + 12
onAddressChanged: {
d.refresh()
}
Component.onCompleted: {
d.refresh()
}
QtObject {
id: d
property string contactPubKey: !!root.contactsStore ? root.contactsStore.getContactPublicKeyByAddress(root.address) : ""
readonly property bool isContact: contactData.isContact
readonly property bool isWallet: !isContact && !!walletAddressName
property var contactData
property string savedAddressName
property string walletAddressName
property string walletAddressEmoji
property string walletAddressColor
function refresh() {
refreshContactData()
refreshSavedAddressName()
refreshWalletAddress()
}
function refreshContactData() {
d.contactData = Utils.getContactDetailsAsJson(d.contactPubKey)
}
function refreshSavedAddressName() {
if (!root.rootStore) {
return
}
let savedAddress = root.rootStore.getSavedAddress(root.address)
d.savedAddressName = savedAddress.name
}
function refreshWalletAddress() {
d.walletAddressName = !!root.rootStore ? root.rootStore.getNameForWalletAddress(root.address) : ""
if (!d.walletAddressName)
return // No need to query other if name not found
d.walletAddressEmoji = !!root.rootStore ? root.rootStore.getEmojiForWalletAddress(root.address) : ""
d.walletAddressColor = Utils.getColorForId(!!root.rootStore ? root.rootStore.getColorForWalletAddress(root.address) : "")
}
readonly property Connections walletAccountsConnection: Connections {
target: !!root.rootStore ? root.rootStore.accounts ?? null : null
function onItemChanged(address) {
if (address === root.address)
d.refreshWalletAddress()
}
}
readonly property Connections myContactsModelConnection: Connections {
target: root.contactsStore.myContactsModel ?? null
function onItemChanged(pubKey) {
if (pubKey === root.contactPubKey)
d.refreshContactData()
}
}
readonly property Connections receivedContactsReqModelConnection: Connections {
target: root.contactsStore.receivedContactRequestsModel ?? null
function onItemChanged(pubKey) {
if (pubKey === root.contactPubKey)
d.refreshContactData()
}
}
readonly property Connections sentContactReqModelConnection: Connections {
target: root.contactsStore.sentContactRequestsModel ?? null
function onItemChanged(pubKey) {
if (pubKey === root.contactPubKey)
d.refreshContactData()
}
}
}
RowLayout {
id: contentRow
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
StatusSmartIdenticon {
id: identicon
Layout.alignment: Qt.AlignTop
asset: root.asset
name: nameText.text
ringSettings {
ringSpecModel: d.isContact ? Utils.getColorHashAsJson(d.contactData.publicKey) : []
ringPxSize: asset.width / 24
}
visible: d.isContact || d.isWallet
}
ColumnLayout {
id: contentColumn
Layout.fillWidth: true
spacing: 0
StatusBaseText {
id: nameText
Layout.fillWidth: true
font.pixelSize: 15
color: Theme.palette.directColor1
text: {
let name = ""
if (d.isContact) {
name = ProfileUtils.displayName(d.contactData.localNickname, d.contactData.name, d.contactData.displayName, d.contactData.alias)
}
return name || d.walletAddressName || d.savedAddressName
}
visible: !!text
elide: Text.ElideRight
}
StatusBaseText {
Layout.fillWidth: true
font.pixelSize: 15
color: Theme.palette.directColor1
wrapMode: Text.WrapAnywhere
enabled: false // Set to false to disable hover for rich text
text: root.address
visible: !!root.address
elide: Text.ElideRight
}
}
}
}

View File

@ -1,78 +0,0 @@
import QtQuick 2.13
import QtQuick.Layouts 1.15
import QtQuick.Shapes 1.15
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import AppLayouts.Profile.stores 1.0 as ProfileStores
import AppLayouts.Wallet.stores 1.0 as WalletStores
/*!
\qmltype TransactionAddressTile
\inherits TransactionDataTile
\inqmlmodule shared.controls
\since shared.controls 1.0
\brief It displays list of addresses for wallet activity.
The \c TransactionAddressTile can display list of addresses formatted in specific way.
\qml
TransactionAddressTile {
title: qsTr("From")
width: parent.width
rootStore: WalletStores.RootStore
addresses: [
"eth:arb1:oeth:0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc35",
"0x4de3f6278C0DdFd3F29df9DcD979038F5c7bbc35",
]
}
\endqml
*/
TransactionDataTile {
id: root
/*!
\qmlproperty var TransactionAddressTile::addresses
This property holds list or model of addresses to display in the tile.
*/
property var addresses: []
/*!
\qmlproperty var TransactionAddressTile::rootStore
This property holds rootStore object used to retrive data for each address.
*/
property WalletStores.RootStore rootStore
/* /internal Property hold reference to contacts store to refresh contact data on any change. */
property ProfileStores.ContactsStore contactsStore
implicitHeight: transactionColumn.height + transactionColumn.spacing + root.topPadding + root.bottomPadding
buttonIconName: "more"
Column {
id: transactionColumn
anchors {
left: parent.left
leftMargin: root.leftPadding
right: parent.right
rightMargin: root.statusListItemComponentsSlot.width + root.rightPadding * 2
bottom: parent.bottom
bottomMargin: root.bottomPadding
}
height: childrenRect.height
spacing: 4
Repeater {
model: root.addresses
delegate: TransactionAddress {
width: parent.width
address: modelData
rootStore: root.rootStore
contactsStore: root.contactsStore
}
}
}
}

View File

@ -1,136 +0,0 @@
import QtQuick 2.15
import QtGraphicalEffects 1.15
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import utils 1.0
import shared.panels 1.0
/*!
\qmltype TransactionDataTile
\inherits StatusListItem
\inqmlmodule shared.controls
\since shared.controls 1.0
\brief It displays data for wallet activity.
The \c TransactionDataTile can display wallet activity data as a tile.
To show button fill \l{buttonIcon} property.
\qml
TransactionDataTile {
width: parent.width
title: qsTr("From")
buttonIcon: "more"
}
\endqml
*/
StatusListItem {
id: root
/*!
\qmlproperty int TransactionDataTile::topPadding
This property holds spacing between top and content item in tile.
*/
property int topPadding: 12
/*!
\qmlproperty int TransactionDataTile::bottomPadding
This property holds spacing between bottom and content item in tile.
*/
property int bottomPadding: 12
/*!
\qmlproperty bool TransactionDataTile::smallIcon
This property holds information about icon state. Setting it to true will display small icon before subtitle.
Default value is false.
*/
property bool smallIcon: false
/*!
\qmlproperty string TransactionDataTile::buttonIconName
This property holds button icon source string.
To show button icon source must be filled
*/
property string buttonIconName
property StatusAssetSettings iconSettings: StatusAssetSettings {
name: root.asset.name
color: "transparent"
width: root.smallIcon ? 20 : 36
height: root.smallIcon ? 20 : 36
bgWidth: width
bgHeight: height
}
signal buttonClicked()
leftPadding: 12
rightPadding: 12
height: visible ? implicitHeight + bottomPadding : 0
radius: 0
sensor.cursorShape: Qt.ArrowCursor
color: sensor.containsMouse || highlighted ? Theme.palette.baseColor5 : Theme.palette.transparent
// Title
statusListItemTitle.customColor: Theme.palette.directColor5
statusListItemTitle.enabled: false
statusListItemTitleArea.anchors {
left: statusListItemTitleArea.parent.left
top: statusListItemTitleArea.parent.top
topMargin: topPadding
right: statusListItemTitleArea.parent.right
verticalCenter: undefined
}
// Subtitle
statusListItemTagsRowLayout.anchors.topMargin: 8
statusListItemTagsRowLayout.width: statusListItemTagsRowLayout.parent.width - (!!root.buttonIconName ? 36 : 0)
statusListItemSubTitle.customColor: Theme.palette.directColor1
// Tertiary title
statusListItemTertiaryTitle.anchors.topMargin: -statusListItemTertiaryTitle.height
statusListItemTertiaryTitle.horizontalAlignment: Qt.AlignRight
// Icon
asset.isImage: false
statusListItemTagsRowLayout.spacing: 8
subTitleBadgeComponent: !!asset.name ? iconComponent : null
statusListItemIcon.asset: StatusAssetSettings {}
statusListItemIcon.name: ""
Component {
id: iconComponent
StatusRoundIcon {
asset: root.iconSettings
layer.enabled: asset.bgRadius > 0
layer.effect: OpacityMask {
maskSource: Rectangle {
width: root.iconSettings.bgWidth
height: root.iconSettings.bgHeight
radius: root.iconSettings.bgRadius
}
}
}
}
components: Loader {
active: !!root.buttonIconName
sourceComponent: StatusRoundButton {
width: 32
height: 32
icon.color: hovered ? Theme.palette.directColor1 : Theme.palette.baseColor1
icon.name: root.buttonIconName
type: StatusRoundButton.Type.Quinary
radius: 8
visible: root.sensor.containsMouse
onClicked: root.buttonClicked()
}
}
Separator {
anchors.bottom: parent.bottom
}
}

View File

@ -43,9 +43,6 @@ StyledTextEdit 1.0 StyledTextEdit.qml
StyledTextEditWithLoadingState 1.0 StyledTextEditWithLoadingState.qml
Timer 1.0 Timer.qml
TokenDelegate 1.0 TokenDelegate.qml
TransactionAddress 1.0 TransactionAddress.qml
TransactionAddressTile 1.0 TransactionAddressTile.qml
TransactionDataTile 1.0 TransactionDataTile.qml
TransactionDelegate 1.0 TransactionDelegate.qml
TransactionDetailsHeader.qml 1.0 TransactionDetailsHeader.qml
WalletAccountListItem 1.0 WalletAccountListItem.qml