2022-03-23 15:38:23 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
2023-03-16 14:10:58 +00:00
|
|
|
import shared.popups 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
import "views"
|
2023-03-07 16:51:06 +00:00
|
|
|
import "views/communities"
|
2021-10-01 15:58:36 +00:00
|
|
|
import "stores"
|
2022-06-21 11:44:20 +00:00
|
|
|
import "popups/community"
|
2020-05-13 17:27:06 +00:00
|
|
|
|
2023-03-07 16:51:06 +00:00
|
|
|
import AppLayouts.Chat.stores 1.0
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
StackLayout {
|
2021-10-21 22:39:53 +00:00
|
|
|
id: root
|
2020-05-27 17:10:50 +00:00
|
|
|
|
2023-02-09 21:49:36 +00:00
|
|
|
property RootStore rootStore
|
|
|
|
readonly property var contactsStore: rootStore.contactsStore
|
2023-03-07 16:51:06 +00:00
|
|
|
readonly property var permissionsStore: rootStore.permissionsStore
|
2021-11-15 15:15:21 +00:00
|
|
|
|
2023-03-17 18:58:07 +00:00
|
|
|
property var sectionItemModel
|
|
|
|
|
2023-03-07 16:34:36 +00:00
|
|
|
property var emojiPopup
|
|
|
|
property var stickersPopup
|
2022-05-10 16:04:25 +00:00
|
|
|
signal importCommunityClicked()
|
|
|
|
signal createCommunityClicked()
|
2023-03-07 16:34:36 +00:00
|
|
|
signal profileButtonClicked()
|
|
|
|
signal openAppSearch()
|
2020-09-23 07:28:20 +00:00
|
|
|
|
2022-11-21 15:46:41 +00:00
|
|
|
onCurrentIndexChanged: {
|
|
|
|
Global.closeCreateChatView()
|
|
|
|
}
|
|
|
|
|
2022-06-21 11:44:20 +00:00
|
|
|
Component {
|
|
|
|
id: membershipRequestPopupComponent
|
|
|
|
MembershipRequestsPopup {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
store: root.rootStore
|
2023-03-17 18:58:07 +00:00
|
|
|
communityData: sectionItemModel
|
2022-06-21 11:44:20 +00:00
|
|
|
onClosed: {
|
|
|
|
destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-07 16:51:06 +00:00
|
|
|
Loader {
|
2022-03-11 18:50:22 +00:00
|
|
|
|
2023-03-07 16:51:06 +00:00
|
|
|
readonly property var chatItem: root.rootStore.chatCommunitySectionModule
|
|
|
|
sourceComponent: chatItem.isCommunity() && chatItem.requiresTokenPermissionToJoin && !chatItem.amIMember ? joinCommunityViewComponent : chatViewComponent
|
|
|
|
}
|
2022-05-10 16:04:25 +00:00
|
|
|
|
2023-03-07 16:51:06 +00:00
|
|
|
Component {
|
|
|
|
id: joinCommunityViewComponent
|
|
|
|
JoinCommunityView {
|
|
|
|
id: joinCommunityView
|
2023-03-17 18:58:07 +00:00
|
|
|
readonly property var communityData: sectionItemModel
|
2023-03-07 16:51:06 +00: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 10:54:47 +00:00
|
|
|
notificationCount: activityCenterStore.unreadNotificationsCount
|
|
|
|
hasUnseenNotifications: activityCenterStore.hasUnseenNotifications
|
|
|
|
openCreateChat: rootStore.openCreateChat
|
2023-03-30 09:42:28 +00:00
|
|
|
loginType: root.rootStore.loginType
|
2023-03-21 10:54:47 +00:00
|
|
|
onNotificationButtonClicked: Global.openActivityCenterPopup()
|
|
|
|
onAdHocChatButtonClicked: rootStore.openCloseCreateChatView()
|
2023-03-16 10:58:39 +00:00
|
|
|
onRevealAddressClicked: {
|
2023-03-16 14:10:58 +00:00
|
|
|
communityIntroDialog.open()
|
2023-03-16 10:58:39 +00:00
|
|
|
}
|
|
|
|
onInvitationPendingClicked: {
|
|
|
|
root.rootStore.cancelPendingRequest(communityData.id)
|
|
|
|
joinCommunityView.isInvitationPending = root.rootStore.isCommunityRequestPending(communityData.id)
|
|
|
|
}
|
2023-03-07 16:51:06 +00: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 14:10:58 +00:00
|
|
|
|
|
|
|
CommunityIntroDialog {
|
|
|
|
id: communityIntroDialog
|
|
|
|
|
|
|
|
isInvitationPending: joinCommunityView.isInvitationPending
|
|
|
|
name: communityData.name
|
|
|
|
introMessage: communityData.introMessage
|
|
|
|
imageSrc: communityData.image
|
|
|
|
accessType: communityData.access
|
|
|
|
|
|
|
|
onJoined: {
|
2023-03-24 13:54:59 +00:00
|
|
|
root.rootStore.requestToJoinCommunityWithAuthentication(communityData.id, root.rootStore.userProfileInst.name)
|
2023-03-16 14:10:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onCancelMembershipRequest: {
|
|
|
|
root.rootStore.cancelPendingRequest(communityData.id)
|
|
|
|
joinCommunityView.isInvitationPending = root.rootStore.isCommunityRequestPending(communityData.id)
|
|
|
|
}
|
|
|
|
}
|
2023-03-07 16:34:36 +00:00
|
|
|
}
|
2023-03-07 16:51:06 +00:00
|
|
|
|
2023-03-16 14:10:58 +00:00
|
|
|
|
2023-03-07 16:51:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: chatViewComponent
|
|
|
|
ChatView {
|
|
|
|
id: chatView
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
stickersPopup: root.stickersPopup
|
|
|
|
contactsStore: root.contactsStore
|
|
|
|
rootStore: root.rootStore
|
2023-03-17 18:58:07 +00:00
|
|
|
sectionItemModel: root.sectionItemModel
|
2023-03-07 16:51:06 +00:00
|
|
|
membershipRequestPopup: membershipRequestPopupComponent
|
|
|
|
|
|
|
|
onCommunityInfoButtonClicked: root.currentIndex = 1
|
|
|
|
onCommunityManageButtonClicked: root.currentIndex = 1
|
|
|
|
|
|
|
|
onImportCommunityClicked: {
|
|
|
|
root.importCommunityClicked();
|
|
|
|
}
|
|
|
|
onCreateCommunityClicked: {
|
|
|
|
root.createCommunityClicked();
|
|
|
|
}
|
|
|
|
onProfileButtonClicked: {
|
|
|
|
root.profileButtonClicked()
|
|
|
|
}
|
|
|
|
onOpenAppSearch: {
|
|
|
|
root.openAppSearch()
|
|
|
|
}
|
2023-03-07 16:34:36 +00:00
|
|
|
}
|
2021-11-30 14:49:45 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
Loader {
|
|
|
|
active: root.rootStore.chatCommunitySectionModule.isCommunity()
|
2021-07-22 14:53:19 +00:00
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
sourceComponent: CommunitySettingsView {
|
2022-03-09 10:27:32 +00:00
|
|
|
rootStore: root.rootStore
|
2023-02-22 17:51:49 +00:00
|
|
|
|
2022-06-06 15:23:24 +00:00
|
|
|
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
2022-03-23 15:38:23 +00:00
|
|
|
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
2023-03-17 18:58:07 +00:00
|
|
|
community: sectionItemModel
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-02-07 14:21:32 +00:00
|
|
|
onBackToCommunityClicked: root.currentIndex = 0
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-02-07 14:21:32 +00:00
|
|
|
// TODO: remove me when migration to new settings is done
|
|
|
|
onOpenLegacyPopupClicked: Global.openCommunityProfilePopupRequested(root.rootStore, community, chatCommunitySectionModule)
|
2021-12-14 14:19:55 +00:00
|
|
|
}
|
|
|
|
}
|
2020-05-13 17:27:06 +00:00
|
|
|
}
|