From a18056c7d11af1166dd40148a55108db3c262e8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Tue, 2 Jul 2024 01:44:53 +0200 Subject: [PATCH] chore(TokenSelectorViewAdaptor): extract "favorites" section name --- .../Wallet/adaptors/TokenSelectorViewAdaptor.qml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml b/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml index 69e0038a1a..9d8ef5d8dd 100644 --- a/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml +++ b/ui/app/AppLayouts/Wallet/adaptors/TokenSelectorViewAdaptor.qml @@ -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