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
|
||||
owned: communityEditor.amISectionAdmin
|
||||
communitySettingsDisabled: !editable
|
||||
}
|
||||
|
||||
Pane {
|
||||
|
|
|
@ -6,8 +6,6 @@ import StatusQ.Controls 0.1
|
|||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import utils 1.0
|
||||
|
||||
Control {
|
||||
id: root
|
||||
|
||||
|
@ -27,8 +25,8 @@ Control {
|
|||
|
||||
signal clicked
|
||||
|
||||
verticalPadding: 40
|
||||
horizontalPadding: 56
|
||||
verticalPadding: 32
|
||||
horizontalPadding: 16
|
||||
|
||||
QtObject {
|
||||
id: d
|
||||
|
@ -57,12 +55,12 @@ Control {
|
|||
|
||||
background: Rectangle {
|
||||
color: Theme.palette.statusListItem.backgroundColor
|
||||
radius: 8
|
||||
radius: 16
|
||||
border.color: Theme.palette.baseColor2
|
||||
}
|
||||
|
||||
contentItem: ColumnLayout {
|
||||
spacing: Style.current.padding
|
||||
spacing: 16
|
||||
|
||||
StatusRoundIcon {
|
||||
id: iconComponent
|
||||
|
|
|
@ -23,6 +23,8 @@ StackLayout {
|
|||
|
||||
property var sectionItemModel
|
||||
|
||||
property bool communitySettingsDisabled
|
||||
|
||||
property var emojiPopup
|
||||
property var stickersPopup
|
||||
signal profileButtonClicked()
|
||||
|
@ -154,9 +156,10 @@ StackLayout {
|
|||
id: communitySettingsView
|
||||
rootStore: root.rootStore
|
||||
|
||||
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
||||
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
||||
community: sectionItemModel
|
||||
communitySettingsDisabled: root.communitySettingsDisabled
|
||||
onCommunitySettingsDisabledChanged: if (communitySettingsDisabled) goTo(Constants.CommunitySettingsSections.Overview)
|
||||
|
||||
onBackToCommunityClicked: root.currentIndex = 0
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ StackLayout {
|
|||
property bool owned: false
|
||||
property bool isControlNode: false
|
||||
property int loginType: Constants.LoginType.Password
|
||||
property bool communitySettingsDisabled
|
||||
|
||||
function navigateBack() {
|
||||
if (editSettingsPanelLoader.item.dirty)
|
||||
|
@ -54,13 +55,9 @@ StackLayout {
|
|||
|
||||
clip: true
|
||||
|
||||
SettingsPage {
|
||||
|
||||
rightPadding: 64
|
||||
bottomPadding: 50
|
||||
topPadding: 0
|
||||
header: null
|
||||
contentItem: ColumnLayout {
|
||||
Component {
|
||||
id: mainSettingsPageComp
|
||||
ColumnLayout {
|
||||
spacing: 16
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
|
@ -127,8 +124,11 @@ StackLayout {
|
|||
color: Theme.palette.statusMenu.separatorColor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
footer: OverviewSettingsFooter {
|
||||
Component {
|
||||
id: overviewSettingsFooterComp
|
||||
OverviewSettingsFooter {
|
||||
rightPadding: 64
|
||||
leftPadding: 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 {
|
||||
id: editCommunityPage
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@ StatusSectionLayout {
|
|||
property var rootStore
|
||||
property var chatCommunitySectionModule
|
||||
property var community
|
||||
property bool hasAddedContacts: false
|
||||
property var transactionStore: TransactionStore {}
|
||||
property bool communitySettingsDisabled
|
||||
|
||||
readonly property bool isOwner: community.memberRole === Constants.memberRole.owner
|
||||
readonly property bool isAdmin: isOwner || community.memberRole === Constants.memberRole.admin
|
||||
|
@ -106,6 +106,7 @@ StatusSectionLayout {
|
|||
Layout.rightMargin: Style.current.padding
|
||||
model: stackLayout.children
|
||||
spacing: 8
|
||||
enabled: !root.communitySettingsDisabled
|
||||
|
||||
delegate: StatusNavigationListItem {
|
||||
objectName: "CommunitySettingsView_NavigationListItem_" + model.sectionName
|
||||
|
@ -114,7 +115,7 @@ StatusSectionLayout {
|
|||
asset.name: model.sectionIcon
|
||||
asset.height: 24
|
||||
asset.width: 24
|
||||
selected: d.currentIndex === index
|
||||
selected: d.currentIndex === index && !root.communitySettingsDisabled
|
||||
onClicked: d.currentIndex = index
|
||||
visible: model.sectionEnabled
|
||||
height: visible ? implicitHeight : 0
|
||||
|
@ -175,6 +176,7 @@ StatusSectionLayout {
|
|||
owned: root.community.memberRole === Constants.memberRole.owner
|
||||
loginType: root.rootStore.loginType
|
||||
isControlNode: root.isControlNode
|
||||
communitySettingsDisabled: root.communitySettingsDisabled
|
||||
|
||||
onEdited: {
|
||||
const error = root.chatCommunitySectionModule.editCommunity(
|
||||
|
|
|
@ -1103,6 +1103,7 @@ Item {
|
|||
emojiPopup: statusEmojiPopup.item
|
||||
stickersPopup: statusStickersPopupLoader.item
|
||||
sectionItemModel: model
|
||||
communitySettingsDisabled: production && appMain.rootStore.profileSectionStore.walletStore.areTestNetworksEnabled
|
||||
|
||||
rootStore: ChatStores.RootStore {
|
||||
contactsStore: appMain.rootStore.contactStore
|
||||
|
|
|
@ -49,7 +49,7 @@ Item {
|
|||
}
|
||||
|
||||
function close() {
|
||||
closeButtonMouseArea.clicked(null)
|
||||
root.closeClicked()
|
||||
}
|
||||
|
||||
signal linkActivated(string link)
|
||||
|
|
Loading…
Reference in New Issue