status-desktop/ui/app/AppLayouts/Chat/CommunityComponents/CommunityProfilePopupInviteFriendsView.qml
Pascal Precht 4dab6f9239 refactor(Communities): replace CommunityMembersPopup with CommunityProfilePopup
When right-clicking a community from the navbar and selecting "View community", Status Desktop
opens `CommunityMembersPopup` which looks like it was either never really finished or more of an
intermediate solution until a proper community profile popup was created.

That's why this commit replaces it with a `CommunityProfilePopup` instead.
In fact, this lead to changes in `CommunityProfilePopup` where the `activeCommunity` dependency
is entirely removed, which allows us to use this popup in various places given that it's hydrated
with proper data.

Because we're no longer relying on `activeCommunity` inside that popup, all of its children and
connected popups needed that same refactor as well, hence this PR introduces a few more changes.

Closes #2890
2021-07-20 08:40:29 -04:00

58 lines
1.7 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Dialogs 1.3
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
import StatusQ.Components 0.1
import StatusQ.Popups 0.1
Column {
id: root
property string headerTitle: ""
property var community
property alias contactListSearch: contactFieldAndList
function sendInvites(pubKeys) {
const error = chatsModel.communities.inviteUsersToCommunityById(root.community.id, JSON.stringify(pubKeys))
if (error) {
console.error('Error inviting', error)
contactFieldAndList.validationError = error
return
}
//% "Invite successfully sent"
contactFieldAndList.successMessage = qsTrId("invite-successfully-sent")
}
StatusDescriptionListItem {
title: qsTr("Share community")
subTitle: `${Constants.communityLinkPrefix}${root.community.id.substring(0, 4)}...${root.community.id.substring(root.community.id.length -2)}`
tooltip.text: qsTr("Copy to clipboard")
icon.name: "copy"
iconButton.onClicked: {
let link = `${Constants.communityLinkPrefix}${root.community.id}`
chatsModel.copyToClipboard(link)
tooltip.visible = !tooltip.visible
}
width: parent.width
}
StatusModalDivider {
bottomPadding: 16
}
ContactsListAndSearch {
id: contactFieldAndList
anchors.topMargin: Style.current.smallPadding
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 32
showCheckbox: true
hideCommunityMembers: true
}
}