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-10-02 20:47:14 +00:00
|
|
|
import shared.stores 1.0 as SharedStores
|
2022-03-23 15:38:23 +00:00
|
|
|
import shared.views.chat 1.0
|
2024-10-02 20:47:14 +00:00
|
|
|
import shared.stores.send 1.0 as SendStores
|
2024-03-04 21:52:01 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2024-10-28 14:24:53 +00:00
|
|
|
import StatusQ 0.1
|
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"
|
2024-05-22 08:13:39 +00:00
|
|
|
|
|
|
|
import AppLayouts.Communities.controls 1.0
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.panels 1.0
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Communities.stores 1.0 as CommunitiesStores
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.views 1.0
|
2024-05-22 08:13:39 +00:00
|
|
|
|
|
|
|
import AppLayouts.Profile.stores 1.0
|
2024-01-24 16:35:53 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0 as WalletStore
|
2024-10-02 20:47:14 +00:00
|
|
|
|
|
|
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
import "../popups"
|
|
|
|
import "../helpers"
|
|
|
|
import "../controls"
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
StatusSectionLayout {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: root
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property ContactsStore contactsStore
|
2024-10-02 20:47:14 +00:00
|
|
|
property SharedStores.RootStore sharedRootStore
|
2024-10-22 12:39:42 +00:00
|
|
|
property SharedStores.UtilsStore utilsStore
|
2024-10-02 20:47:14 +00:00
|
|
|
property ChatStores.RootStore rootStore
|
|
|
|
property ChatStores.CreateChatPropertiesStore createChatPropertiesStore
|
2024-05-22 08:13:39 +00:00
|
|
|
property CommunitiesStores.CommunitiesStore communitiesStore
|
2024-01-24 16:35:53 +00:00
|
|
|
required property WalletStore.WalletAssetsStore walletAssetsStore
|
2024-10-02 20:47:14 +00:00
|
|
|
required property SharedStores.CurrenciesStore currencyStore
|
2024-10-04 07:46:53 +00:00
|
|
|
required property var sendModalPopup
|
2023-03-17 18:58:07 +00:00
|
|
|
property var sectionItemModel
|
2024-10-26 01:25:50 +00:00
|
|
|
property int joinedMembersCount
|
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-06-28 16:29:18 +00:00
|
|
|
readonly property bool missingEncryptionKey: chatContentModule.chatDetails.missingEncryptionKey
|
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
|
|
|
|
|
2024-09-17 11:34:24 +00:00
|
|
|
property bool sendViaPersonalChatEnabled
|
|
|
|
|
2023-06-08 11:01:01 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2024-09-25 15:29:26 +00:00
|
|
|
if (!root.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
|
2024-09-25 15:29:26 +00:00
|
|
|
return root.chatContentModule.chatDetails.isUsersListAvailable
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
rightPanel: Component {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: userListComponent
|
|
|
|
UserListPanel {
|
2024-10-30 19:02:46 +00:00
|
|
|
readonly property var usersStore: ChatStores.UsersStore {
|
|
|
|
usersModule: !!root.chatContentModule ? root.chatContentModule.usersModule : null
|
|
|
|
chatDetails: !!root.chatContentModule ? root.chatContentModule.chatDetails : null
|
|
|
|
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
|
|
|
}
|
|
|
|
|
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
|
2024-10-28 14:24:53 +00:00
|
|
|
|
|
|
|
usersModel: SortFilterProxyModel {
|
|
|
|
sourceModel: usersStore.usersModel
|
|
|
|
|
|
|
|
proxyRoles: [
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "emojiHash"
|
|
|
|
expression: root.utilsStore.getEmojiHash(model.pubKey)
|
|
|
|
expectedRoles: ["pubKey"]
|
|
|
|
},
|
|
|
|
FastExpressionRole {
|
|
|
|
name: "compressedKey"
|
|
|
|
expression: root.utilsStore.getCompressedPk(model.pubKey)
|
|
|
|
expectedRoles: ["pubKey"]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
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
|
2024-10-02 20:47:14 +00:00
|
|
|
sharedRootStore: root.sharedRootStore
|
2024-10-22 12:39:42 +00:00
|
|
|
utilsStore: root.utilsStore
|
2023-06-08 11:01:01 +00:00
|
|
|
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
|
2024-09-17 11:34:24 +00:00
|
|
|
sendViaPersonalChatEnabled: root.sendViaPersonalChatEnabled
|
2023-06-08 11:01:01 +00:00
|
|
|
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-28 16:29:18 +00:00
|
|
|
requirementsMet: root.missingEncryptionKey ||
|
|
|
|
(root.canView && viewOnlyPermissionsModel.count > 0) ||
|
|
|
|
(root.canPost && viewAndPostPermissionsModel.count > 0)
|
2023-08-04 13:14:06 +00:00
|
|
|
requirementsCheckPending: root.chatContentModule.permissionsCheckOngoing
|
2024-06-28 16:29:18 +00:00
|
|
|
missingEncryptionKey: root.missingEncryptionKey
|
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
|
2024-10-26 01:25:50 +00:00
|
|
|
communityData: root.sectionItemModel
|
|
|
|
joinedMembersCount: root.joinedMembersCount
|
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
|
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{
|
2024-02-05 16:44:49 +00:00
|
|
|
walletAssetsStore: root.walletAssetsStore
|
2024-10-04 07:46:53 +00:00
|
|
|
sendModalPopup: root.sendModalPopup
|
2022-03-23 15:38:23 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|