2023-04-05 11:42:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQml 2.15
|
2022-09-01 15:34:27 +00:00
|
|
|
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Core 0.1
|
2023-01-12 23:26:48 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2023-02-17 12:56:31 +00:00
|
|
|
import shared.stores 1.0
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
StatusListItem {
|
|
|
|
id: root
|
|
|
|
|
2023-01-12 23:26:48 +00:00
|
|
|
property alias cryptoValueText: cryptoValueText
|
|
|
|
property alias fiatValueText: fiatValueText
|
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
property var modelData
|
|
|
|
property string symbol
|
|
|
|
property bool isIncoming
|
2023-02-17 12:56:31 +00:00
|
|
|
property string currentCurrency
|
2022-09-01 15:34:27 +00:00
|
|
|
property int transferStatus
|
2023-02-17 12:56:31 +00:00
|
|
|
property double cryptoValue
|
|
|
|
property double fiatValue
|
2022-09-01 15:34:27 +00:00
|
|
|
property string networkIcon
|
|
|
|
property string networkColor
|
|
|
|
property string networkName
|
|
|
|
property string shortTimeStamp
|
2023-02-28 17:15:22 +00:00
|
|
|
property string savedAddressNameTo
|
|
|
|
property string savedAddressNameFrom
|
|
|
|
property bool isSummary: false
|
2022-09-01 15:34:27 +00:00
|
|
|
|
2023-02-28 17:15:22 +00:00
|
|
|
readonly property bool isModelDataValid: modelData !== undefined && !!modelData
|
|
|
|
readonly property bool isNFT: isModelDataValid && modelData.isNFT
|
|
|
|
readonly property string name: isModelDataValid ?
|
|
|
|
root.isNFT ?
|
2023-04-05 11:42:12 +00:00
|
|
|
modelData.nftName ?
|
|
|
|
modelData.nftName :
|
2023-02-28 17:15:22 +00:00
|
|
|
"#" + modelData.tokenID :
|
|
|
|
root.isSummary ? root.symbol : RootStore.formatCurrencyAmount(cryptoValue, symbol) :
|
|
|
|
"N/A"
|
|
|
|
|
|
|
|
readonly property string image: isModelDataValid ?
|
|
|
|
root.isNFT ?
|
2023-04-05 11:42:12 +00:00
|
|
|
modelData.nftImageUrl ?
|
|
|
|
modelData.nftImageUrl :
|
2023-02-28 17:15:22 +00:00
|
|
|
"" :
|
|
|
|
root.symbol ?
|
|
|
|
Style.png("tokens/%1".arg(root.symbol)) :
|
|
|
|
"" :
|
|
|
|
""
|
2023-04-05 11:42:12 +00:00
|
|
|
|
2023-02-28 17:15:22 +00:00
|
|
|
readonly property string toAddress: !!savedAddressNameTo ?
|
|
|
|
savedAddressNameTo :
|
|
|
|
isModelDataValid ?
|
|
|
|
Utils.compactAddress(modelData.to, 4) :
|
|
|
|
""
|
|
|
|
|
|
|
|
readonly property string fromAddress: !!savedAddressNameFrom ?
|
|
|
|
savedAddressNameFrom :
|
|
|
|
isModelDataValid ?
|
|
|
|
Utils.compactAddress(modelData.from, 4) :
|
|
|
|
""
|
2022-09-05 09:15:47 +00:00
|
|
|
state: "normal"
|
2023-04-07 11:03:59 +00:00
|
|
|
enabled: !loading
|
2023-01-12 23:26:48 +00:00
|
|
|
asset.isImage: !loading
|
2023-02-28 17:15:22 +00:00
|
|
|
asset.name: root.image
|
2023-01-12 23:26:48 +00:00
|
|
|
asset.isLetterIdenticon: loading
|
2023-02-28 17:15:22 +00:00
|
|
|
title: root.isModelDataValid ?
|
2023-04-05 11:42:12 +00:00
|
|
|
isIncoming ?
|
2023-02-28 17:15:22 +00:00
|
|
|
isSummary ?
|
|
|
|
qsTr("Receive %1").arg(root.name) :
|
|
|
|
qsTr("Received %1 from %2").arg(root.name).arg(root.fromAddress):
|
|
|
|
isSummary ?
|
|
|
|
qsTr("Send %1 to %2").arg(root.name).arg(root.toAddress) :
|
|
|
|
qsTr("Sent %1 to %2").arg(root.name).arg(root.toAddress) :
|
|
|
|
""
|
2022-09-01 15:34:27 +00:00
|
|
|
subTitle: shortTimeStamp
|
|
|
|
inlineTagModel: 1
|
|
|
|
inlineTagDelegate: InformationTag {
|
|
|
|
tagPrimaryLabel.text: networkName
|
|
|
|
tagPrimaryLabel.color: networkColor
|
2022-10-14 18:52:55 +00:00
|
|
|
image.source: !!networkIcon ? Style.svg("tiny/%1".arg(networkIcon)) : ""
|
2023-01-12 23:26:48 +00:00
|
|
|
customBackground: Component {
|
|
|
|
Rectangle {
|
|
|
|
color: "transparent"
|
|
|
|
border.width: 1
|
|
|
|
border.color: Theme.palette.baseColor2
|
|
|
|
radius: 36
|
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
width: 51
|
|
|
|
height: root.loading ? textMetrics.tightBoundingRect.height : 24
|
2022-09-01 15:34:27 +00:00
|
|
|
rightComponent: transferStatus === Constants.TransactionStatus.Success ? completedIcon : loadingIndicator
|
2023-01-12 23:26:48 +00:00
|
|
|
loading: root.loading
|
|
|
|
}
|
|
|
|
TextMetrics {
|
|
|
|
id: textMetrics
|
|
|
|
font: statusListItemSubTitle.font
|
|
|
|
text: statusListItemSubTitle.text
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2022-09-01 15:34:27 +00:00
|
|
|
components: [
|
|
|
|
ColumnLayout {
|
2023-02-28 17:15:22 +00:00
|
|
|
visible: !root.isNFT
|
2022-09-01 15:34:27 +00:00
|
|
|
Row {
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
spacing: 4
|
|
|
|
StatusIcon {
|
|
|
|
color: isIncoming ? Theme.palette.successColor1 : Theme.palette.dangerColor1
|
|
|
|
icon: "arrow-up"
|
|
|
|
rotation: isIncoming ? 135 : 45
|
|
|
|
height: 18
|
2023-01-12 23:26:48 +00:00
|
|
|
visible: !root.loading
|
2022-09-01 15:34:27 +00:00
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
StatusTextWithLoadingState {
|
2022-09-05 09:15:47 +00:00
|
|
|
id: cryptoValueText
|
2023-02-17 12:56:31 +00:00
|
|
|
text: RootStore.formatCurrencyAmount(cryptoValue, root.symbol)
|
2023-04-05 11:42:12 +00:00
|
|
|
Binding on width {
|
|
|
|
when: root.loading
|
|
|
|
value: 111
|
|
|
|
restoreMode: Binding.RestoreBindingOrValue
|
|
|
|
}
|
|
|
|
customColor: Theme.palette.directColor1
|
2023-01-12 23:26:48 +00:00
|
|
|
loading: root.loading
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2023-01-12 23:26:48 +00:00
|
|
|
StatusTextWithLoadingState {
|
|
|
|
id: fiatValueText
|
2022-09-01 15:34:27 +00:00
|
|
|
Layout.alignment: Qt.AlignRight
|
2023-02-17 12:56:31 +00:00
|
|
|
text: RootStore.formatCurrencyAmount(fiatValue, root.currentCurrency)
|
2022-09-01 15:34:27 +00:00
|
|
|
font.pixelSize: 15
|
2023-01-12 23:26:48 +00:00
|
|
|
customColor: Theme.palette.baseColor1
|
|
|
|
loading: root.loading
|
2022-09-01 15:34:27 +00:00
|
|
|
}
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
2022-09-01 15:34:27 +00:00
|
|
|
]
|
2021-10-05 20:50:22 +00:00
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
Component {
|
|
|
|
id: loadingIndicator
|
|
|
|
StatusLoadingIndicator {
|
|
|
|
height: 10
|
|
|
|
width: 10
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-01 15:34:27 +00:00
|
|
|
Component {
|
|
|
|
id: completedIcon
|
|
|
|
StatusIcon {
|
|
|
|
visible: icon !== ""
|
|
|
|
icon: "checkmark"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
width: 10
|
|
|
|
height: 10
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|
|
|
|
}
|
2022-09-05 09:15:47 +00:00
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "normal"
|
|
|
|
PropertyChanges {
|
|
|
|
target: asset
|
|
|
|
width: 40
|
|
|
|
height: 40
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: statusListItemTitle
|
|
|
|
font.weight: Font.Medium
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: cryptoValueText
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: "big"
|
|
|
|
PropertyChanges {
|
|
|
|
target: asset
|
|
|
|
width: 50
|
|
|
|
height: 50
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: statusListItemTitle
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
PropertyChanges {
|
|
|
|
target: cryptoValueText
|
|
|
|
font.pixelSize: 17
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2021-10-05 20:50:22 +00:00
|
|
|
}
|