2022-11-23 17:58:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core 0.1
|
2023-01-10 13:04:23 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-11-23 17:58:22 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
StatusListItem {
|
2022-12-29 16:44:51 +00:00
|
|
|
id: root
|
2023-01-10 13:04:23 +00:00
|
|
|
|
|
|
|
property alias localeCurrencyBalance: localeCurrencyBalance
|
|
|
|
property alias change24Hour: change24HourText
|
|
|
|
property alias change24HourPercentage: change24HourPercentageText
|
|
|
|
|
|
|
|
property string currentCurrencySymbol
|
2023-04-04 12:09:36 +00:00
|
|
|
property string textColor: {
|
|
|
|
if (!modelData) {
|
|
|
|
return Theme.palette.successColor1
|
|
|
|
}
|
|
|
|
return modelData.changePct24hour === undefined ?
|
|
|
|
Theme.palette.baseColor1 :
|
|
|
|
modelData.changePct24hour === 0 ?
|
|
|
|
Theme.palette.baseColor1 :
|
|
|
|
modelData.changePct24hour < 0 ?
|
|
|
|
Theme.palette.dangerColor1 :
|
|
|
|
Theme.palette.successColor1
|
|
|
|
}
|
|
|
|
|
2023-03-15 09:17:25 +00:00
|
|
|
property string errorTooltipText_1
|
|
|
|
property string errorTooltipText_2
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2023-08-04 08:41:45 +00:00
|
|
|
readonly property string symbolUrl: !!modelData && modelData.symbol ? Constants.tokenIcon(modelData.symbol, false) : ""
|
|
|
|
|
2023-04-04 12:09:36 +00:00
|
|
|
title: modelData ? modelData.name : ""
|
2023-03-22 22:08:36 +00:00
|
|
|
subTitle: LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkBalance)
|
2023-08-04 08:41:45 +00:00
|
|
|
asset.name: symbolUrl
|
2022-11-23 17:58:22 +00:00
|
|
|
asset.isImage: true
|
2023-03-23 10:23:02 +00:00
|
|
|
errorIcon.tooltip.maxWidth: 300
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2023-03-15 09:17:25 +00:00
|
|
|
statusListItemTitleIcons.sourceComponent: StatusFlatRoundButton {
|
|
|
|
width: 14
|
|
|
|
height: visible ? 14 : 0
|
|
|
|
icon.width: 14
|
|
|
|
icon.height: 14
|
|
|
|
icon.name: "tiny/warning"
|
|
|
|
icon.color: Theme.palette.dangerColor1
|
|
|
|
tooltip.text: root.errorTooltipText_1
|
|
|
|
tooltip.maxWidth: 300
|
|
|
|
visible: !!tooltip.text
|
|
|
|
}
|
|
|
|
|
2022-11-23 17:58:22 +00:00
|
|
|
components: [
|
|
|
|
Column {
|
|
|
|
id: valueColumn
|
2023-03-15 09:17:25 +00:00
|
|
|
StatusFlatRoundButton {
|
|
|
|
id: errorIcon
|
|
|
|
width: 14
|
|
|
|
height: visible ? 14 : 0
|
|
|
|
icon.width: 14
|
|
|
|
icon.height: 14
|
|
|
|
icon.name: "tiny/warning"
|
|
|
|
icon.color: Theme.palette.dangerColor1
|
|
|
|
tooltip.text: root.errorTooltipText_2
|
|
|
|
tooltip.maxWidth: 200
|
|
|
|
visible: !!tooltip.text
|
|
|
|
}
|
2023-01-10 13:04:23 +00:00
|
|
|
StatusTextWithLoadingState {
|
|
|
|
id: localeCurrencyBalance
|
2022-11-23 17:58:22 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
font.pixelSize: 15
|
2023-04-04 12:09:36 +00:00
|
|
|
text: modelData ? LocaleUtils.currencyAmountToLocaleString(modelData.enabledNetworkCurrencyBalance) : ""
|
2023-03-15 09:17:25 +00:00
|
|
|
visible: !errorIcon.visible
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|
|
|
|
Row {
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
spacing: 8
|
2023-03-15 09:17:25 +00:00
|
|
|
visible: !errorIcon.visible
|
2023-01-10 13:04:23 +00:00
|
|
|
StatusTextWithLoadingState {
|
2022-11-23 17:58:22 +00:00
|
|
|
id: change24HourText
|
|
|
|
font.pixelSize: 15
|
2023-01-10 13:04:23 +00:00
|
|
|
customColor: root.textColor
|
2023-04-04 12:09:36 +00:00
|
|
|
text: modelData ? LocaleUtils.currencyAmountToLocaleString(modelData.currencyPrice) : ""
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|
|
|
|
Rectangle {
|
|
|
|
width: 1
|
|
|
|
height: change24HourText.implicitHeight
|
|
|
|
color: Theme.palette.directColor9
|
|
|
|
}
|
2023-01-10 13:04:23 +00:00
|
|
|
StatusTextWithLoadingState {
|
|
|
|
id: change24HourPercentageText
|
2022-11-23 17:58:22 +00:00
|
|
|
font.pixelSize: 15
|
2023-01-10 13:04:23 +00:00
|
|
|
customColor: root.textColor
|
2023-04-04 12:09:36 +00:00
|
|
|
text: modelData && modelData.changePct24hour !== "" ? "%1%".arg(LocaleUtils.numberToLocaleString(modelData.changePct24hour, 2)) : "---"
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2023-08-04 08:41:45 +00:00
|
|
|
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "unkownToken"
|
|
|
|
when: !root.symbolUrl
|
|
|
|
PropertyChanges {
|
|
|
|
target: root.asset
|
|
|
|
isLetterIdenticon: true
|
|
|
|
color: Theme.palette.miscColor5
|
|
|
|
name: !!modelData && modelData.symbol ? modelData.symbol : ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
]
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|