mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-28 15:26:10 +00:00
dcb0f4dce9
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.
76 lines
2.2 KiB
QML
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)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|