2022-03-23 15:38:23 +00:00
|
|
|
import QtQuick 2.13
|
|
|
|
import QtQuick.Controls 2.13
|
|
|
|
import Qt.labs.settings 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
import shared 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
import shared.status 1.0
|
|
|
|
import shared.views.chat 1.0
|
|
|
|
|
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2022-08-09 15:08:39 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
import "."
|
|
|
|
import "../panels"
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.panels 1.0
|
|
|
|
import AppLayouts.Communities.views 1.0
|
2022-03-23 15:38:23 +00:00
|
|
|
import "../popups"
|
|
|
|
import "../helpers"
|
|
|
|
import "../controls"
|
|
|
|
import "../stores"
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
StatusSectionLayout {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: root
|
|
|
|
|
|
|
|
property var contactsStore
|
|
|
|
property bool hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
|
|
|
|
|
|
|
property RootStore rootStore
|
2023-05-04 18:36:35 +00:00
|
|
|
property var createChatPropertiesStore
|
2023-03-17 18:58:07 +00:00
|
|
|
property var sectionItemModel
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
property var emojiPopup
|
2022-11-14 20:21:00 +00:00
|
|
|
property var stickersPopup
|
2022-03-23 15:38:23 +00:00
|
|
|
property bool stickersLoaded: false
|
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
readonly property var chatContentModule: root.rootStore.currentChatContentModule() || null
|
|
|
|
readonly property bool viewOnlyPermissionsSatisfied: chatContentModule.viewOnlyPermissionsSatisfied
|
|
|
|
readonly property bool viewAndPostPermissionsSatisfied: chatContentModule.viewAndPostPermissionsSatisfied
|
|
|
|
property bool hasViewOnlyPermissions: false
|
|
|
|
property bool hasViewAndPostPermissions: false
|
|
|
|
property bool amIMember: false
|
|
|
|
property bool amISectionAdmin: false
|
|
|
|
|
|
|
|
property bool isInvitationPending: false
|
|
|
|
|
|
|
|
property var viewOnlyPermissionsModel
|
|
|
|
property var viewAndPostPermissionsModel
|
|
|
|
property var assetsModel
|
|
|
|
property var collectiblesModel
|
|
|
|
|
|
|
|
readonly property bool contentLocked: {
|
|
|
|
if (!rootStore.chatCommunitySectionModule.isCommunity()) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (!amIMember) {
|
|
|
|
return hasViewAndPostPermissions || hasViewOnlyPermissions
|
|
|
|
}
|
|
|
|
if (amISectionAdmin) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (!hasViewAndPostPermissions && hasViewOnlyPermissions) {
|
|
|
|
return !viewOnlyPermissionsSatisfied
|
|
|
|
}
|
|
|
|
if (hasViewAndPostPermissions && !hasViewOnlyPermissions) {
|
|
|
|
return !viewAndPostPermissionsSatisfied
|
|
|
|
}
|
|
|
|
if (hasViewOnlyPermissions && hasViewAndPostPermissions) {
|
|
|
|
return !viewOnlyPermissionsSatisfied && !viewAndPostPermissionsSatisfied
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
signal communityInfoButtonClicked()
|
|
|
|
signal communityManageButtonClicked()
|
|
|
|
signal profileButtonClicked()
|
|
|
|
signal openAppSearch()
|
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
signal revealAddressClicked
|
|
|
|
signal invitationPendingClicked
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
Connections {
|
|
|
|
target: root.rootStore.stickersStore.stickersModule
|
2022-07-22 11:24:28 +00:00
|
|
|
|
|
|
|
function onStickerPacksLoaded() {
|
2022-03-23 15:38:23 +00:00
|
|
|
root.stickersLoaded = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: root.rootStore.chatCommunitySectionModule
|
2022-05-16 15:02:03 +00:00
|
|
|
ignoreUnknownSignals: true
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-07-22 11:24:28 +00:00
|
|
|
function onActiveItemChanged() {
|
|
|
|
Global.closeCreateChatView()
|
2022-05-13 15:27:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
onNotificationButtonClicked: Global.openActivityCenterPopup()
|
2022-10-26 16:00:20 +00:00
|
|
|
notificationCount: activityCenterStore.unreadNotificationsCount
|
2023-02-07 15:53:56 +00:00
|
|
|
hasUnseenNotifications: activityCenterStore.hasUnseenNotifications
|
2022-08-09 15:08:39 +00:00
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
headerContent: Loader {
|
|
|
|
id: headerContentLoader
|
|
|
|
sourceComponent: root.contentLocked ? joinCommunityHeaderPanelComponent : chatHeaderContentViewComponent
|
2022-08-09 15:08:39 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
leftPanel: Loader {
|
|
|
|
id: contactColumnLoader
|
|
|
|
sourceComponent: root.rootStore.chatCommunitySectionModule.isCommunity()?
|
|
|
|
communtiyColumnComponent :
|
|
|
|
contactsColumnComponent
|
|
|
|
}
|
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
centerPanel: Loader {
|
2022-08-09 15:08:39 +00:00
|
|
|
anchors.fill: parent
|
2023-06-08 11:01:01 +00:00
|
|
|
sourceComponent: root.contentLocked ? joinCommunityCenterPanelComponent : chatColumnViewComponent
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
showRightPanel: {
|
2023-06-08 11:01:01 +00:00
|
|
|
if (root.contentLocked) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
if (root.rootStore.openCreateChat ||
|
2022-08-09 15:08:39 +00:00
|
|
|
!localAccountSensitiveSettings.showOnlineUsers ||
|
|
|
|
!localAccountSensitiveSettings.expandUsersList) {
|
2022-03-23 15:38:23 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
let chatContentModule = root.rootStore.currentChatContentModule()
|
2023-01-20 19:01:32 +00:00
|
|
|
if (!chatContentModule) {
|
2022-03-23 15:38:23 +00:00
|
|
|
return false
|
|
|
|
}
|
|
|
|
// Check if user list is available as an option for particular chat content module
|
|
|
|
return chatContentModule.chatDetails.isUsersListAvailable
|
|
|
|
}
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
rightPanel: Component {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: userListComponent
|
|
|
|
UserListPanel {
|
2023-05-19 16:07:50 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
store: root.rootStore
|
2022-05-09 20:56:45 +00:00
|
|
|
label: qsTr("Members")
|
2022-11-16 09:41:32 +00:00
|
|
|
usersModel: {
|
2022-03-23 15:38:23 +00:00
|
|
|
let chatContentModule = root.rootStore.currentChatContentModule()
|
|
|
|
if (!chatContentModule || !chatContentModule.usersModule) {
|
|
|
|
// New communities have no chats, so no chatContentModule
|
2022-12-13 10:45:26 +00:00
|
|
|
return null
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-11-16 09:41:32 +00:00
|
|
|
return chatContentModule.usersModule.model
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
Component {
|
|
|
|
id: chatHeaderContentViewComponent
|
|
|
|
ChatHeaderContentView {
|
|
|
|
visible: !!root.rootStore.currentChatContentModule()
|
|
|
|
rootStore: root.rootStore
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
onSearchButtonClicked: root.openAppSearch()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: joinCommunityHeaderPanelComponent
|
|
|
|
JoinCommunityHeaderPanel {
|
|
|
|
readonly property var chatContentModule: root.rootStore.currentChatContentModule() || null
|
|
|
|
joinCommunity: false
|
|
|
|
color: chatContentModule.chatDetails.color
|
|
|
|
channelName: chatContentModule.chatDetails.name
|
|
|
|
channelDesc: chatContentModule.chatDetails.description
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: chatColumnViewComponent
|
|
|
|
|
|
|
|
ChatColumnView {
|
|
|
|
parentModule: root.rootStore.chatCommunitySectionModule
|
|
|
|
rootStore: root.rootStore
|
|
|
|
createChatPropertiesStore: root.createChatPropertiesStore
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
stickersLoaded: root.stickersLoaded
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
stickersPopup: root.stickersPopup
|
|
|
|
viewAndPostHoldingsModel: root.viewAndPostPermissionsModel
|
|
|
|
viewAndPostPermissionsSatisfied: !root.rootStore.chatCommunitySectionModule.isCommunity() || root.amISectionAdmin || root.viewAndPostPermissionsSatisfied
|
|
|
|
amISectionAdmin: root.amISectionAdmin
|
|
|
|
onOpenStickerPackPopup: {
|
|
|
|
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId, store: root.stickersPopup.store} )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: joinCommunityCenterPanelComponent
|
|
|
|
|
|
|
|
JoinCommunityCenterPanel {
|
|
|
|
joinCommunity: false
|
|
|
|
name: sectionItemModel.name
|
|
|
|
channelName: root.chatContentModule.chatDetails.name
|
|
|
|
viewOnlyHoldingsModel: root.viewOnlyPermissionsModel
|
|
|
|
viewAndPostHoldingsModel: root.viewAndPostPermissionsModel
|
|
|
|
assetsModel: root.assetsModel
|
|
|
|
collectiblesModel: root.collectiblesModel
|
|
|
|
isInvitationPending: root.isInvitationPending
|
|
|
|
requiresRequest: !root.amIMember
|
|
|
|
requirementsMet: (viewOnlyPermissionsSatisfied && viewOnlyPermissionsModel.count > 0) ||
|
|
|
|
(viewAndPostPermissionsSatisfied && viewAndPostPermissionsModel.count > 0)
|
|
|
|
onRevealAddressClicked: root.revealAddressClicked()
|
|
|
|
onInvitationPendingClicked: root.invitationPendingClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
Component {
|
|
|
|
id: contactsColumnComponent
|
|
|
|
ContactsColumnView {
|
|
|
|
chatSectionModule: root.rootStore.chatCommunitySectionModule
|
|
|
|
store: root.rootStore
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
onOpenProfileClicked: {
|
|
|
|
root.profileButtonClicked();
|
|
|
|
}
|
|
|
|
|
|
|
|
onOpenAppSearch: {
|
|
|
|
root.openAppSearch()
|
|
|
|
}
|
2023-01-17 17:13:03 +00:00
|
|
|
onAddRemoveGroupMemberClicked: {
|
2023-06-08 11:01:01 +00:00
|
|
|
if (headerContentLoader.item && headerContentLoader.item instanceof ChatHeaderContentView) {
|
|
|
|
headerContentLoader.item.addRemoveGroupMember()
|
|
|
|
}
|
2023-01-17 17:13:03 +00:00
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: communtiyColumnComponent
|
|
|
|
CommunityColumnView {
|
|
|
|
communitySectionModule: root.rootStore.chatCommunitySectionModule
|
2023-03-17 18:58:07 +00:00
|
|
|
communityData: sectionItemModel
|
2022-03-23 15:38:23 +00:00
|
|
|
store: root.rootStore
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
hasAddedContacts: root.hasAddedContacts
|
|
|
|
onInfoButtonClicked: root.communityInfoButtonClicked()
|
|
|
|
onManageButtonClicked: root.communityManageButtonClicked()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: statusStickerPackClickPopup
|
|
|
|
StatusStickerPackClickPopup{
|
|
|
|
onClosed: {
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|