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
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
import StatusQ.Core 0.1
|
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"
|
|
|
|
|
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-02-22 14:41:19 +00:00
|
|
|
property var 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: {
|
2023-08-04 08:41:45 +00:00
|
|
|
if (RootStore.transactionActivityStatus.isFilterDirty) {
|
2023-07-19 14:16:45 +00:00
|
|
|
WalletStores.RootStore.currentActivityFiltersStore.applyAllFilters()
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
2023-10-03 10:48:47 +00:00
|
|
|
|
2023-10-03 12:15:11 +00:00
|
|
|
WalletStores.RootStore.currentActivityFiltersStore.updateCollectiblesModel()
|
2023-10-03 10:48:47 +00:00
|
|
|
WalletStores.RootStore.currentActivityFiltersStore.updateRecipientsModel()
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
2023-07-21 10:55:36 +00:00
|
|
|
target: RootStore.transactionActivityStatus
|
2023-07-07 10:00:19 +00:00
|
|
|
enabled: root.visible
|
2023-07-21 10:55:36 +00:00
|
|
|
function onIsFilterDirtyChanged() {
|
2024-02-08 12:49:12 +00:00
|
|
|
RootStore.updateTransactionFilterIfDirty()
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
2023-10-03 10:48:47 +00:00
|
|
|
function onFilterChainsChanged() {
|
2023-10-03 12:15:11 +00:00
|
|
|
WalletStores.RootStore.currentActivityFiltersStore.updateCollectiblesModel()
|
2023-10-03 10:48:47 +00:00
|
|
|
WalletStores.RootStore.currentActivityFiltersStore.updateRecipientsModel()
|
|
|
|
}
|
2023-07-07 10:00:19 +00:00
|
|
|
}
|
|
|
|
|
2024-02-22 14:41:13 +00:00
|
|
|
Connections {
|
|
|
|
target: WalletStores.RootStore.currentActivityFiltersStore
|
|
|
|
enabled: root.visible
|
|
|
|
function onDisplayTxDetails(txHash) {
|
|
|
|
if (!d.openTxDetails(txHash)) {
|
|
|
|
d.openTxDetailsHash = txHash
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-12 23:26:48 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
2023-06-30 13:50:06 +00:00
|
|
|
readonly property bool isInitialLoading: RootStore.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
|
|
|
|
if (RootStore.loadingHistoryTransactions) {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2021-10-05 20:50:22 +00:00
|
|
|
visible: RootStore.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
|
2023-07-19 14:16:45 +00:00
|
|
|
visible: !d.isInitialLoading && !WalletStores.RootStore.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
|
2023-12-18 10:12:57 +00:00
|
|
|
active: root.filterVisible && (d.isInitialLoading || transactionListRoot.count > 0 || WalletStores.RootStore.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 {
|
|
|
|
activityFilterStore: WalletStores.RootStore.currentActivityFiltersStore
|
|
|
|
store: WalletStores.RootStore
|
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 {
|
|
|
|
RootStore.fetchMoreTransactions()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-16 09:37:17 +00:00
|
|
|
model: SortFilterProxyModel {
|
|
|
|
id: txModel
|
|
|
|
|
|
|
|
sourceModel: RootStore.historyTransactions
|
|
|
|
|
|
|
|
// 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 {
|
|
|
|
target: RootStore
|
|
|
|
function onLoadingHistoryTransactionsChanged() {
|
|
|
|
// Calling timer instead directly to not cause binding loop
|
|
|
|
if (!RootStore.loadingHistoryTransactions)
|
|
|
|
fetchMoreTimer.start()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function tryFetchMoreTransactions() {
|
2023-07-13 12:22:02 +00:00
|
|
|
if (d.isInitialLoading || !footerItem || !RootStore.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) {
|
|
|
|
RootStore.fetchMoreTransactions()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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-02-08 12:49:12 +00:00
|
|
|
visible: RootStore.newDataAvailable && !RootStore.loadingHistoryTransactions
|
|
|
|
onClicked: RootStore.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
|
|
|
|
return WalletStores.RootStore.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
|
2023-09-27 13:41:55 +00:00
|
|
|
let asset = WalletStores.RootStore.getAssetForSendTx(tx)
|
|
|
|
|
2024-07-02 11:19:37 +00:00
|
|
|
const req = Helpers.lookupAddressesForSendModal(WalletStores.RootStore.accounts,
|
|
|
|
WalletStores.RootStore.savedAddresses,
|
|
|
|
tx.sender,
|
|
|
|
tx.recipient,
|
|
|
|
asset,
|
|
|
|
tx.isNFT,
|
|
|
|
tx.amount)
|
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-17 17:53:11 +00:00
|
|
|
root.sendModal.preSelectedHoldingID = req.preSelectedHoldingID ?? req.preSelectedHolding.uid
|
2023-09-27 13:41:55 +00:00
|
|
|
root.sendModal.preSelectedHoldingType = req.preSelectedHoldingType
|
|
|
|
root.sendModal.preSelectedSendType = req.preSelectedSendType
|
|
|
|
root.sendModal.preDefinedAmountToSend = req.preDefinedAmountToSend
|
|
|
|
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
|
2023-12-20 10:46:33 +00:00
|
|
|
WalletStores.RootStore.addressWasShown(delegateMenu.transaction.sender)
|
|
|
|
if (delegateMenu.transaction.sender !== delegateMenu.transaction.recipient) {
|
|
|
|
WalletStores.RootStore.addressWasShown(delegateMenu.transaction.recipient)
|
|
|
|
}
|
2024-02-29 14:53:08 +00:00
|
|
|
|
|
|
|
RootStore.fetchTxDetails(delegateMenu.transaction.id)
|
|
|
|
let detailsObj = RootStore.getTxDetails()
|
|
|
|
let detailsString = delegateMenu.transactionDelegate.getDetailsString(detailsObj)
|
|
|
|
RootStore.copyToClipboard(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: {
|
2023-09-22 10:57:24 +00:00
|
|
|
const store = WalletStores.RootStore.currentActivityFiltersStore
|
|
|
|
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) : ""
|
|
|
|
rootStore: RootStore
|
|
|
|
walletRootStore: WalletStores.RootStore
|
|
|
|
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
|
|
|
|
readonly property bool allActivityLoaded: !RootStore.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)
|
|
|
|
} else if (RootStore.historyTransactions.hasMore) {
|
|
|
|
return Math.max(3, Math.floor(transactionListRoot.height / delegateHeight) - 3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0
|
|
|
|
}
|
2023-06-30 13:50:06 +00:00
|
|
|
TransactionDelegate {
|
|
|
|
Layout.fillWidth: true
|
2023-06-30 15:07:53 +00:00
|
|
|
rootStore: RootStore
|
|
|
|
walletRootStore: WalletStores.RootStore
|
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
|
|
|
}
|