2022-06-06 15:23:24 +00:00
import QtQuick 2.14
2022-03-23 15:38:23 +00:00
import QtQuick . Layouts 1.14
import QtQuick . Controls 2.14
import StatusQ . Core 0.1
import StatusQ . Core . Theme 0.1
import StatusQ . Controls 0.1
import StatusQ . Components 0.1
2023-06-23 06:17:04 +00:00
import AppLayouts . Communities . layouts 1.0
import AppLayouts . Communities . panels 1.0
2022-03-23 15:38:23 +00:00
2023-06-29 09:35:37 +00:00
import shared . popups 1.0
2022-06-06 15:23:24 +00:00
import utils 1.0
2022-03-23 15:38:23 +00:00
StackLayout {
id: root
2022-06-06 15:23:24 +00:00
property string communityId
2022-03-23 15:38:23 +00:00
property string name
property string description
2022-05-26 15:46:02 +00:00
property string introMessage
property string outroMessage
2022-05-23 18:53:51 +00:00
property string logoImageData
property string bannerImageData
property rect bannerCropRect
2022-03-23 15:38:23 +00:00
property color color
2022-06-09 14:59:54 +00:00
property string tags
property string selectedTags
2022-05-26 15:46:02 +00:00
property bool archiveSupportEnabled
property bool requestToJoinEnabled
property bool pinMessagesEnabled
2022-12-07 16:14:36 +00:00
property string previousPageName: ( currentIndex === 1 ) ? qsTr ( "Overview" ) : ""
2022-05-26 15:46:02 +00:00
2022-03-23 15:38:23 +00:00
property bool editable: false
property bool owned: false
2023-07-06 08:02:41 +00:00
property int loginType: Constants . LoginType . Password
2022-03-23 15:38:23 +00:00
2022-12-07 16:14:36 +00:00
function navigateBack ( ) {
2023-06-29 09:35:37 +00:00
if ( editSettingsPanelLoader . item . dirty )
settingsDirtyToastMessage . notifyDirty ( )
else
root . currentIndex = 0
2022-09-13 16:17:54 +00:00
}
2022-05-26 15:46:02 +00:00
signal edited ( Item item ) // item containing edited fields (name, description, logoImagePath, color, options, etc..)
2022-03-23 15:38:23 +00:00
2022-06-06 15:23:24 +00:00
signal inviteNewPeopleClicked
signal airdropTokensClicked
signal backUpClicked
2022-03-23 15:38:23 +00:00
clip: true
2023-06-29 09:35:37 +00:00
SettingsPage {
2022-03-23 15:38:23 +00:00
2023-06-29 09:35:37 +00:00
rightPadding: 64
bottomPadding: 64
2023-06-30 12:25:37 +00:00
topPadding: 0
header: null
2023-06-29 09:35:37 +00:00
contentItem: ColumnLayout {
2022-03-23 15:38:23 +00:00
spacing: 16
RowLayout {
Layout.fillWidth: true
spacing: 16
ColumnLayout {
Layout.fillWidth: true
2023-06-30 12:25:37 +00:00
Layout.maximumWidth: 747
2022-03-23 15:38:23 +00:00
StatusBaseText {
id: nameText
2022-08-03 20:16:43 +00:00
objectName: "communityOverviewSettingsCommunityName"
2022-03-23 15:38:23 +00:00
Layout.fillWidth: true
2023-06-30 12:25:37 +00:00
font.pixelSize: 28
font.bold: true
font.letterSpacing: - 0.4
2022-03-23 15:38:23 +00:00
color: Theme . palette . directColor1
wrapMode: Text . WordWrap
text: root . name
}
StatusBaseText {
id: descriptionText
2022-08-03 20:16:43 +00:00
objectName: "communityOverviewSettingsCommunityDescription"
2022-03-23 15:38:23 +00:00
Layout.fillWidth: true
font.pixelSize: 15
color: Theme . palette . directColor1
wrapMode: Text . WordWrap
text: root . description
}
}
2023-06-30 12:25:37 +00:00
Item { Layout.fillWidth: true }
2022-03-23 15:38:23 +00:00
StatusButton {
2023-06-30 12:25:37 +00:00
Layout.preferredHeight: 38
Layout.alignment: Qt . AlignTop
2022-08-03 20:16:43 +00:00
objectName: "communityOverviewSettingsEditCommunityButton"
2022-03-23 15:38:23 +00:00
visible: root . editable
text: qsTr ( "Edit Community" )
onClicked: root . currentIndex = 1
2023-06-30 12:25:37 +00:00
size: StatusBaseButton . Size . Small
2022-03-23 15:38:23 +00:00
}
}
Rectangle {
Layout.fillWidth: true
implicitHeight: 1
visible: root . editable
2022-12-01 16:58:37 +00:00
color: Theme . palette . statusMenu . separatorColor
2022-03-23 15:38:23 +00:00
}
RowLayout {
Layout.fillWidth: true
visible: root . owned
StatusIcon {
icon: "info"
2023-06-20 11:18:06 +00:00
color: Theme . palette . directColor1
2022-03-23 15:38:23 +00:00
}
StatusBaseText {
Layout.fillWidth: true
2023-06-20 11:18:06 +00:00
text: qsTr ( "This node is the Community Owner Node. For your Community to function correctly try to keep this computer with Status running and online as much as possible." )
2022-03-23 15:38:23 +00:00
font.pixelSize: 15
color: Theme . palette . directColor1
wrapMode: Text . WordWrap
}
}
Item {
Layout.fillHeight: true
}
2023-07-06 08:02:41 +00:00
}
2022-06-06 15:23:24 +00:00
2023-07-06 08:02:41 +00:00
footer: OverviewSettingsFooter {
rightPadding: 64
leftPadding: 64
bottomPadding: 50
loginType: root . loginType
communityName: root . name
//TODO connect to backend
isControlNode: root . owned
onPrimaryButtonClicked: isControlNode = ! isControlNode
//TODO update once the domain changes
onSecondaryButtonClicked: Global . openLink ( Constants . statusHelpLinkPrefix + "en/status-communities/about-the-control-node-in-status-communities" )
2022-03-23 15:38:23 +00:00
}
}
2023-06-29 09:35:37 +00:00
SettingsPage {
2022-03-23 15:38:23 +00:00
id: editCommunityPage
2023-06-30 14:36:46 +00:00
title: qsTr ( "Edit Community" )
2023-06-29 09:35:37 +00:00
contentItem: Loader {
id: editSettingsPanelLoader
function reloadContent ( ) {
active = false
active = true
2022-05-26 15:46:02 +00:00
}
2022-03-23 15:38:23 +00:00
2023-06-29 09:35:37 +00:00
sourceComponent: EditSettingsPanel {
id: editSettingsPanel
function isValidRect ( r /*rect*/ ) {
return r . width !== 0 && r . height !== 0
}
readonly property bool dirty:
root . name != name ||
root . description != description ||
root . introMessage != introMessage ||
root . outroMessage != outroMessage ||
root . archiveSupportEnabled != options . archiveSupportEnabled ||
root . requestToJoinEnabled != options . requestToJoinEnabled ||
root . pinMessagesEnabled != options . pinMessagesEnabled ||
root . color != color ||
root . selectedTags != selectedTags ||
root . logoImageData != logoImageData ||
logoImagePath . length > 0 ||
isValidRect ( logoCropRect ) ||
root . bannerImageData != bannerImageData ||
bannerPath . length > 0 ||
isValidRect ( bannerCropRect )
name: root . name
description: root . description
introMessage: root . introMessage
outroMessage: root . outroMessage
tags: root . tags
selectedTags: root . selectedTags
color: root . color
logoImageData: root . logoImageData
bannerImageData: root . bannerImageData
options {
archiveSupportEnabled: root . archiveSupportEnabled
requestToJoinEnabled: root . requestToJoinEnabled
pinMessagesEnabled: root . pinMessagesEnabled
}
bottomReservedSpace:
Qt . size ( settingsDirtyToastMessage . implicitWidth ,
settingsDirtyToastMessage . implicitHeight +
settingsDirtyToastMessage . anchors . bottomMargin )
bottomReservedSpaceActive: dirty
Binding {
target: editSettingsPanel . flickable
property: "bottomMargin"
value: 24
}
2022-03-23 15:38:23 +00:00
}
}
2023-06-29 09:35:37 +00:00
SettingsDirtyToastMessage {
id: settingsDirtyToastMessage
z: 1
anchors {
bottom: parent . bottom
horizontalCenter: parent . horizontalCenter
bottomMargin: 16
}
2022-03-23 15:38:23 +00:00
2023-06-29 09:35:37 +00:00
active: ! ! editSettingsPanelLoader . item &&
editSettingsPanelLoader . item . dirty
saveChangesButtonEnabled:
! ! editSettingsPanelLoader . item &&
editSettingsPanelLoader . item . saveChangesButtonEnabled
onResetChangesClicked: editSettingsPanelLoader . reloadContent ( )
onSaveChangesClicked: {
root . currentIndex = 0
root . edited ( editSettingsPanelLoader . item )
editSettingsPanelLoader . reloadContent ( )
}
}
2022-03-23 15:38:23 +00:00
}
}