2022-03-23 16:38:23 +01:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
2021-09-28 18:04:06 +03:00
|
|
|
|
|
|
|
import utils 1.0
|
2023-03-16 15:10:58 +01:00
|
|
|
import shared.popups 1.0
|
2021-10-01 18:58:36 +03:00
|
|
|
|
|
|
|
import "views"
|
2023-03-07 17:51:06 +01:00
|
|
|
import "views/communities"
|
2021-10-01 18:58:36 +03:00
|
|
|
import "stores"
|
2022-06-21 13:44:20 +02:00
|
|
|
import "popups/community"
|
2020-05-13 13:27:06 -04:00
|
|
|
|
2023-03-07 17:51:06 +01:00
|
|
|
import AppLayouts.Chat.stores 1.0
|
|
|
|
|
2022-03-23 16:38:23 +01:00
|
|
|
StackLayout {
|
2021-10-22 01:39:53 +03:00
|
|
|
id: root
|
2020-05-27 13:10:50 -04:00
|
|
|
|
2023-02-09 22:49:36 +01:00
|
|
|
property RootStore rootStore
|
2023-05-04 14:36:35 -04:00
|
|
|
property var createChatPropertiesStore
|
2023-02-09 22:49:36 +01:00
|
|
|
readonly property var contactsStore: rootStore.contactsStore
|
2023-03-07 17:51:06 +01:00
|
|
|
readonly property var permissionsStore: rootStore.permissionsStore
|
2021-11-15 10:15:21 -05:00
|
|
|
|
2023-03-17 19:58:07 +01:00
|
|
|
property var sectionItemModel
|
|
|
|
|
2023-03-07 17:34:36 +01:00
|
|
|
property var emojiPopup
|
|
|
|
property var stickersPopup
|
|
|
|
signal profileButtonClicked()
|
|
|
|
signal openAppSearch()
|
2020-09-23 09:28:20 +02:00
|
|
|
|
2022-11-21 16:46:41 +01:00
|
|
|
onCurrentIndexChanged: {
|
|
|
|
Global.closeCreateChatView()
|
|
|
|
}
|
|
|
|
|
2023-03-07 17:51:06 +01:00
|
|
|
Loader {
|
|
|
|
readonly property var chatItem: root.rootStore.chatCommunitySectionModule
|
|
|
|
sourceComponent: chatItem.isCommunity() && chatItem.requiresTokenPermissionToJoin && !chatItem.amIMember ? joinCommunityViewComponent : chatViewComponent
|
|
|
|
}
|
2022-05-10 19:04:25 +03:00
|
|
|
|
2023-03-07 17:51:06 +01:00
|
|
|
Component {
|
|
|
|
id: joinCommunityViewComponent
|
|
|
|
JoinCommunityView {
|
|
|
|
id: joinCommunityView
|
2023-03-17 19:58:07 +01:00
|
|
|
readonly property var communityData: sectionItemModel
|
2023-03-07 17:51:06 +01:00
|
|
|
name: communityData.name
|
|
|
|
communityDesc: communityData.description
|
|
|
|
color: communityData.color
|
|
|
|
image: communityData.image
|
|
|
|
membersCount: communityData.members.count
|
|
|
|
accessType: communityData.access
|
|
|
|
joinCommunity: true
|
|
|
|
amISectionAdmin: communityData.amISectionAdmin
|
|
|
|
communityItemsModel: root.rootStore.communityItemsModel
|
|
|
|
requirementsMet: root.permissionsStore.allTokenRequirementsMet
|
|
|
|
communityHoldingsModel: root.permissionsStore.permissionsModel
|
|
|
|
assetsModel: root.rootStore.assetsModel
|
|
|
|
collectiblesModel: root.rootStore.collectiblesModel
|
|
|
|
isInvitationPending: root.rootStore.isCommunityRequestPending(communityData.id)
|
2023-03-21 12:54:47 +02:00
|
|
|
notificationCount: activityCenterStore.unreadNotificationsCount
|
|
|
|
hasUnseenNotifications: activityCenterStore.hasUnseenNotifications
|
|
|
|
openCreateChat: rootStore.openCreateChat
|
2023-03-30 12:42:28 +03:00
|
|
|
loginType: root.rootStore.loginType
|
2023-03-21 12:54:47 +02:00
|
|
|
onNotificationButtonClicked: Global.openActivityCenterPopup()
|
|
|
|
onAdHocChatButtonClicked: rootStore.openCloseCreateChatView()
|
2023-03-16 11:58:39 +01:00
|
|
|
onRevealAddressClicked: {
|
2023-03-16 15:10:58 +01:00
|
|
|
communityIntroDialog.open()
|
2023-03-16 11:58:39 +01:00
|
|
|
}
|
|
|
|
onInvitationPendingClicked: {
|
|
|
|
root.rootStore.cancelPendingRequest(communityData.id)
|
|
|
|
joinCommunityView.isInvitationPending = root.rootStore.isCommunityRequestPending(communityData.id)
|
|
|
|
}
|
2023-03-07 17:51:06 +01:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: root.rootStore.communitiesModuleInst
|
|
|
|
function onCommunityAccessRequested(communityId: string) {
|
|
|
|
if (communityId === joinCommunityView.communityData.id) {
|
|
|
|
joinCommunityView.isInvitationPending = root.rootStore.isCommunityRequestPending(communityData.id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-16 15:10:58 +01:00
|
|
|
|
|
|
|
CommunityIntroDialog {
|
|
|
|
id: communityIntroDialog
|
|
|
|
|
|
|
|
isInvitationPending: joinCommunityView.isInvitationPending
|
|
|
|
name: communityData.name
|
|
|
|
introMessage: communityData.introMessage
|
|
|
|
imageSrc: communityData.image
|
|
|
|
accessType: communityData.access
|
|
|
|
|
|
|
|
onJoined: {
|
2023-03-24 14:54:59 +01:00
|
|
|
root.rootStore.requestToJoinCommunityWithAuthentication(communityData.id, root.rootStore.userProfileInst.name)
|
2023-03-16 15:10:58 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
onCancelMembershipRequest: {
|
|
|
|
root.rootStore.cancelPendingRequest(communityData.id)
|
|
|
|
joinCommunityView.isInvitationPending = root.rootStore.isCommunityRequestPending(communityData.id)
|
|
|
|
}
|
|
|
|
}
|
2023-03-07 17:34:36 +01:00
|
|
|
}
|
2023-03-07 17:51:06 +01:00
|
|
|
|
2023-03-16 15:10:58 +01:00
|
|
|
|
2023-03-07 17:51:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: chatViewComponent
|
|
|
|
ChatView {
|
|
|
|
id: chatView
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
stickersPopup: root.stickersPopup
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
rootStore: root.rootStore
|
2023-05-04 14:36:35 -04:00
|
|
|
createChatPropertiesStore: root.createChatPropertiesStore
|
2023-03-17 19:58:07 +01:00
|
|
|
sectionItemModel: root.sectionItemModel
|
2023-03-07 17:51:06 +01:00
|
|
|
|
|
|
|
onCommunityInfoButtonClicked: root.currentIndex = 1
|
|
|
|
onCommunityManageButtonClicked: root.currentIndex = 1
|
|
|
|
|
|
|
|
onProfileButtonClicked: {
|
|
|
|
root.profileButtonClicked()
|
|
|
|
}
|
|
|
|
onOpenAppSearch: {
|
|
|
|
root.openAppSearch()
|
|
|
|
}
|
2023-03-07 17:34:36 +01:00
|
|
|
}
|
2021-11-30 15:49:45 +01:00
|
|
|
}
|
|
|
|
|
2022-03-23 16:38:23 +01:00
|
|
|
Loader {
|
2023-04-06 14:11:57 +03:00
|
|
|
id: communitySettingsLoader
|
2022-03-23 16:38:23 +01:00
|
|
|
active: root.rootStore.chatCommunitySectionModule.isCommunity()
|
2021-07-22 17:53:19 +03:00
|
|
|
|
2022-03-23 16:38:23 +01:00
|
|
|
sourceComponent: CommunitySettingsView {
|
2023-04-06 14:11:57 +03:00
|
|
|
id: communitySettingsView
|
2022-03-09 11:27:32 +01:00
|
|
|
rootStore: root.rootStore
|
2023-02-22 18:51:49 +01:00
|
|
|
|
2022-06-06 18:23:24 +03:00
|
|
|
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
2022-03-23 16:38:23 +01:00
|
|
|
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
2023-03-17 19:58:07 +01:00
|
|
|
community: sectionItemModel
|
2022-03-23 16:38:23 +01:00
|
|
|
|
2023-02-07 15:21:32 +01:00
|
|
|
onBackToCommunityClicked: root.currentIndex = 0
|
2022-03-23 16:38:23 +01:00
|
|
|
|
2023-04-06 14:11:57 +03:00
|
|
|
Connections {
|
|
|
|
target: root.rootStore
|
|
|
|
function onGoToMembershipRequestsPage() {
|
|
|
|
root.currentIndex = 1 // go to settings
|
|
|
|
communitySettingsView.goTo(Constants.CommunitySettingsSections.Members, Constants.CommunityMembershipSubSections.MembershipRequests)
|
|
|
|
}
|
|
|
|
}
|
2021-12-14 15:19:55 +01:00
|
|
|
}
|
|
|
|
}
|
2020-05-13 13:27:06 -04:00
|
|
|
}
|