Lukáš Tinkl 5c0f1981ad feat: Profile Showcase: Proof of concept for own Profile Dialog
- the goal of this PR is to get some bsais UI building blocks done for
the followup PRs
- the order of showcase tabs now is:
Communities/Accounts/Collectibles/Assets
- there will be further changes to accomodate for different types of
backend models as those get developed (for other users' profiles)

Fixes #9664
2023-03-08 18:45:27 +01:00

75 lines
1.9 KiB
QML

import QtQuick 2.13
import QtQuick.Controls 2.14
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Components 0.1
import SortFilterProxyModel 0.2
import utils 1.0
import "../stores"
import shared.controls 1.0
Item {
id: root
property var account
property bool assetDetailsLaunched: false
signal assetClicked(var token)
QtObject {
id: d
property int selectedAssetIndex: -1
}
height: assetListView.height
StatusListView {
id: assetListView
objectName: "assetViewStatusListView"
anchors.fill: parent
model: RootStore.tokensLoading ? Constants.dummyModelItems : filteredModel
delegate: RootStore.tokensLoading ? loadingTokenDelegate : tokenDelegate
}
SortFilterProxyModel {
id: filteredModel
sourceModel: account.assets
filters: [
ExpressionFilter {
expression: visibleForNetworkWithPositiveBalance
}
]
}
Component {
id: loadingTokenDelegate
LoadingTokenDelegate {
width: ListView.view.width
}
}
Component {
id: tokenDelegate
TokenDelegate {
objectName: "AssetView_TokenListItem_" + symbol
readonly property string balance: "%1".arg(enabledNetworkBalance.amount) // Needed for the tests
width: ListView.view.width
onClicked: {
RootStore.getHistoricalDataForToken(symbol, RootStore.currencyStore.currentCurrency)
d.selectedAssetIndex = index
assetClicked(model)
}
Component.onCompleted: {
// on Model reset if the detail view is shown, update the data in background.
if(root.assetDetailsLaunched && index === d.selectedAssetIndex)
assetClicked(model)
}
}
}
}