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