2022-05-23 13:11:30 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Layouts 1.13
|
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
2022-08-18 14:25:06 +00:00
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2022-08-09 15:08:39 +00:00
|
|
|
import StatusQ.Layout 0.1
|
2022-05-23 13:11:30 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2022-09-28 15:25:49 +00:00
|
|
|
import shared.controls 1.0
|
2022-06-21 08:57:09 +00:00
|
|
|
import shared.popups 1.0
|
2022-08-25 11:18:51 +00:00
|
|
|
import shared.panels 1.0
|
2022-06-21 08:57:09 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2022-08-08 19:41:25 +00:00
|
|
|
import "controls"
|
2022-05-23 13:11:30 +00:00
|
|
|
import "stores"
|
2022-06-21 08:57:09 +00:00
|
|
|
import "popups"
|
2022-09-28 15:25:49 +00:00
|
|
|
import "views"
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
StatusSectionLayout {
|
2022-05-23 13:11:30 +00:00
|
|
|
id: root
|
2022-07-20 12:14:50 +00:00
|
|
|
objectName: "communitiesPortalLayout"
|
2022-05-23 13:11:30 +00:00
|
|
|
|
|
|
|
property CommunitiesStore communitiesStore: CommunitiesStore {}
|
2022-05-10 16:04:25 +00:00
|
|
|
property var importCommunitiesPopup: importCommunitiesPopupComponent
|
|
|
|
property var createCommunitiesPopup: createCommunitiesPopupComponent
|
2022-08-03 20:02:21 +00:00
|
|
|
property int contentPrefferedWidth: 100
|
2022-09-15 07:31:38 +00:00
|
|
|
property var discordImportProgressPopup: discordImportProgressDialog
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
notificationCount: root.communitiesStore.unreadNotificationsCount
|
|
|
|
onNotificationButtonClicked: Global.openActivityCenterPopup()
|
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
onVisibleChanged: {
|
|
|
|
if(visible)
|
|
|
|
searcher.input.edit.forceActiveFocus()
|
|
|
|
}
|
|
|
|
|
2022-05-23 13:11:30 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
// values from the design
|
|
|
|
readonly property int layoutTopMargin: 10
|
|
|
|
readonly property int layoutBottomMargin: 249
|
|
|
|
readonly property int layoutHMargin: 64
|
|
|
|
readonly property int layoutWidth: 1037
|
|
|
|
readonly property int titlePixelSize: 28
|
|
|
|
readonly property int preventShadowClipMargin: 40
|
|
|
|
|
|
|
|
readonly property bool searchMode: searcher.text.length > 0
|
2022-05-23 13:11:30 +00:00
|
|
|
|
|
|
|
function navigateToCommunity(communityId) {
|
2022-06-21 08:57:09 +00:00
|
|
|
root.communitiesStore.setActiveCommunity(communityId)
|
2022-05-23 13:11:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
SortFilterProxyModel {
|
|
|
|
id: searchModel
|
|
|
|
|
|
|
|
sourceModel: root.communitiesStore.curatedCommunitiesModel
|
|
|
|
|
|
|
|
filters: ExpressionFilter {
|
|
|
|
enabled: d.searchMode
|
|
|
|
expression: {
|
|
|
|
searcher.text
|
|
|
|
return name.toLowerCase().includes(searcher.text.toLowerCase())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
centerPanel: Item {
|
2022-09-28 15:25:49 +00:00
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.bottom: parent.bottom
|
2022-09-13 16:17:54 +00:00
|
|
|
anchors.left: parent.left
|
2022-09-28 15:25:49 +00:00
|
|
|
width: d.layoutWidth
|
|
|
|
|
|
|
|
anchors.topMargin: d.layoutTopMargin
|
2022-09-13 16:17:54 +00:00
|
|
|
anchors.leftMargin: d.layoutHMargin
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
ColumnLayout {
|
|
|
|
id: column
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
spacing: 18
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
StatusBaseText {
|
|
|
|
text: qsTr("Find community")
|
|
|
|
font.weight: Font.Bold
|
|
|
|
font.pixelSize: d.titlePixelSize
|
|
|
|
color: Theme.palette.directColor1
|
|
|
|
}
|
2022-08-09 15:08:39 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
RowLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: 38
|
|
|
|
spacing: Style.current.bigPadding
|
|
|
|
|
|
|
|
SearchBox {
|
|
|
|
id: searcher
|
|
|
|
implicitWidth: 327
|
|
|
|
Layout.alignment: Qt.AlignVCenter
|
|
|
|
topPadding: 0
|
|
|
|
bottomPadding: 0
|
|
|
|
minimumHeight: 36
|
|
|
|
maximumHeight: 36
|
2022-08-18 14:25:06 +00:00
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
// Just a row filler to fit design
|
|
|
|
Item { Layout.fillWidth: true }
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
StatusButton {
|
|
|
|
id: importBtn
|
|
|
|
Layout.preferredHeight: 38
|
|
|
|
text: qsTr("Import using key")
|
|
|
|
verticalPadding: 0
|
|
|
|
onClicked: Global.openPopup(importCommunitiesPopupComponent)
|
2022-08-09 15:08:39 +00:00
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
StatusButton {
|
|
|
|
id: createBtn
|
|
|
|
objectName: "createCommunityButton"
|
|
|
|
Layout.preferredHeight: 38
|
|
|
|
verticalPadding: 0
|
|
|
|
text: qsTr("Create New Community")
|
|
|
|
onClicked: {
|
|
|
|
if (localAccountSensitiveSettings.isDiscordImportToolEnabled) {
|
|
|
|
Global.openPopup(chooseCommunityCreationTypePopupComponent)
|
|
|
|
} else {
|
|
|
|
Global.openPopup(createCommunitiesPopupComponent)
|
2022-08-09 15:08:39 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
}
|
2022-09-28 15:25:49 +00:00
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
CommunityTagsRow {
|
|
|
|
tags: root.communitiesStore.communityTags
|
|
|
|
Layout.fillWidth: true
|
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
Item {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.leftMargin: -d.preventShadowClipMargin
|
|
|
|
Layout.rightMargin: -d.preventShadowClipMargin
|
|
|
|
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
CommunitiesGridView {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.rightMargin: d.preventShadowClipMargin
|
|
|
|
anchors.leftMargin: d.preventShadowClipMargin
|
|
|
|
|
|
|
|
padding: 0
|
|
|
|
bottomPadding: d.layoutBottomMargin
|
|
|
|
|
|
|
|
locale: communitiesStore.locale
|
|
|
|
model: searchModel
|
|
|
|
searchLayout: d.searchMode
|
|
|
|
|
|
|
|
onCardClicked: d.navigateToCommunity(communityId)
|
2022-05-23 13:11:30 +00:00
|
|
|
}
|
2022-09-28 18:48:12 +00:00
|
|
|
|
|
|
|
StatusBaseText {
|
|
|
|
anchors.top: parent.top
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
anchors.topMargin: parent.height / 3.1
|
|
|
|
visible: d.searchMode && searchModel.count === 0
|
|
|
|
text: qsTr("No communities found")
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.pixelSize: 15
|
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-06-21 08:57:09 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: importCommunitiesPopupComponent
|
|
|
|
ImportCommunityPopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
store: root.communitiesStore
|
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: createCommunitiesPopupComponent
|
|
|
|
CreateCommunityPopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
store: root.communitiesStore
|
2022-08-18 15:59:12 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
2022-08-18 14:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: chooseCommunityCreationTypePopupComponent
|
|
|
|
StatusDialog {
|
|
|
|
id: chooseCommunityCreationTypePopup
|
|
|
|
title: qsTr("Create new community")
|
|
|
|
horizontalPadding: 40
|
|
|
|
verticalPadding: 60
|
|
|
|
footer: null
|
|
|
|
onClosed: destroy()
|
|
|
|
|
|
|
|
contentItem: RowLayout {
|
|
|
|
spacing: 20
|
|
|
|
CommunityBanner {
|
|
|
|
text: qsTr("Create a new Status community")
|
|
|
|
buttonText: qsTr("Create new")
|
|
|
|
icon.name: "favourite"
|
|
|
|
onButtonClicked: {
|
|
|
|
chooseCommunityCreationTypePopup.close()
|
|
|
|
Global.openPopup(createCommunitiesPopupComponent)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CommunityBanner {
|
2022-09-15 07:31:38 +00:00
|
|
|
property bool importInProgress: root.communitiesStore.discordImportInProgress && !root.communitiesStore.discordImportCancelled
|
|
|
|
text: importInProgress ?
|
|
|
|
qsTr("'%1' import in progress...").arg(root.communitiesStore.discordImportCommunityName) :
|
|
|
|
qsTr("Import existing Discord community into Status")
|
2022-08-18 14:25:06 +00:00
|
|
|
buttonText: qsTr("Import existing")
|
|
|
|
icon.name: "download"
|
2022-09-15 07:31:38 +00:00
|
|
|
buttonTooltipText: qsTr("Your current import must finished or be cancelled before a new import can be started.")
|
|
|
|
buttonLoading: importInProgress
|
2022-08-18 14:25:06 +00:00
|
|
|
onButtonClicked: {
|
|
|
|
chooseCommunityCreationTypePopup.close()
|
|
|
|
Global.openPopup(createCommunitiesPopupComponent, {isDiscordImport: true})
|
|
|
|
}
|
|
|
|
}
|
2022-06-21 08:57:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-09-15 07:31:38 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: discordImportProgressDialog
|
|
|
|
DiscordImportProgressDialog {
|
|
|
|
store: root.communitiesStore
|
|
|
|
}
|
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
}
|