feat: disable community settings while in Testnet mode
- display an info box when in wallet testnet mode with a CTA to disable it (functionality enabled for production builds only) - the CTA can be tested/seen via OverviewSettingsPanelPage storybook page Closes #11468
This commit is contained in:
parent
1332fdc0d9
commit
a2e6227117
|
@ -19,6 +19,7 @@ SplitView {
|
||||||
|
|
||||||
editable: communityEditor.isCommunityEditable
|
editable: communityEditor.isCommunityEditable
|
||||||
owned: communityEditor.amISectionAdmin
|
owned: communityEditor.amISectionAdmin
|
||||||
|
communitySettingsDisabled: !editable
|
||||||
}
|
}
|
||||||
|
|
||||||
Pane {
|
Pane {
|
||||||
|
|
|
@ -6,8 +6,6 @@ import StatusQ.Controls 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
import utils 1.0
|
|
||||||
|
|
||||||
Control {
|
Control {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
@ -27,8 +25,8 @@ Control {
|
||||||
|
|
||||||
signal clicked
|
signal clicked
|
||||||
|
|
||||||
verticalPadding: 40
|
verticalPadding: 32
|
||||||
horizontalPadding: 56
|
horizontalPadding: 16
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -57,12 +55,12 @@ Control {
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Theme.palette.statusListItem.backgroundColor
|
color: Theme.palette.statusListItem.backgroundColor
|
||||||
radius: 8
|
radius: 16
|
||||||
border.color: Theme.palette.baseColor2
|
border.color: Theme.palette.baseColor2
|
||||||
}
|
}
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
spacing: Style.current.padding
|
spacing: 16
|
||||||
|
|
||||||
StatusRoundIcon {
|
StatusRoundIcon {
|
||||||
id: iconComponent
|
id: iconComponent
|
||||||
|
|
|
@ -23,6 +23,8 @@ StackLayout {
|
||||||
|
|
||||||
property var sectionItemModel
|
property var sectionItemModel
|
||||||
|
|
||||||
|
property bool communitySettingsDisabled
|
||||||
|
|
||||||
property var emojiPopup
|
property var emojiPopup
|
||||||
property var stickersPopup
|
property var stickersPopup
|
||||||
signal profileButtonClicked()
|
signal profileButtonClicked()
|
||||||
|
@ -154,9 +156,10 @@ StackLayout {
|
||||||
id: communitySettingsView
|
id: communitySettingsView
|
||||||
rootStore: root.rootStore
|
rootStore: root.rootStore
|
||||||
|
|
||||||
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
|
||||||
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
||||||
community: sectionItemModel
|
community: sectionItemModel
|
||||||
|
communitySettingsDisabled: root.communitySettingsDisabled
|
||||||
|
onCommunitySettingsDisabledChanged: if (communitySettingsDisabled) goTo(Constants.CommunitySettingsSections.Overview)
|
||||||
|
|
||||||
onBackToCommunityClicked: root.currentIndex = 0
|
onBackToCommunityClicked: root.currentIndex = 0
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ StackLayout {
|
||||||
property bool owned: false
|
property bool owned: false
|
||||||
property bool isControlNode: false
|
property bool isControlNode: false
|
||||||
property int loginType: Constants.LoginType.Password
|
property int loginType: Constants.LoginType.Password
|
||||||
|
property bool communitySettingsDisabled
|
||||||
|
|
||||||
function navigateBack() {
|
function navigateBack() {
|
||||||
if (editSettingsPanelLoader.item.dirty)
|
if (editSettingsPanelLoader.item.dirty)
|
||||||
|
@ -54,13 +55,9 @@ StackLayout {
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
SettingsPage {
|
Component {
|
||||||
|
id: mainSettingsPageComp
|
||||||
rightPadding: 64
|
ColumnLayout {
|
||||||
bottomPadding: 50
|
|
||||||
topPadding: 0
|
|
||||||
header: null
|
|
||||||
contentItem: ColumnLayout {
|
|
||||||
spacing: 16
|
spacing: 16
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
@ -127,8 +124,11 @@ StackLayout {
|
||||||
color: Theme.palette.statusMenu.separatorColor
|
color: Theme.palette.statusMenu.separatorColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
footer: OverviewSettingsFooter {
|
Component {
|
||||||
|
id: overviewSettingsFooterComp
|
||||||
|
OverviewSettingsFooter {
|
||||||
rightPadding: 64
|
rightPadding: 64
|
||||||
leftPadding: 64
|
leftPadding: 64
|
||||||
bottomPadding: 64
|
bottomPadding: 64
|
||||||
|
@ -142,6 +142,36 @@ StackLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: disabledSettingsBannerComp
|
||||||
|
StatusInfoBoxPanel {
|
||||||
|
title: qsTr("Community administration is disabled when in testnet mode")
|
||||||
|
text: qsTr("To access your %1 community admin area, you need to turn off testnet mode.").arg(root.name)
|
||||||
|
icon: "settings"
|
||||||
|
iconType: StatusInfoBoxPanel.Type.Warning
|
||||||
|
buttonText: qsTr("Turn off testnet mode")
|
||||||
|
onClicked: Global.openTestnetPopup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SettingsPage {
|
||||||
|
Layout.fillWidth: !root.communitySettingsDisabled
|
||||||
|
Layout.preferredWidth: root.communitySettingsDisabled ? 560 + leftPadding + rightPadding : -1
|
||||||
|
Layout.fillHeight: !root.communitySettingsDisabled
|
||||||
|
rightPadding: 64
|
||||||
|
bottomPadding: 50
|
||||||
|
topPadding: 0
|
||||||
|
header: null
|
||||||
|
contentItem: Loader {
|
||||||
|
sourceComponent: root.communitySettingsDisabled ? disabledSettingsBannerComp : mainSettingsPageComp
|
||||||
|
}
|
||||||
|
|
||||||
|
footer: Loader {
|
||||||
|
sourceComponent: overviewSettingsFooterComp
|
||||||
|
active: !root.communitySettingsDisabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SettingsPage {
|
SettingsPage {
|
||||||
id: editCommunityPage
|
id: editCommunityPage
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@ StatusSectionLayout {
|
||||||
property var rootStore
|
property var rootStore
|
||||||
property var chatCommunitySectionModule
|
property var chatCommunitySectionModule
|
||||||
property var community
|
property var community
|
||||||
property bool hasAddedContacts: false
|
|
||||||
property var transactionStore: TransactionStore {}
|
property var transactionStore: TransactionStore {}
|
||||||
|
property bool communitySettingsDisabled
|
||||||
|
|
||||||
readonly property bool isOwner: community.memberRole === Constants.memberRole.owner
|
readonly property bool isOwner: community.memberRole === Constants.memberRole.owner
|
||||||
readonly property bool isAdmin: isOwner || community.memberRole === Constants.memberRole.admin
|
readonly property bool isAdmin: isOwner || community.memberRole === Constants.memberRole.admin
|
||||||
|
@ -106,6 +106,7 @@ StatusSectionLayout {
|
||||||
Layout.rightMargin: Style.current.padding
|
Layout.rightMargin: Style.current.padding
|
||||||
model: stackLayout.children
|
model: stackLayout.children
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
enabled: !root.communitySettingsDisabled
|
||||||
|
|
||||||
delegate: StatusNavigationListItem {
|
delegate: StatusNavigationListItem {
|
||||||
objectName: "CommunitySettingsView_NavigationListItem_" + model.sectionName
|
objectName: "CommunitySettingsView_NavigationListItem_" + model.sectionName
|
||||||
|
@ -114,7 +115,7 @@ StatusSectionLayout {
|
||||||
asset.name: model.sectionIcon
|
asset.name: model.sectionIcon
|
||||||
asset.height: 24
|
asset.height: 24
|
||||||
asset.width: 24
|
asset.width: 24
|
||||||
selected: d.currentIndex === index
|
selected: d.currentIndex === index && !root.communitySettingsDisabled
|
||||||
onClicked: d.currentIndex = index
|
onClicked: d.currentIndex = index
|
||||||
visible: model.sectionEnabled
|
visible: model.sectionEnabled
|
||||||
height: visible ? implicitHeight : 0
|
height: visible ? implicitHeight : 0
|
||||||
|
@ -175,6 +176,7 @@ StatusSectionLayout {
|
||||||
owned: root.community.memberRole === Constants.memberRole.owner
|
owned: root.community.memberRole === Constants.memberRole.owner
|
||||||
loginType: root.rootStore.loginType
|
loginType: root.rootStore.loginType
|
||||||
isControlNode: root.isControlNode
|
isControlNode: root.isControlNode
|
||||||
|
communitySettingsDisabled: root.communitySettingsDisabled
|
||||||
|
|
||||||
onEdited: {
|
onEdited: {
|
||||||
const error = root.chatCommunitySectionModule.editCommunity(
|
const error = root.chatCommunitySectionModule.editCommunity(
|
||||||
|
|
|
@ -1103,6 +1103,7 @@ Item {
|
||||||
emojiPopup: statusEmojiPopup.item
|
emojiPopup: statusEmojiPopup.item
|
||||||
stickersPopup: statusStickersPopupLoader.item
|
stickersPopup: statusStickersPopupLoader.item
|
||||||
sectionItemModel: model
|
sectionItemModel: model
|
||||||
|
communitySettingsDisabled: production && appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled
|
||||||
|
|
||||||
rootStore: ChatStores.RootStore {
|
rootStore: ChatStores.RootStore {
|
||||||
contactsStore: appMain.rootStore.contactStore
|
contactsStore: appMain.rootStore.contactStore
|
||||||
|
|
|
@ -49,7 +49,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
closeButtonMouseArea.clicked(null)
|
root.closeClicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
signal linkActivated(string link)
|
signal linkActivated(string link)
|
||||||
|
|
Loading…
Reference in New Issue