diff --git a/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml b/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml index 96255fac7e..e1a6f9a877 100644 --- a/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml +++ b/ui/app/AppLayouts/Profile/panels/CommunitiesListPanel.qml @@ -15,7 +15,9 @@ StatusListView { property bool hasAddedContacts: false signal inviteFriends(var communityData) - signal leaveCommunityClicked(var communityId) + signal leaveCommunityClicked(string communityId) + signal setCommunityMutedClicked(string communityId, bool muted) + signal setActiveCommunityClicked(string communityId) interactive: false implicitHeight: contentItem.childrenRect.height @@ -36,6 +38,10 @@ StatusListView { sensor.hoverEnabled: false + onClicked: { + setActiveCommunityClicked(model.id) + } + components: [ StatusFlatButton { size: StatusBaseButton.Size.Small @@ -55,7 +61,7 @@ StatusListView { height: 44 icon.source: model.muted ? Style.svg("communities/notifications-muted") : Style.svg("communities/notifications") - onClicked: root.communityProfileModule.setCommunityMuted(model.id, !model.muted) + onClicked: root.setCommunityMutedClicked(model.id, !model.muted) }, StatusFlatRoundButton { @@ -70,8 +76,10 @@ StatusListView { property Component leaveCommunityPopup: StatusModal { id: leavePopup + property string community: "" - property var communityId + property string communityId: "" + anchors.centerIn: parent header.title: qsTr("Leave %1").arg(community) contentItem: Item { diff --git a/ui/app/AppLayouts/Profile/views/CommunitiesView.qml b/ui/app/AppLayouts/Profile/views/CommunitiesView.qml index 2c2dd3d43f..435fa63274 100644 --- a/ui/app/AppLayouts/Profile/views/CommunitiesView.qml +++ b/ui/app/AppLayouts/Profile/views/CommunitiesView.qml @@ -55,14 +55,24 @@ SettingsContentBase { CommunitiesListPanel { width: parent.width model: root.profileSectionStore.communitiesList + onLeaveCommunityClicked: { - root.profileSectionStore.communitiesProfileModule.leaveCommunity(leavePopup.communityId) + root.profileSectionStore.communitiesProfileModule.leaveCommunity(communityId) } + + onSetCommunityMutedClicked: { + root.profileSectionStore.communitiesProfileModule.setCommunityMuted(communityId, muted) + } + + onSetActiveCommunityClicked: { + rootStore.setActiveCommunity(communityId) + } + onInviteFriends: { Global.openPopup(inviteFriendsToCommunityPopup, { community: communityData, hasAddedContacts: root.contactStore.myContactsModel.count > 0, - communitySectionModule: communityProfileModule + communitySectionModule: root.profileSectionStore.communitiesProfileModule }) } } @@ -87,7 +97,8 @@ SettingsContentBase { } onSendInvites: { - const error = communitySectionModule.inviteUsersToCommunity(communty.id, JSON.stringify(pubKeys)) + const error = root.profileSectionStore.communitiesProfileModule.inviteUsersToCommunity( + community.id, JSON.stringify(pubKeys)) processInviteResult(error) } } diff --git a/ui/app/AppLayouts/stores/RootStore.qml b/ui/app/AppLayouts/stores/RootStore.qml index 81cb4d9a6f..39bff13f04 100644 --- a/ui/app/AppLayouts/stores/RootStore.qml +++ b/ui/app/AppLayouts/stores/RootStore.qml @@ -166,4 +166,8 @@ QtObject { mainModuleInst.setCurrentUserStatus(newStatus) } } + + function setActiveCommunity(communityId) { + mainModule.setActiveSectionById(communityId); + } }