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
|
2024-01-24 16:35:53 +00:00
|
|
|
import shared.stores 1.0
|
2022-03-23 15:38:23 +00:00
|
|
|
import shared.views.chat 1.0
|
2023-11-28 19:16:18 +00:00
|
|
|
import shared.stores.send 1.0
|
2024-03-04 21:52:01 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2024-03-18 17:33:07 +00:00
|
|
|
import StatusQ.Core 0.1
|
2024-03-25 22:46:58 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-03-23 15:38:23 +00:00
|
|
|
import StatusQ.Layout 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
2022-08-09 15:08:39 +00:00
|
|
|
import StatusQ.Controls 0.1
|
2024-03-18 17:33:07 +00:00
|
|
|
import QtQuick.Layouts 1.15
|
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
|
2024-03-04 21:52:01 +00:00
|
|
|
import AppLayouts.Communities.controls 1.0
|
2024-01-24 16:35:53 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0 as WalletStore
|
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
|
2023-07-04 15:11:41 +00:00
|
|
|
property bool hasAddedContacts: contactsStore.myContactsModel.count > 0
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
property RootStore rootStore
|
2023-11-28 19:16:18 +00:00
|
|
|
required property TransactionStore transactionStore
|
2023-05-04 18:36:35 +00:00
|
|
|
property var createChatPropertiesStore
|
2023-09-01 07:58:48 +00:00
|
|
|
property var communitiesStore
|
2024-01-24 16:35:53 +00:00
|
|
|
required property WalletStore.WalletAssetsStore walletAssetsStore
|
|
|
|
required property CurrenciesStore currencyStore
|
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-07-04 15:11:41 +00:00
|
|
|
readonly property var chatContentModule: rootStore.currentChatContentModule() || null
|
2024-06-03 19:06:34 +00:00
|
|
|
readonly property bool canView: chatContentModule.chatDetails.canView
|
|
|
|
readonly property bool canPost: chatContentModule.chatDetails.canPost
|
2024-05-17 09:06:31 +00:00
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
property bool hasViewOnlyPermissions: false
|
2024-05-17 09:06:31 +00:00
|
|
|
property bool hasUnrestrictedViewOnlyPermission: false
|
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
property bool hasViewAndPostPermissions: false
|
|
|
|
property bool amIMember: false
|
|
|
|
property bool amISectionAdmin: false
|
2024-03-18 17:33:07 +00:00
|
|
|
readonly property bool allChannelsAreHiddenBecauseNotPermitted: rootStore.allChannelsAreHiddenBecauseNotPermitted
|
2023-06-08 11:01:01 +00:00
|
|
|
|
2024-04-04 16:03:10 +00:00
|
|
|
property int requestToJoinState: Constants.RequestToJoinState.None
|
2023-06-08 11:01:01 +00:00
|
|
|
|
|
|
|
property var viewOnlyPermissionsModel
|
|
|
|
property var viewAndPostPermissionsModel
|
|
|
|
property var assetsModel
|
|
|
|
property var collectiblesModel
|
|
|
|
|
|
|
|
readonly property bool contentLocked: {
|
|
|
|
if (!rootStore.chatCommunitySectionModule.isCommunity()) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (!amIMember) {
|
2024-05-17 09:06:31 +00:00
|
|
|
if (hasUnrestrictedViewOnlyPermission)
|
|
|
|
return false
|
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
return hasViewAndPostPermissions || hasViewOnlyPermissions
|
|
|
|
}
|
|
|
|
if (amISectionAdmin) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if (!hasViewAndPostPermissions && hasViewOnlyPermissions) {
|
2024-06-03 19:06:34 +00:00
|
|
|
return !canView
|
2023-06-08 11:01:01 +00:00
|
|
|
}
|
|
|
|
if (hasViewAndPostPermissions && !hasViewOnlyPermissions) {
|
2024-06-03 19:06:34 +00:00
|
|
|
return !canPost
|
2023-06-08 11:01:01 +00:00
|
|
|
}
|
|
|
|
if (hasViewOnlyPermissions && hasViewAndPostPermissions) {
|
2024-06-03 19:06:34 +00:00
|
|
|
return !canView && !canPost
|
2023-06-08 11:01:01 +00:00
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2023-09-28 10:09:47 +00:00
|
|
|
// Community transfer ownership related props:
|
|
|
|
required property bool isPendingOwnershipRequest
|
2023-10-23 11:32:50 +00:00
|
|
|
signal finaliseOwnershipClicked
|
2023-09-28 10:09:47 +00:00
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
signal communityInfoButtonClicked()
|
|
|
|
signal communityManageButtonClicked()
|
|
|
|
signal profileButtonClicked()
|
|
|
|
signal openAppSearch()
|
|
|
|
|
2024-03-27 07:37:28 +00:00
|
|
|
signal requestToJoinClicked
|
2023-06-08 11:01:01 +00:00
|
|
|
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 {
|
2024-03-18 17:33:07 +00:00
|
|
|
visible: !root.allChannelsAreHiddenBecauseNotPermitted
|
2023-06-08 11:01:01 +00:00
|
|
|
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
|
2024-03-27 12:36:00 +00:00
|
|
|
sourceComponent: (root.allChannelsAreHiddenBecauseNotPermitted || 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")
|
2024-05-07 18:46:54 +00:00
|
|
|
communityMemberReevaluationStatus: root.rootStore.communityMemberReevaluationStatus
|
2023-07-26 16:27:47 +00:00
|
|
|
usersModel: root.chatContentModule && root.chatContentModule.usersModule ? root.chatContentModule.usersModule.model : null
|
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()
|
2024-02-06 09:31:36 +00:00
|
|
|
onDisplayEditChannelPopup: {
|
|
|
|
Global.openPopup(contactColumnLoader.item.createChannelPopup, {
|
|
|
|
isEdit: true,
|
|
|
|
chatId: chatId,
|
|
|
|
channelName: chatName,
|
|
|
|
channelDescription: chatDescription,
|
|
|
|
channelEmoji: chatEmoji,
|
|
|
|
channelColor: chatColor,
|
|
|
|
categoryId: chatCategoryId,
|
|
|
|
channelPosition: channelPosition,
|
2024-03-18 17:33:07 +00:00
|
|
|
deleteChatConfirmationDialog: deleteDialog,
|
|
|
|
hideIfPermissionsNotMet: hideIfPermissionsNotMet
|
2024-02-06 09:31:36 +00:00
|
|
|
});
|
|
|
|
}
|
2023-06-08 11:01:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2024-06-03 19:06:34 +00:00
|
|
|
canPost: !root.rootStore.chatCommunitySectionModule.isCommunity() || root.canPost
|
2023-06-08 11:01:01 +00:00
|
|
|
amISectionAdmin: root.amISectionAdmin
|
|
|
|
onOpenStickerPackPopup: {
|
|
|
|
Global.openPopup(statusStickerPackClickPopup, {packId: stickerPackId, store: root.stickersPopup.store} )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: joinCommunityCenterPanelComponent
|
|
|
|
|
|
|
|
JoinCommunityCenterPanel {
|
|
|
|
joinCommunity: false
|
2024-03-27 12:36:00 +00:00
|
|
|
allChannelsAreHiddenBecauseNotPermitted: root.allChannelsAreHiddenBecauseNotPermitted
|
2023-06-08 11:01:01 +00:00
|
|
|
name: sectionItemModel.name
|
|
|
|
channelName: root.chatContentModule.chatDetails.name
|
|
|
|
viewOnlyHoldingsModel: root.viewOnlyPermissionsModel
|
|
|
|
viewAndPostHoldingsModel: root.viewAndPostPermissionsModel
|
|
|
|
assetsModel: root.assetsModel
|
|
|
|
collectiblesModel: root.collectiblesModel
|
2024-04-04 16:03:10 +00:00
|
|
|
requestToJoinState: root.requestToJoinState
|
2023-06-08 11:01:01 +00:00
|
|
|
requiresRequest: !root.amIMember
|
2024-06-03 19:06:34 +00:00
|
|
|
requirementsMet: (canView && viewOnlyPermissionsModel.count > 0) ||
|
|
|
|
(canPost && viewAndPostPermissionsModel.count > 0)
|
2023-08-04 13:14:06 +00:00
|
|
|
requirementsCheckPending: root.chatContentModule.permissionsCheckOngoing
|
2024-03-27 07:37:28 +00:00
|
|
|
onRequestToJoinClicked: root.requestToJoinClicked()
|
2023-06-08 11:01:01 +00:00
|
|
|
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
|
2023-09-01 07:58:48 +00:00
|
|
|
communitiesStore: root.communitiesStore
|
2024-01-24 16:35:53 +00:00
|
|
|
walletAssetsStore: root.walletAssetsStore
|
|
|
|
currencyStore: root.currencyStore
|
2022-03-23 15:38:23 +00:00
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
hasAddedContacts: root.hasAddedContacts
|
2023-09-28 10:09:47 +00:00
|
|
|
isPendingOwnershipRequest: root.isPendingOwnershipRequest
|
2022-03-23 15:38:23 +00:00
|
|
|
onInfoButtonClicked: root.communityInfoButtonClicked()
|
|
|
|
onManageButtonClicked: root.communityManageButtonClicked()
|
2023-10-23 11:32:50 +00:00
|
|
|
onFinaliseOwnershipClicked: root.finaliseOwnershipClicked()
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: statusStickerPackClickPopup
|
|
|
|
StatusStickerPackClickPopup{
|
2023-11-28 19:16:18 +00:00
|
|
|
transactionStore: root.transactionStore
|
2024-02-05 16:44:49 +00:00
|
|
|
walletAssetsStore: root.walletAssetsStore
|
2022-03-23 15:38:23 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|