HistoryView: wallet root store taken as an explicit dependency

This commit is contained in:
Michał Cieślak 2024-10-01 17:37:05 +02:00 committed by Michał
parent 26b588cc40
commit 3c6ea3be43
3 changed files with 25 additions and 21 deletions

View File

@ -271,6 +271,7 @@ StatusModal {
isWatchOnlyAccount: false, isWatchOnlyAccount: false,
mixedcaseAddress: d.address mixedcaseAddress: d.address
}) })
walletRootStore: WalletStore.RootStore
} }
} }
} }

View File

@ -423,6 +423,7 @@ RightTabBaseView {
id: historyView id: historyView
HistoryView { HistoryView {
overview: RootStore.overview overview: RootStore.overview
walletRootStore: RootStore
communitiesStore: root.communitiesStore communitiesStore: root.communitiesStore
showAllAccounts: RootStore.showAllAccounts showAllAccounts: RootStore.showAllAccounts
sendModal: root.sendModal sendModal: root.sendModal

View File

@ -31,6 +31,8 @@ ColumnLayout {
id: root id: root
property var overview property var overview
property WalletStores.RootStore walletRootStore
property CommunitiesStore communitiesStore property CommunitiesStore communitiesStore
property bool showAllAccounts: false property bool showAllAccounts: false
property bool displayValues: true property bool displayValues: true
@ -56,11 +58,11 @@ ColumnLayout {
Component.onCompleted: { Component.onCompleted: {
if (RootStore.transactionActivityStatus.isFilterDirty) { if (RootStore.transactionActivityStatus.isFilterDirty) {
WalletStores.RootStore.currentActivityFiltersStore.applyAllFilters() root.walletRootStore.currentActivityFiltersStore.applyAllFilters()
} }
WalletStores.RootStore.currentActivityFiltersStore.updateCollectiblesModel() root.walletRootStore.currentActivityFiltersStore.updateCollectiblesModel()
WalletStores.RootStore.currentActivityFiltersStore.updateRecipientsModel() root.walletRootStore.currentActivityFiltersStore.updateRecipientsModel()
} }
Connections { Connections {
@ -70,13 +72,13 @@ ColumnLayout {
RootStore.updateTransactionFilterIfDirty() RootStore.updateTransactionFilterIfDirty()
} }
function onFilterChainsChanged() { function onFilterChainsChanged() {
WalletStores.RootStore.currentActivityFiltersStore.updateCollectiblesModel() root.walletRootStore.currentActivityFiltersStore.updateCollectiblesModel()
WalletStores.RootStore.currentActivityFiltersStore.updateRecipientsModel() root.walletRootStore.currentActivityFiltersStore.updateRecipientsModel()
} }
} }
Connections { Connections {
target: WalletStores.RootStore.currentActivityFiltersStore target: root.walletRootStore.currentActivityFiltersStore
enabled: root.visible enabled: root.visible
function onDisplayTxDetails(txHash) { function onDisplayTxDetails(txHash) {
if (!d.openTxDetails(txHash)) { if (!d.openTxDetails(txHash)) {
@ -126,8 +128,8 @@ ColumnLayout {
.arg(Utils.getStyledLink("OP Explorer", "https://optimistic.etherscan.io/", tagPrimaryLabel.hoveredLink)) .arg(Utils.getStyledLink("OP Explorer", "https://optimistic.etherscan.io/", tagPrimaryLabel.hoveredLink))
.arg(Utils.getStyledLink("Arbiscan", "https://arbiscan.io/", tagPrimaryLabel.hoveredLink)) .arg(Utils.getStyledLink("Arbiscan", "https://arbiscan.io/", tagPrimaryLabel.hoveredLink))
tagPrimaryLabel.onLinkActivated: (link) => { tagPrimaryLabel.onLinkActivated: (link) => {
const explorerUrl = WalletStores.RootStore.showAllAccounts ? link const explorerUrl = root.walletRootStore.showAllAccounts ? link
: "%1/%2/%3".arg(link).arg(Constants.networkExplorerLinks.addressPath).arg(WalletStores.RootStore.selectedAddress) : "%1/%2/%3".arg(link).arg(Constants.networkExplorerLinks.addressPath).arg(root.walletRootStore.selectedAddress)
Global.openLinkWithConfirmation(explorerUrl, SQUtils.StringUtils.extractDomainFromLink(explorerUrl)) Global.openLinkWithConfirmation(explorerUrl, SQUtils.StringUtils.extractDomainFromLink(explorerUrl))
} }
asset { asset {
@ -158,20 +160,20 @@ ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: 42 Layout.preferredHeight: 42
Layout.topMargin: !nonArchivalNodeError.visible? root.firstItemOffset : 0 Layout.topMargin: !nonArchivalNodeError.visible? root.firstItemOffset : 0
visible: !d.isInitialLoading && !WalletStores.RootStore.currentActivityFiltersStore.filtersSet && transactionListRoot.count === 0 visible: !d.isInitialLoading && !root.walletRootStore.currentActivityFiltersStore.filtersSet && transactionListRoot.count === 0
font.pixelSize: Style.current.primaryTextFontSize font.pixelSize: Style.current.primaryTextFontSize
text: qsTr("Activity for this account will appear here") text: qsTr("Activity for this account will appear here")
} }
Loader { Loader {
id: filterPanelLoader id: filterPanelLoader
active: root.filterVisible && (d.isInitialLoading || transactionListRoot.count > 0 || WalletStores.RootStore.currentActivityFiltersStore.filtersSet) active: root.filterVisible && (d.isInitialLoading || transactionListRoot.count > 0 || root.walletRootStore.currentActivityFiltersStore.filtersSet)
visible: active && !noTxs.visible visible: active && !noTxs.visible
asynchronous: true asynchronous: true
Layout.fillWidth: true Layout.fillWidth: true
sourceComponent: ActivityFilterPanel { sourceComponent: ActivityFilterPanel {
activityFilterStore: WalletStores.RootStore.currentActivityFiltersStore activityFilterStore: root.walletRootStore.currentActivityFiltersStore
store: WalletStores.RootStore store: root.walletRootStore
hideNoResults: newTransactions.visible hideNoResults: newTransactions.visible
isLoading: d.isInitialLoading isLoading: d.isInitialLoading
} }
@ -346,16 +348,16 @@ ColumnLayout {
enabled: { enabled: {
if (!overview.isWatchOnlyAccount && !tx) if (!overview.isWatchOnlyAccount && !tx)
return false return false
return WalletStores.RootStore.isTxRepeatable(tx) return root.walletRootStore.isTxRepeatable(tx)
} }
onTriggered: { onTriggered: {
if (!tx) if (!tx)
return return
let asset = WalletStores.RootStore.getAssetForSendTx(tx) let asset = root.walletRootStore.getAssetForSendTx(tx)
const req = Helpers.lookupAddressesForSendModal(WalletStores.RootStore.accounts, const req = Helpers.lookupAddressesForSendModal(root.walletRootStore.accounts,
WalletStores.RootStore.savedAddresses, root.walletRootStore.savedAddresses,
tx.sender, tx.sender,
tx.recipient, tx.recipient,
asset, asset,
@ -382,9 +384,9 @@ ColumnLayout {
onTriggered: { onTriggered: {
if (!delegateMenu.transactionDelegate) if (!delegateMenu.transactionDelegate)
return return
WalletStores.RootStore.addressWasShown(delegateMenu.transaction.sender) root.walletRootStore.addressWasShown(delegateMenu.transaction.sender)
if (delegateMenu.transaction.sender !== delegateMenu.transaction.recipient) { if (delegateMenu.transaction.sender !== delegateMenu.transaction.recipient) {
WalletStores.RootStore.addressWasShown(delegateMenu.transaction.recipient) root.walletRootStore.addressWasShown(delegateMenu.transaction.recipient)
} }
RootStore.fetchTxDetails(delegateMenu.transaction.id) RootStore.fetchTxDetails(delegateMenu.transaction.id)
@ -401,7 +403,7 @@ ColumnLayout {
text: qsTr("Filter by similar") text: qsTr("Filter by similar")
icon.name: "filter" icon.name: "filter"
onTriggered: { onTriggered: {
const store = WalletStores.RootStore.currentActivityFiltersStore const store = root.walletRootStore.currentActivityFiltersStore
const tx = delegateMenu.transaction const tx = delegateMenu.transaction
store.autoUpdateFilter = false store.autoUpdateFilter = false
@ -488,7 +490,7 @@ ColumnLayout {
timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000, true) : "" timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000, true) : ""
flatNetworks: RootStore.flatNetworks flatNetworks: RootStore.flatNetworks
currenciesStore: RootStore.currencyStore currenciesStore: RootStore.currencyStore
walletRootStore: WalletStores.RootStore walletRootStore: root.walletRootStore
showAllAccounts: root.showAllAccounts showAllAccounts: root.showAllAccounts
displayValues: root.displayValues displayValues: root.displayValues
community: isModelDataValid && !!communityId && !!root.communitiesStore ? root.communitiesStore.getCommunityDetailsAsJson(communityId) : null community: isModelDataValid && !!communityId && !!root.communitiesStore ? root.communitiesStore.getCommunityDetailsAsJson(communityId) : null
@ -553,7 +555,7 @@ ColumnLayout {
flatNetworks: RootStore.flatNetworks flatNetworks: RootStore.flatNetworks
currenciesStore: RootStore.currencyStore currenciesStore: RootStore.currencyStore
walletRootStore: WalletStores.RootStore walletRootStore: root.walletRootStore
loading: true loading: true
} }
} }