2023-04-05 11:42:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQml 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2024-08-27 14:35:52 +00:00
|
|
|
import StatusQ 0.1
|
2022-07-14 11:03:36 +00:00
|
|
|
import StatusQ.Core 0.1
|
2024-08-03 07:49:14 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2021-10-20 10:21:23 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
2022-09-01 15:34:27 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-06-13 08:18:53 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2021-10-20 10:21:23 +00:00
|
|
|
|
2023-03-23 07:34:05 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-03-25 08:46:47 +00:00
|
|
|
import "../panels"
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../popups"
|
2023-09-27 13:41:55 +00:00
|
|
|
import "../popups/send"
|
2021-10-05 20:50:22 +00:00
|
|
|
import "../stores"
|
|
|
|
import "../controls"
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Communities.stores 1.0
|
2023-05-10 11:54:06 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0 as WalletStores
|
2023-06-02 18:00:31 +00:00
|
|
|
import AppLayouts.Wallet.popups 1.0
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
2023-06-13 14:55:26 +00:00
|
|
|
import AppLayouts.Wallet.panels 1.0
|
2023-05-10 11:54:06 +00:00
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
ColumnLayout {
|
2023-01-12 23:26:48 +00:00
|
|
|
id: root
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2023-04-25 16:54:50 +00:00
|
|
|
property var overview
|
2024-10-01 15:37:05 +00:00
|
|
|
|
|
|
|
property WalletStores.RootStore walletRootStore
|
2024-05-22 08:13:39 +00:00
|
|
|
property CommunitiesStore communitiesStore
|
2023-07-26 11:50:27 +00:00
|
|
|
property bool showAllAccounts: false
|
2024-02-19 08:40:16 +00:00
|
|
|
property bool displayValues: true
|
2023-09-27 13:41:55 +00:00
|
|
|
property var sendModal
|
2023-12-18 10:12:57 +00:00
|
|
|
property bool filterVisible
|
2024-02-19 08:40:16 +00:00
|
|
|
property bool disableShadowOnScroll: false
|
|
|
|
property bool hideVerticalScrollbar: false
|
|
|
|
property int firstItemOffset: 0
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2024-02-19 08:40:16 +00:00
|
|
|
property real yPosition: transactionListRoot.visibleArea.yPosition * transactionListRoot.contentHeight
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
signal launchTransactionDetail(string txID)
|
2022-09-05 09:15:47 +00:00
|
|
|
|
2023-09-21 06:58:44 +00:00
|
|
|
function resetView() {
|
|
|
|
if (!!filterPanelLoader.item) {
|
|
|
|
filterPanelLoader.item.resetView()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-22 14:41:13 +00:00
|
|
|
onVisibleChanged: {
|
|
|
|
d.openTxDetailsHash = ""
|
|
|
|
}
|
|
|
|
|
2024-01-25 11:18:58 +00:00
|
|
|
Component.onCompleted: {
|
2024-10-02 07:50:10 +00:00
|
|
|
if (root.walletRootStore.transactionActivityStatus.isFilterDirty) {
|
2024-10-01 15:37:05 +00:00
|
|
|
root.walletRootStore.currentActivityFiltersStore.applyAllFilters()
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
2023-10-03 10:48:47 +00:00
|
|
|
|
2024-10-01 15:37:05 +00:00
|
|
|
root.walletRootStore.currentActivityFiltersStore.updateCollectiblesModel()
|
|
|
|
root.walletRootStore.currentActivityFiltersStore.updateRecipientsModel()
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2024-10-02 07:50:10 +00:00
|
|
|
target: root.walletRootStore.transactionActivityStatus
|
2023-07-07 10:00:19 +00:00
|
|
|
enabled: root.visible
|
2023-07-21 10:55:36 +00:00
|
|
|
function onIsFilterDirtyChanged() {
|
2024-10-02 07:50:10 +00:00
|
|
|
root.walletRootStore.updateTransactionFilterIfDirty()
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
2023-10-03 10:48:47 +00:00
|
|
|
function onFilterChainsChanged() {
|
2024-10-01 15:37:05 +00:00
|
|
|
root.walletRootStore.currentActivityFiltersStore.updateCollectiblesModel()
|
|
|
|
root.walletRootStore.currentActivityFiltersStore.updateRecipientsModel()
|
2023-10-03 10:48:47 +00:00
|
|
|
}
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 14:41:13 +00:00
|
|
|
Connections {
|
2024-10-01 15:37:05 +00:00
|
|
|
target: root.walletRootStore.currentActivityFiltersStore
|
2024-02-22 14:41:13 +00:00
|
|
|
enabled: root.visible
|
|
|
|
function onDisplayTxDetails(txHash) {
|
|
|
|
if (!d.openTxDetails(txHash)) {
|
|
|
|
d.openTxDetailsHash = txHash
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-12 23:26:48 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
2024-10-02 07:50:10 +00:00
|
|
|
readonly property bool isInitialLoading: root.walletRootStore.loadingHistoryTransactions && transactionListRoot.count === 0
|
2023-07-19 14:16:45 +00:00
|
|
|
|
2023-06-30 13:50:06 +00:00
|
|
|
readonly property int loadingSectionWidth: 56
|
2024-02-19 08:40:16 +00:00
|
|
|
|
|
|
|
property bool firstSectionHeaderLoaded: false
|
2023-07-07 14:25:28 +00:00
|
|
|
|
|
|
|
readonly property int maxSecondsBetweenRefresh: 3
|
2024-02-22 14:41:13 +00:00
|
|
|
|
|
|
|
property string openTxDetailsHash
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
function openTxDetails(txID) {
|
2024-02-22 14:41:13 +00:00
|
|
|
// Prevent opening details when loading, that will invalidate the model data
|
2024-10-02 07:50:10 +00:00
|
|
|
if (root.walletRootStore.loadingHistoryTransactions) {
|
2024-02-22 14:41:13 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2024-02-29 14:53:08 +00:00
|
|
|
root.launchTransactionDetail(txID)
|
2024-02-22 14:41:13 +00:00
|
|
|
return true
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2024-08-03 07:49:14 +00:00
|
|
|
InformationTag {
|
|
|
|
id: betaTag
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
Layout.topMargin: root.firstItemOffset
|
|
|
|
Layout.preferredHeight: 56
|
|
|
|
visible: root.firstItemOffset === 0 // visible only in the main wallet view
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
backgroundColor: Theme.palette.primaryColor3
|
|
|
|
bgRadius: Style.current.radius
|
|
|
|
bgBorderColor: Theme.palette.primaryColor2
|
|
|
|
tagPrimaryLabel.textFormat: Text.RichText
|
|
|
|
tagPrimaryLabel.font.pixelSize: Style.current.additionalTextSize
|
|
|
|
tagPrimaryLabel.text: qsTr("Activity is in beta. If transactions are missing, check %1, %2, or %3.")
|
|
|
|
.arg(Utils.getStyledLink("Etherscan", "https://etherscan.io/", tagPrimaryLabel.hoveredLink))
|
|
|
|
.arg(Utils.getStyledLink("OP Explorer", "https://optimistic.etherscan.io/", tagPrimaryLabel.hoveredLink))
|
|
|
|
.arg(Utils.getStyledLink("Arbiscan", "https://arbiscan.io/", tagPrimaryLabel.hoveredLink))
|
|
|
|
tagPrimaryLabel.onLinkActivated: (link) => {
|
2024-10-01 15:37:05 +00:00
|
|
|
const explorerUrl = root.walletRootStore.showAllAccounts ? link
|
|
|
|
: "%1/%2/%3".arg(link).arg(Constants.networkExplorerLinks.addressPath).arg(root.walletRootStore.selectedAddress)
|
2024-08-03 07:49:14 +00:00
|
|
|
Global.openLinkWithConfirmation(explorerUrl, SQUtils.StringUtils.extractDomainFromLink(explorerUrl))
|
|
|
|
}
|
|
|
|
asset {
|
|
|
|
name: "warning"
|
|
|
|
width: 20
|
|
|
|
height: 20
|
|
|
|
color: Theme.palette.primaryColor1
|
|
|
|
}
|
|
|
|
HoverHandler {
|
|
|
|
cursorShape: hovered && !!parent.tagPrimaryLabel.hoveredLink ? Qt.PointingHandCursor : undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
StyledText {
|
|
|
|
id: nonArchivalNodeError
|
2024-02-19 08:40:16 +00:00
|
|
|
Layout.fillWidth: true
|
2022-09-01 15:34:27 +00:00
|
|
|
Layout.alignment: Qt.AlignTop
|
2024-02-19 08:40:16 +00:00
|
|
|
Layout.topMargin: root.firstItemOffset
|
2024-10-02 07:50:10 +00:00
|
|
|
visible: root.walletRootStore.isNonArchivalNode
|
2022-04-04 11:26:30 +00:00
|
|
|
text: qsTr("Status Desktop is connected to a non-archival node. Transaction history may be incomplete.")
|
2021-10-05 20:50:22 +00:00
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
|
|
|
color: Style.current.danger
|
2024-02-19 08:40:16 +00:00
|
|
|
wrapMode: Text.WordWrap
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2023-05-02 08:01:04 +00:00
|
|
|
ShapeRectangle {
|
2021-10-05 20:50:22 +00:00
|
|
|
id: noTxs
|
2023-05-02 08:01:04 +00:00
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 42
|
2024-02-19 08:40:16 +00:00
|
|
|
Layout.topMargin: !nonArchivalNodeError.visible? root.firstItemOffset : 0
|
2024-10-01 15:37:05 +00:00
|
|
|
visible: !d.isInitialLoading && !root.walletRootStore.currentActivityFiltersStore.filtersSet && transactionListRoot.count === 0
|
2021-10-05 20:50:22 +00:00
|
|
|
font.pixelSize: Style.current.primaryTextFontSize
|
2023-05-02 08:01:04 +00:00
|
|
|
text: qsTr("Activity for this account will appear here")
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2023-08-04 08:41:45 +00:00
|
|
|
Loader {
|
|
|
|
id: filterPanelLoader
|
2024-10-01 15:37:05 +00:00
|
|
|
active: root.filterVisible && (d.isInitialLoading || transactionListRoot.count > 0 || root.walletRootStore.currentActivityFiltersStore.filtersSet)
|
2024-02-22 14:41:19 +00:00
|
|
|
visible: active && !noTxs.visible
|
2023-08-04 08:41:45 +00:00
|
|
|
asynchronous: true
|
2023-06-02 18:00:31 +00:00
|
|
|
Layout.fillWidth: true
|
2023-08-04 08:41:45 +00:00
|
|
|
sourceComponent: ActivityFilterPanel {
|
2024-10-01 15:37:05 +00:00
|
|
|
activityFilterStore: root.walletRootStore.currentActivityFiltersStore
|
|
|
|
store: root.walletRootStore
|
2023-11-14 10:35:18 +00:00
|
|
|
hideNoResults: newTransactions.visible
|
2023-08-04 08:41:45 +00:00
|
|
|
isLoading: d.isInitialLoading
|
|
|
|
}
|
2023-06-02 18:00:31 +00:00
|
|
|
}
|
|
|
|
|
2023-06-16 09:37:17 +00:00
|
|
|
Item {
|
2024-02-19 08:40:16 +00:00
|
|
|
id: transactionListWrapper
|
2022-09-01 15:34:27 +00:00
|
|
|
Layout.alignment: Qt.AlignTop
|
|
|
|
Layout.topMargin: nonArchivalNodeError.visible || noTxs.visible ? Style.current.padding : 0
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
2023-06-16 09:37:17 +00:00
|
|
|
Rectangle { // Shadow behind delegates when scrolling
|
2024-02-19 08:40:16 +00:00
|
|
|
anchors.top: parent.top
|
2023-06-16 09:37:17 +00:00
|
|
|
width: parent.width
|
|
|
|
height: 4
|
|
|
|
color: Style.current.separator
|
2024-02-19 08:40:16 +00:00
|
|
|
visible: !root.disableShadowOnScroll && !transactionListRoot.atYBeginning
|
2023-06-16 09:37:17 +00:00
|
|
|
}
|
2023-03-23 07:34:05 +00:00
|
|
|
|
2023-06-16 09:37:17 +00:00
|
|
|
StatusListView {
|
|
|
|
id: transactionListRoot
|
|
|
|
objectName: "walletAccountTransactionList"
|
|
|
|
anchors.fill: parent
|
2023-03-23 07:34:05 +00:00
|
|
|
|
2024-02-22 14:41:13 +00:00
|
|
|
onCountChanged: {
|
|
|
|
if (!!d.openTxDetailsHash && root.visible) {
|
|
|
|
if (d.openTxDetails(d.openTxDetailsHash)) {
|
|
|
|
d.openTxDetailsHash = ""
|
|
|
|
} else {
|
2024-10-02 07:50:10 +00:00
|
|
|
root.walletRootStore.fetchMoreTransactions()
|
2024-02-22 14:41:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-16 09:37:17 +00:00
|
|
|
model: SortFilterProxyModel {
|
|
|
|
id: txModel
|
|
|
|
|
2024-10-02 07:50:10 +00:00
|
|
|
sourceModel: root.walletRootStore.historyTransactions
|
2023-06-16 09:37:17 +00:00
|
|
|
|
|
|
|
// LocaleUtils is not accessable from inside expression, but local function works
|
2023-06-30 12:55:59 +00:00
|
|
|
property var daysTo: (d1, d2) => LocaleUtils.daysTo(d1, d2)
|
|
|
|
property var daysBetween: (d1, d2) => LocaleUtils.daysBetween(d1, d2)
|
|
|
|
property var getFirstDayOfTheCurrentWeek: () => LocaleUtils.getFirstDayOfTheCurrentWeek()
|
2023-06-16 09:37:17 +00:00
|
|
|
proxyRoles: ExpressionRole {
|
|
|
|
name: "date"
|
|
|
|
expression: {
|
2024-07-17 12:14:01 +00:00
|
|
|
if (!model.activityEntry || model.activityEntry.timestamp === 0)
|
2023-06-30 12:55:59 +00:00
|
|
|
return ""
|
|
|
|
const currDate = new Date()
|
|
|
|
const timestampDate = new Date(model.activityEntry.timestamp * 1000)
|
|
|
|
const daysDiff = txModel.daysBetween(currDate, timestampDate)
|
|
|
|
const daysToBeginingOfThisWeek = txModel.daysTo(timestampDate, txModel.getFirstDayOfTheCurrentWeek())
|
|
|
|
|
|
|
|
if (daysDiff < 1) {
|
|
|
|
return qsTr("Today")
|
|
|
|
} else if (daysDiff < 2) {
|
|
|
|
return qsTr("Yesterday")
|
|
|
|
} else if (daysToBeginingOfThisWeek >= 0) {
|
|
|
|
return qsTr("Earlier this week")
|
|
|
|
} else if (daysToBeginingOfThisWeek > -7) {
|
|
|
|
return qsTr("Last week")
|
2023-08-03 08:45:05 +00:00
|
|
|
} else if (currDate.getMonth() === timestampDate.getMonth() && currDate.getYear() === timestampDate.getYear()) {
|
2023-06-30 12:55:59 +00:00
|
|
|
return qsTr("Earlier this month")
|
2023-08-03 08:45:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const previousMonthDate = (new Date(new Date().setDate(0)))
|
|
|
|
// Special case for the end of the year
|
|
|
|
if ((timestampDate.getMonth() === previousMonthDate.getMonth() && timestampDate.getYear() === previousMonthDate.getYear())
|
|
|
|
|| (previousMonthDate.getMonth() === 11 && timestampDate.getMonth() === 0 && Math.abs(timestampDate.getYear() - previousMonthDate.getYear()) === 1))
|
|
|
|
{
|
2023-06-30 12:55:59 +00:00
|
|
|
return qsTr("Last month")
|
|
|
|
}
|
2023-08-03 08:45:05 +00:00
|
|
|
|
2023-06-30 12:55:59 +00:00
|
|
|
return timestampDate.toLocaleDateString(Qt.locale(), "MMM yyyy")
|
2023-06-16 09:37:17 +00:00
|
|
|
}
|
2023-03-23 07:34:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-19 08:40:16 +00:00
|
|
|
delegate: transactionDelegateComponent
|
2023-03-23 07:34:05 +00:00
|
|
|
|
2023-07-04 22:29:34 +00:00
|
|
|
headerPositioning: ListView.OverlayHeader
|
2023-06-16 09:37:17 +00:00
|
|
|
footer: footerComp
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2024-02-19 08:40:16 +00:00
|
|
|
ScrollBar.vertical: StatusScrollBar {
|
|
|
|
policy: root.hideVerticalScrollbar? ScrollBar.AlwaysOff : ScrollBar.AsNeeded
|
2023-03-23 07:34:05 +00:00
|
|
|
}
|
2023-06-30 13:50:06 +00:00
|
|
|
|
2024-02-19 08:40:16 +00:00
|
|
|
visibleArea.onYPositionChanged: {
|
|
|
|
tryFetchMoreTransactions()
|
|
|
|
}
|
2023-06-30 13:50:06 +00:00
|
|
|
|
|
|
|
Connections {
|
2024-10-02 07:50:10 +00:00
|
|
|
target: root.walletRootStore
|
|
|
|
|
2023-06-30 13:50:06 +00:00
|
|
|
function onLoadingHistoryTransactionsChanged() {
|
|
|
|
// Calling timer instead directly to not cause binding loop
|
2024-10-02 07:50:10 +00:00
|
|
|
if (!root.walletRootStore.loadingHistoryTransactions)
|
2023-06-30 13:50:06 +00:00
|
|
|
fetchMoreTimer.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function tryFetchMoreTransactions() {
|
2024-10-02 07:50:10 +00:00
|
|
|
if (d.isInitialLoading || !footerItem || !root.walletRootStore.historyTransactions.hasMore)
|
2023-06-30 13:50:06 +00:00
|
|
|
return
|
|
|
|
const footerYPosition = footerItem.height / contentHeight
|
|
|
|
if (footerYPosition >= 1.0) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// On startup, first loaded ListView will have heightRatio equal 0
|
|
|
|
if (footerYPosition + visibleArea.yPosition + visibleArea.heightRatio > 1.0) {
|
2024-10-02 07:50:10 +00:00
|
|
|
root.walletRootStore.fetchMoreTransactions()
|
2023-06-30 13:50:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Timer {
|
|
|
|
id: fetchMoreTimer
|
|
|
|
interval: 1
|
|
|
|
onTriggered: transactionListRoot.tryFetchMoreTransactions()
|
|
|
|
}
|
2023-06-16 09:37:17 +00:00
|
|
|
}
|
|
|
|
|
2023-07-13 12:22:02 +00:00
|
|
|
StatusButton {
|
|
|
|
id: newTransactions
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.topMargin: Style.current.halfPadding
|
|
|
|
|
|
|
|
text: qsTr("New transactions")
|
|
|
|
|
2024-10-02 07:50:10 +00:00
|
|
|
visible: root.walletRootStore.newDataAvailable && !root.walletRootStore.loadingHistoryTransactions
|
|
|
|
onClicked: root.walletRootStore.resetActivityData()
|
2023-07-13 12:22:02 +00:00
|
|
|
|
|
|
|
icon.name: "arrow-up"
|
|
|
|
|
|
|
|
radius: 36
|
|
|
|
type: StatusButton.Primary
|
|
|
|
size: StatusBaseButton.Size.Tiny
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
|
2023-06-13 08:18:53 +00:00
|
|
|
StatusMenu {
|
|
|
|
id: delegateMenu
|
|
|
|
|
|
|
|
hideDisabledItems: true
|
|
|
|
|
|
|
|
property var transaction
|
|
|
|
property var transactionDelegate
|
|
|
|
|
2023-09-22 10:57:24 +00:00
|
|
|
function openMenu(delegate, mouse, data) {
|
|
|
|
if (!delegate || !data)
|
2023-06-13 08:18:53 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
delegateMenu.transactionDelegate = delegate
|
2023-09-22 10:57:24 +00:00
|
|
|
delegateMenu.transaction = data
|
2023-06-13 08:18:53 +00:00
|
|
|
popup(delegate, mouse.x, mouse.y)
|
|
|
|
}
|
|
|
|
|
|
|
|
onClosed: {
|
|
|
|
delegateMenu.transaction = null
|
|
|
|
delegateMenu.transactionDelegate = null
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusAction {
|
|
|
|
id: repeatTransactionAction
|
2023-09-27 13:41:55 +00:00
|
|
|
|
2023-06-13 08:18:53 +00:00
|
|
|
text: qsTr("Repeat transaction")
|
|
|
|
icon.name: "rotate"
|
2023-09-27 13:41:55 +00:00
|
|
|
|
|
|
|
property alias tx: delegateMenu.transaction
|
|
|
|
|
|
|
|
enabled: {
|
|
|
|
if (!overview.isWatchOnlyAccount && !tx)
|
|
|
|
return false
|
2024-10-01 15:37:05 +00:00
|
|
|
return root.walletRootStore.isTxRepeatable(tx)
|
2024-07-19 11:20:26 +00:00
|
|
|
}
|
2023-09-27 13:41:55 +00:00
|
|
|
|
2023-06-13 08:18:53 +00:00
|
|
|
onTriggered: {
|
2023-09-27 13:41:55 +00:00
|
|
|
if (!tx)
|
2023-06-13 08:18:53 +00:00
|
|
|
return
|
2024-10-01 15:37:05 +00:00
|
|
|
let asset = root.walletRootStore.getAssetForSendTx(tx)
|
2023-09-27 13:41:55 +00:00
|
|
|
|
2024-10-01 15:37:05 +00:00
|
|
|
const req = Helpers.lookupAddressesForSendModal(root.walletRootStore.accounts,
|
|
|
|
root.walletRootStore.savedAddresses,
|
2024-07-02 11:19:37 +00:00
|
|
|
tx.sender,
|
|
|
|
tx.recipient,
|
|
|
|
asset,
|
|
|
|
tx.isNFT,
|
2024-07-31 11:58:05 +00:00
|
|
|
tx.amount,
|
|
|
|
tx.chainId)
|
2023-09-27 13:41:55 +00:00
|
|
|
|
2024-07-17 17:53:11 +00:00
|
|
|
root.sendModal.preSelectedAccountAddress = req.preSelectedAccount.address
|
2023-09-27 13:41:55 +00:00
|
|
|
root.sendModal.preSelectedRecipient = req.preSelectedRecipient
|
|
|
|
root.sendModal.preSelectedRecipientType = req.preSelectedRecipientType
|
2024-07-31 11:58:05 +00:00
|
|
|
root.sendModal.preSelectedHoldingID = req.preSelectedHoldingID
|
2023-09-27 13:41:55 +00:00
|
|
|
root.sendModal.preSelectedHoldingType = req.preSelectedHoldingType
|
|
|
|
root.sendModal.preSelectedSendType = req.preSelectedSendType
|
|
|
|
root.sendModal.preDefinedAmountToSend = req.preDefinedAmountToSend
|
2024-07-31 11:58:05 +00:00
|
|
|
root.sendModal.preSelectedChainId = req.preSelectedChainId
|
2023-09-27 13:41:55 +00:00
|
|
|
root.sendModal.onlyAssets = false
|
|
|
|
root.sendModal.open()
|
2023-06-13 08:18:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusSuccessAction {
|
|
|
|
text: qsTr("Copy details")
|
|
|
|
successText: qsTr("Details copied")
|
|
|
|
icon.name: "copy"
|
|
|
|
onTriggered: {
|
|
|
|
if (!delegateMenu.transactionDelegate)
|
|
|
|
return
|
2024-10-01 15:37:05 +00:00
|
|
|
root.walletRootStore.addressWasShown(delegateMenu.transaction.sender)
|
2023-12-20 10:46:33 +00:00
|
|
|
if (delegateMenu.transaction.sender !== delegateMenu.transaction.recipient) {
|
2024-10-01 15:37:05 +00:00
|
|
|
root.walletRootStore.addressWasShown(delegateMenu.transaction.recipient)
|
2023-12-20 10:46:33 +00:00
|
|
|
}
|
2024-02-29 14:53:08 +00:00
|
|
|
|
2024-10-02 07:50:10 +00:00
|
|
|
root.walletRootStore.fetchTxDetails(delegateMenu.transaction.id)
|
|
|
|
let detailsObj = root.walletRootStore.getTxDetails()
|
2024-02-29 14:53:08 +00:00
|
|
|
let detailsString = delegateMenu.transactionDelegate.getDetailsString(detailsObj)
|
2024-08-27 14:35:52 +00:00
|
|
|
ClipboardUtils.setText(detailsString)
|
2023-06-13 08:18:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
StatusMenuSeparator {
|
|
|
|
visible: filterAction.enabled
|
|
|
|
}
|
|
|
|
StatusAction {
|
|
|
|
id: filterAction
|
|
|
|
text: qsTr("Filter by similar")
|
|
|
|
icon.name: "filter"
|
|
|
|
onTriggered: {
|
2024-10-01 15:37:05 +00:00
|
|
|
const store = root.walletRootStore.currentActivityFiltersStore
|
2023-09-22 10:57:24 +00:00
|
|
|
const tx = delegateMenu.transaction
|
|
|
|
|
|
|
|
store.autoUpdateFilter = false
|
|
|
|
store.resetAllFilters()
|
|
|
|
|
|
|
|
const currentAddress = overview.mixedcaseAddress.toUpperCase()
|
|
|
|
|
|
|
|
store.toggleType(tx.txType)
|
|
|
|
// Contract deployment has always ETH symbol. Symbol doesn't affect this type
|
|
|
|
if (tx.txType !== Constants.TransactionType.ContractDeployment) {
|
|
|
|
const symbol = tx.symbol
|
|
|
|
if (!!symbol)
|
|
|
|
store.toggleToken(symbol)
|
|
|
|
const inSymbol = tx.inSymbol
|
|
|
|
if (!!inSymbol && inSymbol !== symbol)
|
|
|
|
store.toggleToken(inSymbol)
|
|
|
|
}
|
|
|
|
if (showAllAccounts || tx.txType !== Constants.TransactionType.Bridge) {
|
|
|
|
const recipient = tx.recipient.toUpperCase()
|
|
|
|
if (!!recipient && recipient !== currentAddress && !/0X0+$/.test(recipient))
|
|
|
|
store.toggleRecents(recipient)
|
|
|
|
}
|
|
|
|
if (tx.isNFT) {
|
|
|
|
const uid = store.collectiblesList.getUidForData(tx.tokenID, tx.tokenAddress, tx.chainId)
|
|
|
|
if (!!uid)
|
|
|
|
store.toggleCollectibles(uid)
|
|
|
|
}
|
|
|
|
|
|
|
|
store.autoUpdateFilter = true
|
|
|
|
store.applyAllFilters()
|
2023-06-13 08:18:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
Component {
|
2024-02-19 08:40:16 +00:00
|
|
|
id: transactionDelegateComponent
|
|
|
|
ColumnLayout {
|
|
|
|
id: transactionDelegate
|
|
|
|
|
2023-06-30 15:07:53 +00:00
|
|
|
required property var model
|
|
|
|
required property int index
|
2024-02-19 08:40:16 +00:00
|
|
|
|
|
|
|
readonly property bool displaySectionHeader: index === 0 || model.date !== txModel.get(index - 1).date
|
|
|
|
readonly property bool displaySectionFooter: index === txModel.count-1 || model.date !== txModel.get(index + 1).date
|
|
|
|
|
2023-04-05 11:42:12 +00:00
|
|
|
width: ListView.view.width
|
2024-02-19 08:40:16 +00:00
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: root.firstItemOffset
|
|
|
|
visible: transactionDelegate.index === 0 && root.firstItemOffset > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
|
|
|
visible: transactionDelegate.displaySectionHeader
|
|
|
|
color: Theme.palette.statusModal.backgroundColor
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.top: parent.top
|
|
|
|
width: parent.width
|
|
|
|
spacing: Style.current.halfPadding
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
implicitHeight: 1
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
leftPadding: Style.current.padding
|
|
|
|
bottomPadding: Style.current.halfPadding
|
|
|
|
text: transactionDelegate.model.date
|
|
|
|
font.pixelSize: 13
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
TransactionDelegate {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
modelData: transactionDelegate.model.activityEntry
|
|
|
|
timeStampText: isModelDataValid ? LocaleUtils.formatRelativeTimestamp(modelData.timestamp * 1000, true) : ""
|
2024-10-02 08:48:34 +00:00
|
|
|
flatNetworks: root.walletRootStore.flatNetworks
|
2024-09-24 11:51:22 +00:00
|
|
|
currenciesStore: RootStore.currencyStore
|
2024-10-01 15:37:05 +00:00
|
|
|
walletRootStore: root.walletRootStore
|
2024-02-19 08:40:16 +00:00
|
|
|
showAllAccounts: root.showAllAccounts
|
|
|
|
displayValues: root.displayValues
|
2024-02-22 14:41:19 +00:00
|
|
|
community: isModelDataValid && !!communityId && !!root.communitiesStore ? root.communitiesStore.getCommunityDetailsAsJson(communityId) : null
|
2024-02-19 08:40:16 +00:00
|
|
|
onClicked: {
|
|
|
|
if (mouse.button === Qt.RightButton) {
|
|
|
|
delegateMenu.openMenu(this, mouse, modelData)
|
|
|
|
} else {
|
2024-02-29 14:53:08 +00:00
|
|
|
launchTransactionDetail(modelData.id)
|
2024-02-19 08:40:16 +00:00
|
|
|
}
|
2023-06-13 08:18:53 +00:00
|
|
|
}
|
|
|
|
}
|
2024-02-19 08:40:16 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 20
|
|
|
|
visible: transactionDelegate.displaySectionFooter
|
|
|
|
color: Theme.palette.statusModal.backgroundColor
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
Component {
|
2023-01-12 23:26:48 +00:00
|
|
|
id: footerComp
|
|
|
|
ColumnLayout {
|
2023-06-30 13:50:06 +00:00
|
|
|
id: footerColumn
|
2024-10-02 07:50:10 +00:00
|
|
|
readonly property bool allActivityLoaded: !root.walletRootStore.historyTransactions.hasMore && transactionListRoot.count !== 0
|
2023-01-12 23:26:48 +00:00
|
|
|
width: root.width
|
2023-07-13 12:22:02 +00:00
|
|
|
spacing: d.isInitialLoading ? 6 : 12
|
2023-06-30 13:50:06 +00:00
|
|
|
|
|
|
|
Separator {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: Style.current.halfPadding
|
|
|
|
visible: d.isInitialLoading
|
|
|
|
}
|
|
|
|
|
|
|
|
StatusTextWithLoadingState {
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
text: "01.01.2000"
|
|
|
|
width: d.loadingSectionWidth
|
|
|
|
font.pixelSize: 15
|
|
|
|
loading: visible
|
|
|
|
visible: d.isInitialLoading
|
|
|
|
}
|
|
|
|
|
|
|
|
Repeater {
|
2023-07-13 12:22:02 +00:00
|
|
|
model: {
|
2023-08-04 08:41:45 +00:00
|
|
|
if (!root.visible)
|
|
|
|
return 0
|
2023-07-13 12:22:02 +00:00
|
|
|
if (!noTxs.visible) {
|
|
|
|
const delegateHeight = 64 + footerColumn.spacing
|
|
|
|
if (d.isInitialLoading) {
|
|
|
|
return Math.floor(transactionListRoot.height / delegateHeight)
|
2024-10-02 07:50:10 +00:00
|
|
|
} else if (root.walletRootStore.historyTransactions.hasMore) {
|
2023-07-13 12:22:02 +00:00
|
|
|
return Math.max(3, Math.floor(transactionListRoot.height / delegateHeight) - 3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
2023-06-30 13:50:06 +00:00
|
|
|
TransactionDelegate {
|
|
|
|
Layout.fillWidth: true
|
2024-09-24 11:51:22 +00:00
|
|
|
|
2024-10-02 08:48:34 +00:00
|
|
|
flatNetworks: root.walletRootStore.flatNetworks
|
2024-09-24 11:51:22 +00:00
|
|
|
currenciesStore: RootStore.currencyStore
|
2024-10-01 15:37:05 +00:00
|
|
|
walletRootStore: root.walletRootStore
|
2023-06-30 13:50:06 +00:00
|
|
|
loading: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-31 07:47:52 +00:00
|
|
|
Separator {
|
|
|
|
Layout.topMargin: Style.current.bigPadding
|
|
|
|
Layout.fillWidth: true
|
2023-06-30 13:50:06 +00:00
|
|
|
visible: footerColumn.allActivityLoaded
|
2023-01-12 23:26:48 +00:00
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
text: qsTr("You have reached the beginning of the activity for this account")
|
|
|
|
font.pixelSize: 13
|
|
|
|
color: Theme.palette.baseColor1
|
2023-06-30 13:50:06 +00:00
|
|
|
visible: footerColumn.allActivityLoaded
|
2023-01-12 23:26:48 +00:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
}
|
|
|
|
StatusButton {
|
|
|
|
Layout.alignment: Qt.AlignHCenter
|
|
|
|
text: qsTr("Back to most recent transaction")
|
2023-06-30 13:50:06 +00:00
|
|
|
visible: footerColumn.allActivityLoaded && transactionListRoot.contentHeight > transactionListRoot.height
|
2023-01-12 23:26:48 +00:00
|
|
|
onClicked: transactionListRoot.positionViewAtBeginning()
|
|
|
|
}
|
2024-02-19 08:40:16 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: Style.current.halfPadding
|
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
}
|
2022-09-01 15:34:27 +00:00
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|