mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-02 01:38:00 +00:00
fix(CommunitySettings): Previous page navigations are broken in community settings sections
Added property `previousPageName` into `SettingsPageLayout`. Added needed slots in `CommunitySettingsView` to get `previousPageName` property changes and display the correct string. Renamed `updateState` method to `navigateBack` to have a better accurate name. Fixes #8455
This commit is contained in:
parent
668ea868c4
commit
5d318d0304
@ -22,6 +22,7 @@ Item {
|
|||||||
property bool headerButtonVisible: false
|
property bool headerButtonVisible: false
|
||||||
property string headerButtonText: ""
|
property string headerButtonText: ""
|
||||||
property int headerWidth: 0
|
property int headerWidth: 0
|
||||||
|
property string previousPageName: ""
|
||||||
|
|
||||||
readonly property Item contentItem: contentLoader.item
|
readonly property Item contentItem: contentLoader.item
|
||||||
readonly property size settingsDirtyToastMessageImplicitSize:
|
readonly property size settingsDirtyToastMessageImplicitSize:
|
||||||
|
@ -30,11 +30,12 @@ StackLayout {
|
|||||||
property bool requestToJoinEnabled
|
property bool requestToJoinEnabled
|
||||||
property bool pinMessagesEnabled
|
property bool pinMessagesEnabled
|
||||||
property bool encrypted
|
property bool encrypted
|
||||||
|
property string previousPageName: (currentIndex === 1) ? qsTr("Overview") : ""
|
||||||
|
|
||||||
property bool editable: false
|
property bool editable: false
|
||||||
property bool owned: false
|
property bool owned: false
|
||||||
|
|
||||||
function updateState() {
|
function navigateBack() {
|
||||||
if (editCommunityPage.dirty) {
|
if (editCommunityPage.dirty) {
|
||||||
editCommunityPage.notifyDirty();
|
editCommunityPage.notifyDirty();
|
||||||
} else {
|
} else {
|
||||||
|
@ -10,10 +10,12 @@ SettingsPageLayout {
|
|||||||
property var store: CommunitiesStore {}
|
property var store: CommunitiesStore {}
|
||||||
property int viewWidth: 560 // by design
|
property int viewWidth: 560 // by design
|
||||||
|
|
||||||
property string previousPageName
|
function navigateBack() {
|
||||||
function updateState() {
|
|
||||||
if (root.state === d.newPermissionViewState) {
|
if (root.state === d.newPermissionViewState) {
|
||||||
root.state = d.welcomeViewState;
|
root.state = d.getInitialState()
|
||||||
|
}
|
||||||
|
else if(root.state === d.permissionsViewState) {
|
||||||
|
root.state = d.newPermissionViewState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,9 +25,13 @@ SettingsPageLayout {
|
|||||||
readonly property string welcomeViewState: "WELCOME"
|
readonly property string welcomeViewState: "WELCOME"
|
||||||
readonly property string newPermissionViewState: "NEWPERMISSION"
|
readonly property string newPermissionViewState: "NEWPERMISSION"
|
||||||
readonly property string permissionsViewState: "PERMISSIONS"
|
readonly property string permissionsViewState: "PERMISSIONS"
|
||||||
|
|
||||||
|
function getInitialState() {
|
||||||
|
return root.store.permissionsModel.count > 0 ? d.permissionsViewState : d.welcomeViewState
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
state: root.store.permissionsModel.count > 0 ? d.permissionsViewState : d.welcomeViewState
|
state: d.getInitialState()
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
name: d.welcomeViewState
|
name: d.welcomeViewState
|
||||||
|
@ -57,7 +57,7 @@ StatusSectionLayout {
|
|||||||
signal openLegacyPopupClicked // TODO: remove me when migration to new settings is done
|
signal openLegacyPopupClicked // TODO: remove me when migration to new settings is done
|
||||||
|
|
||||||
onBackButtonClicked: {
|
onBackButtonClicked: {
|
||||||
centerPanelContentLoader.item.children[d.currentIndex].updateState();
|
centerPanelContentLoader.item.children[d.currentIndex].navigateBack()
|
||||||
}
|
}
|
||||||
|
|
||||||
leftPanel: Item {
|
leftPanel: Item {
|
||||||
@ -178,9 +178,6 @@ StatusSectionLayout {
|
|||||||
encrypted: root.community.encrypted
|
encrypted: root.community.encrypted
|
||||||
requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess
|
requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess
|
||||||
pinMessagesEnabled: root.community.pinMessageAllMembersEnabled
|
pinMessagesEnabled: root.community.pinMessageAllMembersEnabled
|
||||||
onCurrentIndexChanged: {
|
|
||||||
root.backButtonName = (currentIndex === 1) ? qsTr("Overview") : "";
|
|
||||||
}
|
|
||||||
editable: root.community.amISectionAdmin
|
editable: root.community.amISectionAdmin
|
||||||
|
|
||||||
onEdited: {
|
onEdited: {
|
||||||
@ -215,6 +212,7 @@ StatusSectionLayout {
|
|||||||
privateKey: root.chatCommunitySectionModule.exportCommunity(root.communityId),
|
privateKey: root.chatCommunitySectionModule.exportCommunity(root.communityId),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
||||||
}
|
}
|
||||||
|
|
||||||
CommunityMembersSettingsPanel {
|
CommunityMembersSettingsPanel {
|
||||||
@ -234,10 +232,10 @@ StatusSectionLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CommunityPermissionsSettingsPanel {
|
CommunityPermissionsSettingsPanel {
|
||||||
onStateChanged: {
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
||||||
root.backButtonName = previousPageName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onCurrentIndexChanged: root.backButtonName = centerPanelContentLoader.item.children[d.currentIndex].previousPageName
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user