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-09-28 15:25:49 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.controls 1.0
|
|
|
|
import AppLayouts.Communities.popups 1.0
|
|
|
|
import AppLayouts.Communities.views 1.0
|
|
|
|
import AppLayouts.Communities.panels 1.0
|
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
|
|
|
|
|
2023-04-28 10:35:18 +00:00
|
|
|
property var communitiesStore
|
2022-05-23 13:11:30 +00:00
|
|
|
|
2023-06-16 18:38:32 +00:00
|
|
|
property var assetsModel
|
|
|
|
property var collectiblesModel
|
2023-04-18 14:22:27 +00:00
|
|
|
|
|
|
|
objectName: "communitiesPortalLayout"
|
2022-08-09 15:08:39 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
SortFilterProxyModel {
|
2022-10-17 10:03:08 +00:00
|
|
|
id: filteredCommunitiesModel
|
|
|
|
|
|
|
|
function selectedTagsPredicate(selectedTagsNames, tagsJSON) {
|
2023-03-06 21:06:01 +00:00
|
|
|
if (!tagsJSON) {
|
|
|
|
return true
|
|
|
|
}
|
2022-10-17 10:03:08 +00:00
|
|
|
const tags = JSON.parse(tagsJSON)
|
|
|
|
for (const i in tags) {
|
|
|
|
selectedTagsNames = selectedTagsNames.filter(name => name !== tags[i].name)
|
|
|
|
}
|
|
|
|
return selectedTagsNames.length === 0
|
|
|
|
}
|
2022-09-28 15:25:49 +00:00
|
|
|
|
|
|
|
sourceModel: root.communitiesStore.curatedCommunitiesModel
|
|
|
|
|
2022-10-17 10:03:08 +00:00
|
|
|
filters: [
|
|
|
|
ExpressionFilter {
|
|
|
|
enabled: d.searchMode
|
|
|
|
expression: {
|
|
|
|
searcher.text
|
|
|
|
return name.toLowerCase().includes(searcher.text.toLowerCase())
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ExpressionFilter {
|
|
|
|
expression: {
|
|
|
|
return filteredCommunitiesModel.selectedTagsPredicate(communityTags.selectedTagsNames, model.tags)
|
|
|
|
}
|
2022-09-28 15:25:49 +00:00
|
|
|
}
|
2022-10-17 10:03:08 +00:00
|
|
|
]
|
2022-09-28 15:25:49 +00:00
|
|
|
}
|
|
|
|
|
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 {
|
2022-12-07 15:29:37 +00:00
|
|
|
text: qsTr("Discover Communities")
|
2022-09-28 15:25:49 +00:00
|
|
|
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
|
2023-07-21 17:21:11 +00:00
|
|
|
text: qsTr("Import community")
|
2022-09-28 15:25:49 +00:00
|
|
|
verticalPadding: 0
|
2023-04-28 10:35:18 +00:00
|
|
|
onClicked: Global.importCommunityPopupRequested()
|
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
|
2024-02-08 14:39:37 +00:00
|
|
|
text: qsTr("Create community")
|
2022-09-28 15:25:49 +00:00
|
|
|
onClicked: {
|
2023-04-26 16:22:57 +00:00
|
|
|
Global.openPopup(chooseCommunityCreationTypePopupComponent)
|
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
|
|
|
|
2023-06-26 11:48:45 +00:00
|
|
|
TagsRow {
|
2022-10-17 10:03:08 +00:00
|
|
|
id: communityTags
|
2022-09-28 15:25:49 +00:00
|
|
|
Layout.fillWidth: true
|
2022-10-17 10:03:08 +00:00
|
|
|
|
|
|
|
tags: root.communitiesStore.communityTags
|
2022-09-28 15:25:49 +00:00
|
|
|
}
|
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 {
|
2022-10-20 06:49:21 +00:00
|
|
|
id: communitiesGrid
|
2023-04-18 14:22:27 +00:00
|
|
|
|
2022-09-28 15:25:49 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
anchors.rightMargin: d.preventShadowClipMargin
|
|
|
|
anchors.leftMargin: d.preventShadowClipMargin
|
|
|
|
|
|
|
|
padding: 0
|
|
|
|
bottomPadding: d.layoutBottomMargin
|
|
|
|
|
2022-10-17 10:03:08 +00:00
|
|
|
model: filteredCommunitiesModel
|
2022-09-28 15:25:49 +00:00
|
|
|
searchLayout: d.searchMode
|
|
|
|
|
2023-04-18 14:22:27 +00:00
|
|
|
assetsModel: root.assetsModel
|
|
|
|
collectiblesModel: root.collectiblesModel
|
|
|
|
|
2022-10-18 13:55:02 +00:00
|
|
|
onCardClicked: root.communitiesStore.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
|
2022-10-20 06:49:21 +00:00
|
|
|
visible: (d.searchMode && filteredCommunitiesModel.count === 0) || communitiesGrid.isEmpty
|
2022-09-28 18:48:12 +00:00
|
|
|
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
|
|
|
|
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
|
2023-06-26 11:48:45 +00:00
|
|
|
BannerPanel {
|
2023-04-26 16:22:57 +00:00
|
|
|
objectName: "createCommunityBanner"
|
2022-08-18 14:25:06 +00:00
|
|
|
text: qsTr("Create a new Status community")
|
|
|
|
buttonText: qsTr("Create new")
|
|
|
|
icon.name: "favourite"
|
|
|
|
onButtonClicked: {
|
|
|
|
chooseCommunityCreationTypePopup.close()
|
2023-04-28 10:35:18 +00:00
|
|
|
Global.createCommunityPopupRequested(false /*isDiscordImport*/)
|
2022-08-18 14:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
2023-06-26 11:48:45 +00:00
|
|
|
BannerPanel {
|
2022-10-20 06:56:11 +00:00
|
|
|
readonly property bool importInProgress: root.communitiesStore.discordImportInProgress && !root.communitiesStore.discordImportCancelled
|
2022-09-15 07:31:38 +00:00
|
|
|
text: importInProgress ?
|
2023-10-16 18:26:47 +00:00
|
|
|
qsTr("'%1' import in progress...").arg(root.communitiesStore.discordImportCommunityName || root.communitiesStore.discordImportChannelName) :
|
2022-09-15 07:31:38 +00:00
|
|
|
qsTr("Import existing Discord community into Status")
|
2022-08-18 14:25:06 +00:00
|
|
|
buttonText: qsTr("Import existing")
|
|
|
|
icon.name: "download"
|
2022-10-20 06:56:11 +00:00
|
|
|
buttonTooltipText: qsTr("Your current import must be finished or cancelled before a new import can be started.")
|
2022-09-15 07:31:38 +00:00
|
|
|
buttonLoading: importInProgress
|
2022-08-18 14:25:06 +00:00
|
|
|
onButtonClicked: {
|
|
|
|
chooseCommunityCreationTypePopup.close()
|
2023-04-28 10:35:18 +00:00
|
|
|
Global.createCommunityPopupRequested(true /*isDiscordImport*/)
|
2022-08-18 14:25:06 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-21 08:57:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-05-23 13:11:30 +00:00
|
|
|
}
|