fix(@desktop/wallet): Various wallet view fixes (#11606)
This commit is contained in:
parent
b5950b045c
commit
d05d743d80
|
@ -46,7 +46,6 @@ proc setAddress*(self: Filter, address: string) =
|
|||
self.addresses = @[address]
|
||||
|
||||
proc removeAddress*(self: Filter, address: string) =
|
||||
self.allAddresses = false
|
||||
if len(self.addresses) == 1 and self.addresses[0] == address:
|
||||
let accounts = self.controller.getWalletAccounts()
|
||||
self.addresses = @[accounts[0].address]
|
||||
|
|
|
@ -174,7 +174,7 @@ StatusListItem {
|
|||
if (root.areTestNetworksEnabled) {
|
||||
baseUrl = Constants.networkExplorerLinks.goerliEtherscan
|
||||
}
|
||||
Global.openLink("%1/address/%2".arg(baseUrl).arg(d.visibleAddress ? d.visibleAddress : root.ens))
|
||||
Global.openLink("%1/%2/%3".arg(baseUrl).arg(Constants.networkExplorerLinks.addressPath).arg(d.visibleAddress ? d.visibleAddress : root.ens))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ StatusListItem {
|
|||
if (root.areTestNetworksEnabled) {
|
||||
baseUrl = Constants.networkExplorerLinks.goerliArbiscan
|
||||
}
|
||||
Global.openLink("%1/address/%2".arg(baseUrl).arg(d.visibleAddress ? d.visibleAddress : root.ens))
|
||||
Global.openLink("%1/%2/%3".arg(baseUrl).arg(Constants.networkExplorerLinks.addressPath).arg(d.visibleAddress ? d.visibleAddress : root.ens))
|
||||
}
|
||||
}
|
||||
StatusAction {
|
||||
|
@ -199,7 +199,7 @@ StatusListItem {
|
|||
if (root.areTestNetworksEnabled) {
|
||||
baseUrl = Constants.networkExplorerLinks.goerliOptimistic
|
||||
}
|
||||
Global.openLink("%1/address/%2".arg(baseUrl).arg(d.visibleAddress ? d.visibleAddress : root.ens))
|
||||
Global.openLink("%1/%2/%3".arg(baseUrl).arg(Constants.networkExplorerLinks.addressPath).arg(d.visibleAddress ? d.visibleAddress : root.ens))
|
||||
}
|
||||
}
|
||||
StatusMenuSeparator { }
|
||||
|
|
|
@ -19,6 +19,7 @@ StatusMenu {
|
|||
id: root
|
||||
|
||||
property var contactsStore
|
||||
property bool areTestNetworksEnabled: false
|
||||
|
||||
signal openSendModal(address: string)
|
||||
|
||||
|
@ -42,8 +43,6 @@ StatusMenu {
|
|||
|
||||
property string contractName: ""
|
||||
|
||||
property bool isGoerliTestnet: false
|
||||
|
||||
property int addressType: TransactionAddressMenu.AddressType.Address
|
||||
|
||||
function getViewText(target) {
|
||||
|
@ -68,11 +67,9 @@ StatusMenu {
|
|||
function refreshShowOnActionsVisiblity(shortChainName) {
|
||||
switch(shortChainName.toLowerCase()) {
|
||||
case Constants.networkShortChainNames.arbiscan.toLowerCase():
|
||||
case Constants.networkShortChainNames.goerliArbiscan.toLowerCase():
|
||||
showOnArbiscanAction.enabled = true
|
||||
break
|
||||
case Constants.networkShortChainNames.optimism.toLowerCase():
|
||||
case Constants.networkShortChainNames.goerliOptimism.toLowerCase():
|
||||
showOnOptimismAction.enabled = true
|
||||
break
|
||||
default:
|
||||
|
@ -81,19 +78,6 @@ StatusMenu {
|
|||
}
|
||||
}
|
||||
|
||||
function refreshIsTestnet(shortChainName) {
|
||||
switch(shortChainName.toLowerCase()) {
|
||||
case Constants.networkShortChainNames.goerliMainnet.toLowerCase():
|
||||
case Constants.networkShortChainNames.goerliArbiscan.toLowerCase():
|
||||
case Constants.networkShortChainNames.goerliOptimism.toLowerCase():
|
||||
d.isGoerliTestnet = true
|
||||
return
|
||||
default:
|
||||
d.isGoerliTestnet = false
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
function openMenu(delegate) {
|
||||
const x = delegate.width - 40
|
||||
const y = delegate.height / 2 + 20
|
||||
|
@ -147,7 +131,6 @@ StatusMenu {
|
|||
d.addressName = contactData.isContact ? contactData.name : WalletStores.RootStore.getNameForAddress(address)
|
||||
d.addressEns = RootStore.getEnsForSavedWalletAddress(address)
|
||||
d.addressChains = RootStore.getChainShortNamesForSavedWalletAddress(address)
|
||||
d.refreshIsTestnet(chainShortName)
|
||||
|
||||
showOnEtherscanAction.enabled = true
|
||||
showOnArbiscanAction.enabled = address.includes(Constants.networkShortChainNames.arbiscan + ":")
|
||||
|
@ -164,7 +147,6 @@ StatusMenu {
|
|||
d.addressType = TransactionAddressMenu.AddressType.Tx
|
||||
d.selectedAddress = address
|
||||
d.refreshShowOnActionsVisiblity(chainShortName)
|
||||
d.refreshIsTestnet(chainShortName)
|
||||
d.openMenu(delegate)
|
||||
}
|
||||
|
||||
|
@ -173,7 +155,6 @@ StatusMenu {
|
|||
d.contractName = name
|
||||
d.selectedAddress = address
|
||||
d.refreshShowOnActionsVisiblity(chainShortName)
|
||||
d.refreshIsTestnet(chainShortName)
|
||||
d.openMenu(delegate)
|
||||
}
|
||||
|
||||
|
@ -186,7 +167,6 @@ StatusMenu {
|
|||
onClosed: {
|
||||
d.addressType = TransactionAddressMenu.AddressType.Address
|
||||
d.contractName = ""
|
||||
d.isGoerliTestnet = false
|
||||
|
||||
showOnEtherscanAction.enabled = false
|
||||
showOnArbiscanAction.enabled = false
|
||||
|
@ -207,8 +187,8 @@ StatusMenu {
|
|||
text: d.getViewText(qsTr("Etherscan"))
|
||||
icon.name: "link"
|
||||
onTriggered: {
|
||||
const type = d.addressType === TransactionAddressMenu.Tx ? "tx" : "address"
|
||||
const link = d.isGoerliTestnet ? Constants.networkExplorerLinks.goerliEtherscan : Constants.networkExplorerLinks.etherscan
|
||||
const type = d.addressType === TransactionAddressMenu.Tx ? Constants.networkExplorerLinks.txPath : Constants.networkExplorerLinks.addressPath
|
||||
const link = areTestNetworksEnabled ? Constants.networkExplorerLinks.goerliEtherscan : Constants.networkExplorerLinks.etherscan
|
||||
Global.openLink("%1/%2/%3".arg(link).arg(type).arg(d.selectedAddress))
|
||||
}
|
||||
}
|
||||
|
@ -218,8 +198,8 @@ StatusMenu {
|
|||
text: d.getViewText(qsTr("Arbiscan"))
|
||||
icon.name: "link"
|
||||
onTriggered: {
|
||||
const type = d.addressType === TransactionAddressMenu.Tx ? "tx" : "address"
|
||||
const link = d.isGoerliTestnet ? Constants.networkExplorerLinks.goerliArbiscan : Constants.networkExplorerLinks.arbiscan
|
||||
const type = d.addressType === TransactionAddressMenu.Tx ? Constants.networkExplorerLinks.txPath : Constants.networkExplorerLinks.addressPath
|
||||
const link = areTestNetworksEnabled ? Constants.networkExplorerLinks.goerliArbiscan : Constants.networkExplorerLinks.arbiscan
|
||||
Global.openLink("%1/%2/%3".arg(link).arg(type).arg(d.selectedAddress))
|
||||
}
|
||||
}
|
||||
|
@ -229,8 +209,8 @@ StatusMenu {
|
|||
text: d.getViewText(qsTr("Optimism Explorer"))
|
||||
icon.name: "link"
|
||||
onTriggered: {
|
||||
const type = d.addressType === TransactionAddressMenu.Tx ? "tx" : "address"
|
||||
const link = d.isGoerliTestnet ? Constants.networkExplorerLinks.goerliOptimistic : Constants.networkExplorerLinks.optimistic
|
||||
const type = d.addressType === TransactionAddressMenu.Tx ? Constants.networkExplorerLinks.txPath : Constants.networkExplorerLinks.addressPath
|
||||
const link = areTestNetworksEnabled ? Constants.networkExplorerLinks.goerliOptimistic : Constants.networkExplorerLinks.optimistic
|
||||
Global.openLink("%1/%2/%3".arg(link).arg(type).arg(d.selectedAddress))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,8 +207,10 @@ Rectangle {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
Layout.topMargin: Style.current.halfPadding
|
||||
|
||||
// ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
currentIndex: -1
|
||||
highlightRangeMode: ListView.ApplyRange
|
||||
preferredHighlightBegin: 0
|
||||
preferredHighlightEnd: height - (footerOverlayed ? footerItem.height : 0)
|
||||
|
||||
readonly property Item firstItem: count > 0 ? itemAtIndex(0) : null
|
||||
|
||||
|
@ -217,6 +219,10 @@ Rectangle {
|
|||
readonly property bool itemLoaded: !model.assetsLoading // needed for e2e tests
|
||||
width: ListView.view.width - Style.current.padding * 2
|
||||
highlighted: root.currentAddress.toLowerCase() === model.address.toLowerCase()
|
||||
onHighlightedChanged: {
|
||||
if (highlighted)
|
||||
ListView.view.currentIndex = index
|
||||
}
|
||||
anchors.horizontalCenter: !!parent ? parent.horizontalCenter : undefined
|
||||
title: model.name
|
||||
subTitle: LocaleUtils.currencyAmountToLocaleString(model.currencyBalance)
|
||||
|
@ -281,6 +287,7 @@ Rectangle {
|
|||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
root.showSavedAddresses = false
|
||||
walletAccountsListView.currentIndex = -1
|
||||
root.selectAllAccounts()
|
||||
}
|
||||
hoverEnabled: true
|
||||
|
@ -406,10 +413,8 @@ Rectangle {
|
|||
|
||||
model: SortFilterProxyModel {
|
||||
sourceModel: RootStore.accounts
|
||||
|
||||
sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -678,6 +678,7 @@ Item {
|
|||
TransactionAddressMenu {
|
||||
id: addressMenu
|
||||
|
||||
areTestNetworksEnabled: WalletStores.RootStore.areTestNetworksEnabled
|
||||
contactsStore: root.contactsStore
|
||||
onOpenSendModal: (address) => root.sendModal.open(address)
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ QtObject {
|
|||
property var historyTransactions: Global.appIsReady? walletSection.activityController.model : null
|
||||
readonly property bool loadingHistoryTransactions: Global.appIsReady && walletSection.activityController.status.loadingData
|
||||
readonly property bool newDataAvailable: Global.appIsReady && walletSection.activityController.status.newDataAvailable
|
||||
readonly property bool isTransactionFilterDirty: Global.appIsReady && walletSection.activityController.status.isFilterDirty
|
||||
readonly property var transactionActivityStatus: Global.appIsReady ? walletSection.activityController.status : null
|
||||
|
||||
property bool isNonArchivalNode: history ? history.isNonArchivalNode
|
||||
: false
|
||||
property var marketValueStore: TokenMarketValuesStore{}
|
||||
|
@ -188,7 +189,7 @@ QtObject {
|
|||
}
|
||||
|
||||
function updateTransactionFilter() {
|
||||
if (isTransactionFilterDirty)
|
||||
if (transactionActivityStatus.isFilterDirty)
|
||||
walletSection.activityController.updateFilter()
|
||||
}
|
||||
|
||||
|
|
|
@ -31,15 +31,15 @@ ColumnLayout {
|
|||
signal launchTransactionDetail(var transaction)
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible && RootStore.isTransactionFilterDirty) {
|
||||
if (visible && RootStore.transactionActivityStatus.isFilterDirty) {
|
||||
WalletStores.RootStore.currentActivityFiltersStore.applyAllFilters()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: RootStore
|
||||
target: RootStore.transactionActivityStatus
|
||||
enabled: root.visible
|
||||
function onIsTransactionFilterDirtyChanged() {
|
||||
function onIsFilterDirtyChanged() {
|
||||
RootStore.updateTransactionFilter()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -829,9 +829,6 @@ QtObject {
|
|||
readonly property string mainnet: "eth"
|
||||
readonly property string arbiscan: "arb"
|
||||
readonly property string optimism: "opt"
|
||||
readonly property string goerliMainnet: "goEth"
|
||||
readonly property string goerliArbiscan: "goArb"
|
||||
readonly property string goerliOptimism: "goOpt"
|
||||
}
|
||||
|
||||
readonly property QtObject networkExplorerLinks: QtObject {
|
||||
|
@ -841,6 +838,9 @@ QtObject {
|
|||
readonly property string goerliEtherscan: "https://goerli.etherscan.io"
|
||||
readonly property string goerliArbiscan: "https://goerli.arbiscan.io"
|
||||
readonly property string goerliOptimistic: "https://goerli-optimism.etherscan.io"
|
||||
|
||||
readonly property string addressPath: "address"
|
||||
readonly property string txPath: "tx"
|
||||
}
|
||||
|
||||
readonly property string api_request: "api-request"
|
||||
|
|
Loading…
Reference in New Issue