chore(TokenSelectorViewAdaptor): extract "favorites" section name

This commit is contained in:
Lukáš Tinkl 2024-07-02 01:44:53 +02:00 committed by Lukáš Tinkl
parent 10f952f67a
commit a18056c7d1
1 changed files with 9 additions and 3 deletions

View File

@ -60,7 +60,7 @@ QObject {
name: "sectionId"
expression: {
if (!model.currentBalance)
return "section_zzz"
return d.favoritesSectionId
if (root.enabledChainIds.length === 1)
return "section_%1".arg(root.enabledChainIds[0])
@ -70,7 +70,7 @@ QObject {
FastExpressionRole {
name: "sectionName"
function getSectionName(sectionId, hasBalance) {
if (sectionId === "section_zzz")
if (sectionId === d.favoritesSectionId)
return qsTr("Popular assets")
if (root.enabledChainIds.length === 1 && hasBalance)
@ -115,7 +115,7 @@ QObject {
},
FastExpressionSorter {
expression: {
if (modelLeft.sectionId === "section_zzz" && modelRight.sectionId === "section_zzz")
if (modelLeft.sectionId === d.favoritesSectionId && modelRight.sectionId === d.favoritesSectionId)
return 0
const lhs = modelLeft.currencyBalance
@ -136,6 +136,12 @@ QObject {
}
// internals
QtObject {
id: d
readonly property string favoritesSectionId: "section_zzz"
}
RolesRenamingModel {
id: renamedTokensBySymbolModel
sourceModel: root.plainTokensBySymbolModel