fix: apply Custom order to main wallet view

also fix navigating into section/subsection

Fixes #13275
This commit is contained in:
Lukáš Tinkl 2024-01-24 12:02:03 +00:00 committed by Lukáš Tinkl
parent d7e25ea0a7
commit 3b99bcb29a
8 changed files with 71 additions and 32 deletions

View File

@ -20,7 +20,7 @@ FocusScope {
property alias titleRowComponentLoader: loader property alias titleRowComponentLoader: loader
property list<Item> headerComponents property list<Item> headerComponents
property alias bottomHeaderComponents: secondHeaderRow.contentItem property alias bottomHeaderComponents: secondHeaderRow.contentItem
default property Item content default property alias content: contentWrapper.children
property alias titleLayout: titleLayout property alias titleLayout: titleLayout
property bool dirty: false property bool dirty: false
@ -49,8 +49,6 @@ FocusScope {
} }
Component.onCompleted: { Component.onCompleted: {
content.parent = contentWrapper
if (headerComponents.length) { if (headerComponents.length) {
for (let i in headerComponents) { for (let i in headerComponents) {
headerComponents[i].parent = titleRow headerComponents[i].parent = titleRow

View File

@ -2,6 +2,7 @@ import QtQuick 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import QtQuick.Layouts 1.13 import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13 import QtGraphicalEffects 1.13
import Qt.labs.settings 1.1
import QtQml 2.15 import QtQml 2.15
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
@ -22,6 +23,8 @@ import "../panels"
import AppLayouts.Profile.views.wallet 1.0 import AppLayouts.Profile.views.wallet 1.0
import AppLayouts.Wallet.stores 1.0 import AppLayouts.Wallet.stores 1.0
import AppLayouts.Wallet.controls 1.0
import AppLayouts.Wallet 1.0
SettingsContentBase { SettingsContentBase {
id: root id: root
@ -65,9 +68,22 @@ SettingsContentBase {
} }
onSaveChangesClicked: { onSaveChangesClicked: {
manageTokensView.saveChanges() manageTokensView.saveChanges()
let sectionLink = "%1/%2/".arg(Constants.appSection.wallet).arg(WalletLayout.LeftPanelSelection.AllAddresses)
if (Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageAssets) {
sectionLink += WalletLayout.RightPanelSelection.Assets
priv.assetSettings.setValue("currentSortValue", SortOrderComboBox.TokenOrderCustom)
priv.assetSettings.sync()
} else if (Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageCollectibles) {
sectionLink += WalletLayout.RightPanelSelection.Collectibles
priv.collectiblesSettings.setValue("currentSortValue", SortOrderComboBox.TokenOrderCustom)
priv.collectiblesSettings.sync()
}
Global.displayToastMessage( Global.displayToastMessage(
qsTr("Your new custom token order has been applied to your %1", "Go to Wallet") qsTr("Your new custom token order has been applied to your %1", "Go to Wallet")
.arg(`<a style="text-decoration:none" href="#${Constants.appSection.wallet}">` + qsTr("Wallet", "Go to Wallet") + "</a>"), .arg(`<a style="text-decoration:none" href="#${sectionLink}">` + qsTr("Wallet", "Go to Wallet") + "</a>"),
"", "",
"checkmark-circle", "checkmark-circle",
false, false,
@ -79,6 +95,24 @@ SettingsContentBase {
manageTokensView.resetChanges() manageTokensView.resetChanges()
} }
readonly property var priv: QtObject {
id: priv
readonly property bool isManageTokensSubsection: Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageAssets ||
Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageCollectibles ||
Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageHidden ||
Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageAdvanced
readonly property var assetSettings: Settings {
category: "AssetsViewSortSettings"
//property int currentSortValue
}
readonly property var collectiblesSettings: Settings {
category: "CollectiblesViewSortSettings"
//property int currentSortValue
}
}
StackLayout { StackLayout {
id: stackContainer id: stackContainer
@ -94,9 +128,7 @@ SettingsContentBase {
Binding on currentIndex { Binding on currentIndex {
value: root.manageTokensViewIndex value: root.manageTokensViewIndex
when: Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageAssets || when: priv.isManageTokensSubsection
Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageCollectibles ||
Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageTokenLists
restoreMode: Binding.RestoreNone restoreMode: Binding.RestoreNone
} }
@ -294,13 +326,13 @@ SettingsContentBase {
return 0 return 0
case Constants.walletSettingsSubsection.manageCollectibles: case Constants.walletSettingsSubsection.manageCollectibles:
return 1 return 1
case Constants.walletSettingsSubsection.manageTokenLists: case Constants.walletSettingsSubsection.manageHidden:
return 2 return 3
case Constants.walletSettingsSubsection.manageAdvanced:
return 4
} }
} }
when: Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageAssets || when: priv.isManageTokensSubsection
Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageCollectibles ||
Global.settingsSubSubsection === Constants.walletSettingsSubsection.manageTokenLists
restoreMode: Binding.RestoreNone restoreMode: Binding.RestoreNone
} }
} }

View File

@ -49,12 +49,6 @@ ColumnLayout {
loader.item.saveSettings() loader.item.saveSettings()
} }
function resetChanges() {
if (tabBar.currentIndex > d.hiddenTabIndex)
return
loader.item.revert()
}
QtObject { QtObject {
id: d id: d

View File

@ -57,8 +57,8 @@ Item {
} }
enum RightPanelSelection { enum RightPanelSelection {
Collectibles,
Assets, Assets,
Collectibles,
Activity Activity
} }

View File

@ -157,12 +157,22 @@ ColumnLayout {
} }
Settings { Settings {
id: settings
category: "CollectiblesViewSortSettings" category: "CollectiblesViewSortSettings"
property alias currentSortField: cmbTokenOrder.currentIndex property int currentSortValue: SortOrderComboBox.TokenOrderDateAdded
property alias currentSortOrder: cmbTokenOrder.currentSortOrder property alias currentSortOrder: cmbTokenOrder.currentSortOrder
property alias selectedFilterGroupIds: cmbFilter.selectedFilterGroupIds property alias selectedFilterGroupIds: cmbFilter.selectedFilterGroupIds
} }
Component.onCompleted: {
settings.sync()
cmbTokenOrder.currentIndex = cmbTokenOrder.indexOfValue(settings.currentSortValue)
}
Component.onDestruction: {
settings.currentSortValue = cmbTokenOrder.currentValue
}
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: false Layout.fillHeight: false

View File

@ -342,18 +342,12 @@ Item {
return return
appMain.rootStore.mainModuleInst.setActiveSectionBySectionType(sectionType) appMain.rootStore.mainModuleInst.setActiveSectionBySectionType(sectionType)
if (sectionType === Constants.appSection.profile) { if (sectionType === Constants.appSection.profile) {
Global.settingsSubsection = subsection; Global.settingsSubsection = subsection;
Global.settingsSubSubsection = settingsSubsection; Global.settingsSubSubsection = subSubsection;
return } else if (sectionType === Constants.appSection.wallet) {
} appView.children[Constants.appViewStackIndex.wallet].item.openDesiredView(subsection, subSubsection, data)
if (sectionType === Constants.appSection.wallet) {
appView.children[Constants.appViewStackIndex.wallet].item.openDesiredView(
WalletLayout.LeftPanelSelection.AllAddresses,
WalletLayout.RightPanelSelection.Activity,
data
)
} }
} }

View File

@ -156,11 +156,21 @@ ColumnLayout {
} }
Settings { Settings {
id: settings
category: "AssetsViewSortSettings" category: "AssetsViewSortSettings"
property alias currentSortField: cmbTokenOrder.currentIndex property int currentSortValue: SortOrderComboBox.TokenOrderCurrencyBalance
property alias currentSortOrder: cmbTokenOrder.currentSortOrder property alias currentSortOrder: cmbTokenOrder.currentSortOrder
} }
Component.onCompleted: {
settings.sync()
cmbTokenOrder.currentIndex = cmbTokenOrder.indexOfValue(settings.currentSortValue)
}
Component.onDestruction: {
settings.currentSortValue = cmbTokenOrder.currentValue
}
ColumnLayout { ColumnLayout {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: root.filterVisible ? implicitHeight : 0 Layout.preferredHeight: root.filterVisible ? implicitHeight : 0

View File

@ -357,7 +357,8 @@ QtObject {
readonly property int manageAccounts: 1 readonly property int manageAccounts: 1
readonly property int manageAssets: 2 readonly property int manageAssets: 2
readonly property int manageCollectibles: 3 readonly property int manageCollectibles: 3
readonly property int manageTokenLists: 4 readonly property int manageHidden: 4
readonly property int manageAdvanced: 5
} }
readonly property QtObject currentUserStatus: QtObject{ readonly property QtObject currentUserStatus: QtObject{