fix(MintToken): Initial item updated according to tokenModel changes

Updated stackview with the corresponding initial item  when `tokenModel` changes.
This commit is contained in:
Noelia 2023-03-29 12:52:20 +02:00 committed by Noelia
parent 3db1ce70d1
commit 6752d274e1

View File

@ -71,6 +71,16 @@ SettingsPageLayout {
property bool preview: false property bool preview: false
property string accountAddress property string accountAddress
readonly property var initialItem: (root.tokensModel && root.tokensModel.count > 0) ? mintedTokensView : welcomeView readonly property var initialItem: (root.tokensModel && root.tokensModel.count > 0) ? mintedTokensView : welcomeView
onInitialItemChanged: updateInitialStackView()
function updateInitialStackView() {
if(stackManager.stackView) {
if(initialItem === welcomeView)
stackManager.stackView.replace(mintedTokensView, welcomeView, StackView.Immediate)
if(initialItem === mintedTokensView)
stackManager.stackView.replace(welcomeView, mintedTokensView, StackView.Immediate)
}
}
} }
content: StackView { content: StackView {
@ -114,11 +124,6 @@ SettingsPageLayout {
] ]
onHeaderButtonClicked: stackManager.push(d.newCollectibleViewState, newCollectiblesView, null, StackView.Immediate) onHeaderButtonClicked: stackManager.push(d.newCollectibleViewState, newCollectiblesView, null, StackView.Immediate)
onTokensModelChanged: {
if(root.tokensModel && root.tokensModel.count === 1) {
stackManager.stackView.replace(welcomeView, d.initialItem, StackView.Immediate)
}
}
StackViewStates { StackViewStates {
id: stackManager id: stackManager