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
import "../../layouts"
2022-06-06 15:23:24 +00:00
import utils 1.0
2022-08-25 11:18:51 +00:00
import shared . panels 1.0
2022-06-06 15:23:24 +00:00
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-10-07 16:33:23 +00:00
property bool encrypted
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
2022-12-07 16:14:36 +00:00
function navigateBack ( ) {
2022-09-13 16:17:54 +00:00
if ( editCommunityPage . dirty ) {
editCommunityPage . notifyDirty ( ) ;
} else {
root . currentIndex = 0 ;
}
}
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
SettingsPageLayout {
title: qsTr ( "Overview" )
content: ColumnLayout {
spacing: 16
RowLayout {
Layout.fillWidth: true
spacing: 16
StatusSmartIdenticon {
2022-08-03 20:16:43 +00:00
objectName: "communityOverviewSettingsPanelIdenticon"
2022-03-23 15:38:23 +00:00
name: root . name
2022-08-11 11:55:08 +00:00
asset.width: 80
asset.height: 80
asset.color: root . color
asset.letterSize: width / 2.4
asset.name: root . logoImageData
asset.isImage: true
2022-03-23 15:38:23 +00:00
}
ColumnLayout {
Layout.fillWidth: true
StatusBaseText {
id: nameText
2022-08-03 20:16:43 +00:00
objectName: "communityOverviewSettingsCommunityName"
2022-03-23 15:38:23 +00:00
Layout.fillWidth: true
font.pixelSize: 24
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
}
}
StatusButton {
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
}
}
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"
}
StatusBaseText {
Layout.fillWidth: true
text: qsTr ( "This node is the Community Owner Node. For your Community to function correctly try to keep this computer with Status running and onlinie as much as possible." )
font.pixelSize: 15
color: Theme . palette . directColor1
wrapMode: Text . WordWrap
}
}
Item {
Layout.fillHeight: true
}
2022-06-06 15:23:24 +00:00
RowLayout {
CommunityBanner {
text: qsTr ( "Welcome to your community!" )
buttonText: qsTr ( "Invite new people" )
2022-08-18 14:25:06 +00:00
icon.name: "invite-users"
2022-06-06 15:23:24 +00:00
onButtonClicked: root . inviteNewPeopleClicked ( )
}
Item {
Layout.fillWidth: true
}
CommunityBanner {
text: qsTr ( "Try an airdrop to reward your community for engagement!" )
buttonText: qsTr ( "Airdrop Tokens" )
2022-08-18 14:25:06 +00:00
icon.name: "airdrop"
2022-06-06 15:23:24 +00:00
onButtonClicked: root . airdropTokensClicked ( )
}
Item {
Layout.fillWidth: true
}
CommunityBanner {
text: qsTr ( "Back up community key" )
buttonText: qsTr ( "Back up" )
2022-08-18 14:25:06 +00:00
icon.name: "objects"
2022-06-06 15:23:24 +00:00
onButtonClicked: root . backUpClicked ( )
}
}
2022-03-23 15:38:23 +00:00
}
}
SettingsPageLayout {
id: editCommunityPage
title: qsTr ( "Edit Community" )
2022-05-26 15:46:02 +00:00
editable: true
2022-03-23 15:38:23 +00:00
content: CommunityEditSettingsPanel {
name: root . name
description: root . description
2022-05-26 15:46:02 +00:00
introMessage: root . introMessage
outroMessage: root . outroMessage
2022-06-09 14:59:54 +00:00
tags: root . tags
selectedTags: root . selectedTags
2022-03-23 15:38:23 +00:00
color: root . color
2022-05-23 18:53:51 +00:00
logoImageData: root . logoImageData
bannerImageData: root . bannerImageData
2022-05-26 15:46:02 +00:00
options {
archiveSupportEnabled: root . archiveSupportEnabled
requestToJoinEnabled: root . requestToJoinEnabled
pinMessagesEnabled: root . pinMessagesEnabled
2022-10-07 16:33:23 +00:00
encrypted: root . encrypted
encryptReadOnly: true
2022-05-26 15:46:02 +00:00
}
2022-03-23 15:38:23 +00:00
2022-06-22 12:16:21 +00:00
bottomReservedSpace: editCommunityPage . settingsDirtyToastMessageImplicitSize
bottomReservedSpaceActive: editCommunityPage . dirty
2022-03-23 15:38:23 +00:00
Component.onCompleted: {
editCommunityPage . dirty =
Qt . binding ( ( ) = > {
2022-05-26 15:46:02 +00:00
return 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 ||
2022-06-09 14:59:54 +00:00
root . selectedTags != selectedTags ||
2022-05-23 18:53:51 +00:00
logoImagePath . length > 0 ||
2022-05-23 17:36:48 +00:00
isValidRect ( logoCropRect ) ||
2022-05-23 18:53:51 +00:00
bannerPath . length > 0 ||
2022-05-26 15:46:02 +00:00
isValidRect ( bannerCropRect )
2022-03-23 15:38:23 +00:00
} )
2022-05-23 18:53:51 +00:00
function isValidRect ( r /*rect*/ ) { return r . width !== 0 && r . height !== 0 }
2022-03-23 15:38:23 +00:00
}
}
onSaveChangesClicked: {
root . currentIndex = 0
root . edited ( contentItem )
reloadContent ( )
}
onResetChangesClicked: reloadContent ( )
}
}