2023-06-29 21:52:16 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
2023-09-26 18:04:51 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-05-18 12:21:03 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2023-09-26 18:04:51 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.controls 1.0
|
2023-09-27 11:05:50 +00:00
|
|
|
import AppLayouts.Communities.popups 1.0
|
2022-06-16 09:41:21 +00:00
|
|
|
|
2023-09-26 18:04:51 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
StatusScrollView {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: root
|
2022-08-03 20:16:43 +00:00
|
|
|
objectName: "communityEditPanelScrollView"
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-06-29 21:52:16 +00:00
|
|
|
property alias name: baseLayout.name
|
|
|
|
property alias description: baseLayout.description
|
2022-05-26 15:46:02 +00:00
|
|
|
property alias introMessage: introMessageTextInput.text
|
|
|
|
property alias outroMessage: outroMessageTextInput.text
|
2023-06-29 21:52:16 +00:00
|
|
|
property alias color: baseLayout.color
|
|
|
|
property alias tags: baseLayout.tags
|
|
|
|
property alias selectedTags: baseLayout.selectedTags
|
|
|
|
property alias options: baseLayout.options
|
2023-10-31 20:40:00 +00:00
|
|
|
|
|
|
|
property bool shardingEnabled
|
|
|
|
property int shardIndex
|
|
|
|
property bool shardingInProgress
|
|
|
|
property string pubsubTopic
|
|
|
|
property string pubsubTopicKey
|
2023-06-29 21:52:16 +00:00
|
|
|
|
|
|
|
property alias logoImageData: baseLayout.logoImageData
|
|
|
|
property alias logoImagePath: baseLayout.logoImagePath
|
|
|
|
property alias logoCropRect: baseLayout.logoCropRect
|
|
|
|
property alias bannerImageData: baseLayout.bannerImageData
|
|
|
|
property alias bannerPath: baseLayout.bannerPath
|
|
|
|
property alias bannerCropRect: baseLayout.bannerCropRect
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-06-22 12:16:21 +00:00
|
|
|
property size bottomReservedSpace: Qt.size(0, 0)
|
|
|
|
property bool bottomReservedSpaceActive: false
|
|
|
|
|
2023-06-29 21:52:16 +00:00
|
|
|
readonly property bool saveChangesButtonEnabled: !((baseLayout.isNameDirty && !baseLayout.isNameValid) ||
|
|
|
|
(baseLayout.isDescriptionDirty && !baseLayout.isDescriptionValid) ||
|
|
|
|
(introMessageTextInput.input.dirty && !introMessageTextInput.valid) ||
|
|
|
|
(outroMessageTextInput.input.dirty && !outroMessageTextInput.valid))
|
2022-06-22 12:16:21 +00:00
|
|
|
|
2023-10-31 20:40:00 +00:00
|
|
|
signal shardIndexEdited(int shardIndex)
|
|
|
|
|
2023-06-29 21:52:16 +00:00
|
|
|
padding: 0
|
2023-09-26 18:04:51 +00:00
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
ColumnLayout {
|
2023-06-29 21:52:16 +00:00
|
|
|
id: mainLayout
|
|
|
|
width: baseLayout.width
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.padding
|
2023-06-29 21:52:16 +00:00
|
|
|
EditCommunitySettingsForm {
|
|
|
|
id: baseLayout
|
|
|
|
Layout.fillHeight: true
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-05-26 15:46:02 +00:00
|
|
|
StatusModalDivider {
|
|
|
|
Layout.fillWidth: true
|
2023-06-29 21:52:16 +00:00
|
|
|
Layout.topMargin: -baseLayout.spacing
|
|
|
|
Layout.bottomMargin: 2
|
2022-05-26 15:46:02 +00:00
|
|
|
}
|
2023-06-26 11:48:45 +00:00
|
|
|
IntroMessageInput {
|
2022-05-26 15:46:02 +00:00
|
|
|
id: introMessageTextInput
|
2022-08-03 20:16:43 +00:00
|
|
|
input.edit.objectName: "editCommunityIntroInput"
|
2022-05-26 15:46:02 +00:00
|
|
|
Layout.fillWidth: true
|
2023-06-29 21:52:16 +00:00
|
|
|
minimumHeight: 482
|
|
|
|
maximumHeight: 482
|
2022-05-26 15:46:02 +00:00
|
|
|
}
|
2022-05-04 13:08:04 +00:00
|
|
|
|
2023-06-26 11:48:45 +00:00
|
|
|
OutroMessageInput {
|
2022-05-26 15:46:02 +00:00
|
|
|
id: outroMessageTextInput
|
2022-08-03 20:16:43 +00:00
|
|
|
input.edit.objectName: "editCommunityOutroInput"
|
2022-04-13 20:54:17 +00:00
|
|
|
Layout.fillWidth: true
|
2022-05-04 13:08:04 +00:00
|
|
|
}
|
|
|
|
|
2023-09-26 18:04:51 +00:00
|
|
|
StatusModalDivider {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -baseLayout.spacing
|
|
|
|
Layout.bottomMargin: 2
|
2023-10-31 20:40:00 +00:00
|
|
|
visible: root.shardingEnabled
|
2023-09-26 18:04:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RowLayout {
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.halfPadding
|
2023-10-31 20:40:00 +00:00
|
|
|
visible: root.shardingEnabled
|
2023-09-27 11:05:50 +00:00
|
|
|
|
2023-10-31 20:40:00 +00:00
|
|
|
readonly property bool shardingActive: root.shardIndex !== -1
|
2023-09-27 11:05:50 +00:00
|
|
|
|
2023-09-26 18:04:51 +00:00
|
|
|
StatusBaseText {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: qsTr("Community sharding")
|
|
|
|
}
|
|
|
|
Item { Layout.fillWidth: true }
|
|
|
|
StatusBaseText {
|
|
|
|
color: Theme.palette.baseColor1
|
2023-09-27 11:05:50 +00:00
|
|
|
visible: parent.shardingActive
|
2023-10-31 20:40:00 +00:00
|
|
|
text: qsTr("Active: on shard #%1").arg(root.shardIndex)
|
2023-09-26 18:04:51 +00:00
|
|
|
}
|
|
|
|
StatusButton {
|
|
|
|
size: StatusBaseButton.Size.Small
|
2023-09-27 11:05:50 +00:00
|
|
|
text: parent.shardingActive ? qsTr("Manage") : qsTr("Make %1 a sharded community").arg(root.name)
|
2023-10-31 20:40:00 +00:00
|
|
|
loading: root.shardingInProgress
|
2023-09-27 18:11:46 +00:00
|
|
|
onClicked: parent.shardingActive ? Global.openPopup(manageShardingPopupCmp) : Global.openPopup(enableShardingPopupCmp)
|
2023-09-26 18:04:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
Item {
|
2022-06-22 12:16:21 +00:00
|
|
|
// settingsDirtyToastMessage placeholder
|
|
|
|
visible: root.bottomReservedSpaceActive
|
|
|
|
implicitWidth: root.bottomReservedSpace.width
|
|
|
|
implicitHeight: root.bottomReservedSpace.height
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2023-09-27 11:05:50 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: enableShardingPopupCmp
|
|
|
|
EnableShardingPopup {
|
2023-10-31 20:40:00 +00:00
|
|
|
id: enableShardingPopup
|
2023-09-27 18:11:46 +00:00
|
|
|
destroyOnClose: true
|
2023-09-27 11:05:50 +00:00
|
|
|
communityName: root.name
|
2023-10-31 20:40:00 +00:00
|
|
|
shardIndex: root.shardIndex
|
|
|
|
pubsubTopic: '{"pubsubTopic":"%1", "publicKey":"%2"}'.arg(root.pubsubTopic).arg(root.pubsubTopicKey)
|
|
|
|
shardingInProgress: root.shardingInProgress
|
|
|
|
|
|
|
|
onShardIndexChanged: root.shardIndexEdited(shardIndex)
|
|
|
|
onShardingInProgressChanged: if (!shardingInProgress) {
|
|
|
|
// bring back the binding
|
|
|
|
enableShardingPopup.shardIndex = Qt.binding(() => root.shardIndex)
|
2023-09-27 18:11:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: manageShardingPopupCmp
|
|
|
|
ManageShardingPopup {
|
2023-10-31 20:40:00 +00:00
|
|
|
id: manageShardingPopup
|
2023-09-27 18:11:46 +00:00
|
|
|
destroyOnClose: true
|
|
|
|
communityName: root.name
|
2023-10-31 20:40:00 +00:00
|
|
|
shardIndex: root.shardIndex
|
|
|
|
pubsubTopic: '{"pubsubTopic":"%1", "publicKey":"%2"}'.arg(root.pubsubTopic).arg(root.pubsubTopicKey)
|
|
|
|
|
|
|
|
onDisableShardingRequested: root.shardIndexEdited(-1)
|
|
|
|
onEditShardIndexRequested: Global.openPopup(enableShardingPopupCmp)
|
2023-09-27 11:05:50 +00:00
|
|
|
}
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|