status-desktop/ui/app/AppLayouts/Chat/CommunityComponents/InviteFriendsToCommunityPopup.qml
Pascal Precht dcb0f4dce9 fix(Communities): make invite popup push onto modal stackview
The popup to invite friends to communities has so far always been a brand new
popup that's opened on top of possible existing popups.

The design however, expects that the same section should be shown as part
of a wizard-like process inside of the existing community profile overview
popup, when entered from there.

This commit extracts the invite friends popup section into component that
can be reused as stack view, as well as modal content, to implement both
scenarios.
2021-04-20 13:24:08 -04:00

76 lines
2.2 KiB
QML

import QtQuick 2.12
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import QtQml.Models 2.3
import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
import "./"
import "../components"
ModalPopup {
id: popup
property string communityId: chatsModel.communities.activeCommunity.id
property var goBack
onOpened: {
contactFieldAndList.contactListSearch.chatKey.text = ""
contactFieldAndList.contactListSearch.pubKey = ""
contactFieldAndList.contactListSearch.pubKeys = []
contactFieldAndList.contactListSearch.ensUsername = ""
contactFieldAndList.contactListSearch.chatKey.forceActiveFocus(Qt.MouseFocusReason)
contactFieldAndList.contactListSearch.existingContacts.visible = profileModel.contacts.list.hasAddedContacts()
contactFieldAndList.contactListSearch.noContactsRect.visible = !contactFieldAndList.contactListSearch.existingContacts.visible
}
//% "Invite friends"
title: qsTrId("invite-friends")
height: 630
CommunityProfilePopupInviteFriendsView {
id: contactFieldAndList
anchors.fill: parent
contactListSearch.onUserClicked: {
if (isContact) {
// those are just added to the list to by added by the bunch
return
}
contactFieldAndList.sendInvites([pubKey])
}
}
footer: Item {
width: parent.width
height: inviteBtn.height
StatusRoundButton {
id: btnBack
anchors.left: parent.left
visible: !!popup.goBack
icon.name: "arrow-right"
icon.width: 20
icon.height: 16
rotation: 180
onClicked: {
// Go back? Make it work when it's
popup.goBack()
}
}
StatusButton {
id: inviteBtn
anchors.bottom: parent.bottom
anchors.right: parent.right
enabled: contactFieldAndList.contactListSearch.pubKeys.length > 0
//% "Invite"
text: qsTrId("invite-button")
onClicked : {
contactFieldAndList.sendInvites(contactFieldAndList.contactListSearch.pubKeys)
}
}
}
}