2023-11-22 19:58:02 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2022-11-23 17:58:22 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2023-11-22 19:58:02 +00:00
|
|
|
import AppLayouts.Wallet.controls 1.0
|
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
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
property string name
|
|
|
|
property url icon
|
|
|
|
property string balance
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
property bool marketDetailsAvailable: false
|
|
|
|
property string marketBalance
|
|
|
|
property bool marketDetailsLoading: false
|
|
|
|
property string marketCurrencyPrice
|
|
|
|
property real marketChangePct24hour
|
|
|
|
|
|
|
|
property string communityId
|
|
|
|
property string communityName
|
|
|
|
property url communityIcon
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2023-03-15 09:17:25 +00:00
|
|
|
property string errorTooltipText_1
|
|
|
|
property string errorTooltipText_2
|
2023-01-10 13:04:23 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
signal communityClicked(string communityId)
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property bool isCommunityToken: !!root.communityId
|
2023-11-22 19:58:02 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
readonly property string textColor: {
|
|
|
|
if (!root.marketDetailsAvailable)
|
|
|
|
return Theme.palette.successColor1
|
2023-08-04 08:41:45 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
if (root.marketChangePct24hour === 0)
|
|
|
|
return Theme.palette.baseColor1
|
|
|
|
|
|
|
|
return root.marketChangePct24hour < 0
|
|
|
|
? Theme.palette.dangerColor1
|
|
|
|
: Theme.palette.successColor1
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly property string upDownTriangle: {
|
|
|
|
if (root.marketChangePct24hour === 0)
|
|
|
|
return ""
|
|
|
|
|
|
|
|
return root.marketChangePct24hour < 0 ? "▾" : "▴"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
title: root.name
|
|
|
|
subTitle: root.balance
|
|
|
|
asset.name: root.icon
|
2022-11-23 17:58:22 +00:00
|
|
|
asset.isImage: true
|
2023-11-22 19:58:02 +00:00
|
|
|
asset.width: 32
|
|
|
|
asset.height: 32
|
2023-03-23 10:23:02 +00:00
|
|
|
errorIcon.tooltip.maxWidth: 300
|
2024-06-14 18:20:07 +00:00
|
|
|
height: implicitHeight
|
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 {
|
2023-11-22 19:58:02 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
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
|
2024-06-14 18:20:07 +00:00
|
|
|
visible: root.marketDetailsAvailable && !!tooltip.text
|
2023-03-15 09:17:25 +00:00
|
|
|
}
|
2023-01-10 13:04:23 +00:00
|
|
|
StatusTextWithLoadingState {
|
2023-11-22 19:58:02 +00:00
|
|
|
id: currencyBalance
|
2024-06-14 18:20:07 +00:00
|
|
|
|
2022-11-23 17:58:22 +00:00
|
|
|
anchors.right: parent.right
|
2024-06-14 18:20:07 +00:00
|
|
|
visible: !errorIcon.visible && root.marketDetailsAvailable
|
|
|
|
|
|
|
|
loading: root.marketDetailsLoading
|
|
|
|
text: loading ? Constants.dummyText : root.marketBalance
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|
|
|
|
Row {
|
2023-11-22 19:58:02 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
spacing: 6
|
2024-06-14 18:20:07 +00:00
|
|
|
visible: !errorIcon.visible && root.marketDetailsAvailable
|
|
|
|
|
2023-01-10 13:04:23 +00:00
|
|
|
StatusTextWithLoadingState {
|
2023-11-22 19:58:02 +00:00
|
|
|
id: change24HourPercentageText
|
2024-06-14 18:20:07 +00:00
|
|
|
|
2023-11-22 19:58:02 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-06-14 18:20:07 +00:00
|
|
|
customColor: d.textColor
|
2023-11-22 19:58:02 +00:00
|
|
|
font.pixelSize: 13
|
2024-06-14 18:20:07 +00:00
|
|
|
loading: root.marketDetailsLoading
|
|
|
|
|
|
|
|
text: qsTr("%1 %2%", "[up/down/none character depending on value sign] [localized percentage value]%")
|
|
|
|
.arg(d.upDownTriangle).arg(LocaleUtils.numberToLocaleString(root.marketChangePct24hour, 2))
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|
|
|
|
Rectangle {
|
2023-11-22 19:58:02 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2022-11-23 17:58:22 +00:00
|
|
|
width: 1
|
2023-11-22 19:58:02 +00:00
|
|
|
height: 12
|
2022-11-23 17:58:22 +00:00
|
|
|
color: Theme.palette.directColor9
|
|
|
|
}
|
2023-01-10 13:04:23 +00:00
|
|
|
StatusTextWithLoadingState {
|
2023-11-22 19:58:02 +00:00
|
|
|
id: currencyPrice
|
2024-06-14 18:20:07 +00:00
|
|
|
|
2023-11-22 19:58:02 +00:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
2024-06-14 18:20:07 +00:00
|
|
|
customColor: d.textColor
|
2023-11-22 19:58:02 +00:00
|
|
|
font.pixelSize: 13
|
2024-06-14 18:20:07 +00:00
|
|
|
loading: root.marketDetailsLoading
|
|
|
|
text: loading ? Constants.dummyText : root.marketCurrencyPrice
|
2023-11-22 19:58:02 +00:00
|
|
|
}
|
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
|
|
|
|
Loader {
|
|
|
|
active: d.isCommunityToken
|
|
|
|
|
|
|
|
sourceComponent: ManageTokensCommunityTag {
|
|
|
|
anchors.right: parent.right
|
|
|
|
|
|
|
|
communityImage: root.communityIcon
|
|
|
|
communityName: root.communityName
|
|
|
|
communityId: root.communityId
|
|
|
|
|
|
|
|
asset.letterSize: 12
|
|
|
|
|
|
|
|
TapHandler {
|
|
|
|
acceptedButtons: Qt.LeftButton
|
|
|
|
onSingleTapped: root.communityClicked(root.communityId)
|
|
|
|
}
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2023-08-04 08:41:45 +00:00
|
|
|
|
2024-06-14 18:20:07 +00:00
|
|
|
states: State {
|
|
|
|
name: "unknownToken"
|
|
|
|
when: !root.icon.toString()
|
|
|
|
|
|
|
|
PropertyChanges {
|
|
|
|
target: root.asset
|
|
|
|
isLetterIdenticon: true
|
|
|
|
color: Theme.palette.miscColor5
|
|
|
|
name: root.name
|
2023-08-04 08:41:45 +00:00
|
|
|
}
|
2024-06-14 18:20:07 +00:00
|
|
|
}
|
2022-11-23 17:58:22 +00:00
|
|
|
}
|