2021-10-05 20:50:22 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: assetDelegate
|
|
|
|
|
2022-06-29 11:20:01 +00:00
|
|
|
QtObject {
|
|
|
|
id: _internal
|
|
|
|
readonly property var alwaysVisible : ["ETH", "SNT", "DAI", "STT"]
|
|
|
|
}
|
|
|
|
|
2021-12-06 21:10:54 +00:00
|
|
|
property string locale: ""
|
2021-10-21 08:22:05 +00:00
|
|
|
property string currency: ""
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
anchors.right: parent.right
|
2022-05-31 08:32:09 +00:00
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.left: parent.left
|
2022-06-29 11:20:01 +00:00
|
|
|
visible: _internal.alwaysVisible.includes(symbol) || (networkVisible && enabledNetworkBalance > 0)
|
2022-05-31 08:32:09 +00:00
|
|
|
height: visible ? 40 + 2 * Style.current.padding : 0
|
|
|
|
|
2021-10-05 20:50:22 +00:00
|
|
|
|
|
|
|
Image {
|
|
|
|
id: assetInfoImage
|
|
|
|
width: 36
|
|
|
|
height: 36
|
|
|
|
source: symbol ? Style.png("tokens/" + symbol) : ""
|
|
|
|
anchors.left: parent.left
|
|
|
|
anchors.leftMargin: 0
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
onStatusChanged: {
|
|
|
|
if (assetInfoImage.status == Image.Error) {
|
|
|
|
assetInfoImage.source = Style.png("tokens/DEFAULT-TOKEN@3x")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: assetSymbol
|
|
|
|
text: symbol
|
|
|
|
anchors.left: assetInfoImage.right
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
anchors.top: assetInfoImage.top
|
|
|
|
anchors.topMargin: 0
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
StyledText {
|
|
|
|
id: assetFullTokenName
|
|
|
|
text: name
|
2022-05-31 08:32:09 +00:00
|
|
|
anchors.top: assetSymbol.bottom
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.left: assetInfoImage.right
|
|
|
|
anchors.leftMargin: Style.current.smallPadding
|
|
|
|
color: Style.current.secondaryText
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
StyledText {
|
2021-10-21 08:22:05 +00:00
|
|
|
id: assetBalance
|
2022-05-19 08:53:57 +00:00
|
|
|
text: Utils.toLocaleString(enabledNetworkBalance, locale) + " " + symbol.toUpperCase()
|
2022-05-31 08:32:09 +00:00
|
|
|
anchors.top: assetInfoImage.top
|
|
|
|
anchors.topMargin: 0
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 0
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.strikeout: false
|
|
|
|
}
|
|
|
|
StyledText {
|
2021-10-21 08:22:05 +00:00
|
|
|
id: assetCurrencyBalance
|
2021-10-05 20:50:22 +00:00
|
|
|
color: Style.current.secondaryText
|
2022-05-19 08:53:57 +00:00
|
|
|
text: Utils.toLocaleString(enabledNetworkCurrencyBalance.toFixed(2), locale) + " " + assetDelegate.currency.toUpperCase()
|
2021-10-05 20:50:22 +00:00
|
|
|
anchors.right: parent.right
|
|
|
|
anchors.rightMargin: 0
|
2022-05-31 08:32:09 +00:00
|
|
|
anchors.top: assetBalance.bottom
|
2021-10-05 20:50:22 +00:00
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
|
|
|
}
|