status-desktop/ui/app/AppLayouts/Profile/panels/ProfileShowcaseAssetsPanel.qml
Alex Jbanca 07484cb15c feat(ProfileShowcase): Simplify ProfileShowcasePanel API and connect to the new models
1. Fix `EmptyShapeRectangleFooterListView` visibility and positioning after ListView items are animated out of view
2. Update `ShowcaseDelegate` to remove modelObject dependency. The UI properties needed will be received from parent
3. Update `ProfileShowcasePanel` to remove the previous logic involving rows move and visibility change. There is no need now for two specialised delegate components (one for in showcase and one for hidden). The delegate is still configured outside of this component because the model rolenames need to be mapped to the delegate properties. The common delegate logic is implemented in the `ProfileShowcasePanel` and only the model mapping is needed from parent component.
3. Update all `ProfileShowcase*Panel` to impement the new API
4. Remove all `*ShowcaseDelegate`. The delegate is simple enough to be configured at once in the Panel
2024-03-06 14:49:54 +02:00

56 lines
1.7 KiB
QML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import QtQuick 2.15
import QtQuick.Layouts 1.15
import StatusQ 0.1
import StatusQ.Core 0.1
import StatusQ.Controls 0.1
import utils 1.0
import shared.panels 1.0
import AppLayouts.Profile.controls 1.0
ProfileShowcasePanel {
id: root
required property bool addAccountsButtonVisible
property var formatCurrencyAmount: function(amount, symbol){}
signal navigateToAccountsTab()
emptyInShowcasePlaceholderText: qsTr("Assets here will show on your profile")
emptyHiddenPlaceholderText: qsTr("Assets here will be hidden from your profile")
delegate: ProfileShowcasePanel.Delegate {
property double totalValue: !!model && !!model.decimals ? balancesAggregator.value/(10 ** model.decimals): 0
title: !!model && !!model.name ? model.name : ""
secondaryTitle: !!model && !!model.enabledNetworkBalance ?
LocaleUtils.currencyAmountToLocaleString(model.enabledNetworkBalance) :
!!model && !!model.symbol ? root.formatCurrencyAmount(totalValue, model.symbol) : Qt.locale().zeroDigit
hasImage: true
icon.source: !!model ? Constants.tokenIcon(model.symbol) : ""
SumAggregator {
id: balancesAggregator
model: !!model && !!model.balances ? model.balances: null
roleName: "balance"
}
}
additionalFooterComponent: root.addAccountsButtonVisible ? addMoreAccountsComponent : null
Component {
id: addMoreAccountsComponent
AddMoreAccountsLink {
visible: root.addAccountsButtonVisible
text: qsTr("Dont see some of your assets?")
onClicked: root.navigateToAccountsTab()
}
}
}