2020-12-11 20:38:10 +00:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
import QtQml.Models 2.3
|
2021-07-21 09:49:03 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Popups 0.1
|
|
|
|
|
2021-09-28 15:04:06 +00:00
|
|
|
import utils 1.0
|
2021-10-01 15:58:36 +00:00
|
|
|
|
|
|
|
import "../../views"
|
|
|
|
import "../../panels/communities"
|
2020-12-11 20:38:10 +00:00
|
|
|
|
2021-07-21 09:49:03 +00:00
|
|
|
StatusModal {
|
2020-12-11 20:38:10 +00:00
|
|
|
id: popup
|
|
|
|
|
2022-01-10 16:44:54 +00:00
|
|
|
property var rootStore
|
|
|
|
property var contactsStore
|
2021-07-21 09:49:03 +00:00
|
|
|
property var community
|
2022-01-19 20:07:02 +00:00
|
|
|
property var communitySectionModule
|
2021-10-22 20:49:47 +00:00
|
|
|
property bool hasAddedContacts
|
2020-12-11 20:38:10 +00:00
|
|
|
|
2022-03-23 10:56:25 +00:00
|
|
|
signal sendInvites(var pubKeys)
|
|
|
|
|
2020-12-11 20:38:10 +00:00
|
|
|
onOpened: {
|
2021-10-22 20:49:47 +00:00
|
|
|
contentItem.community = community;
|
2021-07-21 09:49:03 +00:00
|
|
|
|
2021-10-22 20:49:47 +00:00
|
|
|
contentItem.contactListSearch.chatKey.text = "";
|
|
|
|
contentItem.contactListSearch.pubKey = "";
|
|
|
|
contentItem.contactListSearch.pubKeys = [];
|
|
|
|
contentItem.contactListSearch.ensUsername = "";
|
|
|
|
contentItem.contactListSearch.chatKey.forceActiveFocus(Qt.MouseFocusReason);
|
|
|
|
contentItem.contactListSearch.existingContacts.visible = hasAddedContacts;
|
|
|
|
contentItem.contactListSearch.noContactsRect.visible = !contentItem.contactListSearch.existingContacts.visible;
|
2020-12-11 20:38:10 +00:00
|
|
|
}
|
|
|
|
|
2022-06-20 13:27:00 +00:00
|
|
|
margins: 32
|
|
|
|
height: 550
|
|
|
|
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Invite friends"
|
2021-07-21 09:49:03 +00:00
|
|
|
header.title: qsTrId("invite-friends")
|
2021-03-31 19:14:09 +00:00
|
|
|
|
2022-06-21 11:44:20 +00:00
|
|
|
function processInviteResult(error) {
|
2022-03-23 10:56:25 +00:00
|
|
|
if (error) {
|
|
|
|
console.error('Error inviting', error)
|
|
|
|
contactFieldAndList.validationError = error
|
|
|
|
return
|
|
|
|
}
|
|
|
|
//% "Invite successfully sent"
|
|
|
|
popup.contentItem.contactListSearch.successMessage = qsTrId("invite-successfully-sent")
|
|
|
|
}
|
|
|
|
|
2021-10-01 15:58:36 +00:00
|
|
|
contentItem: CommunityProfilePopupInviteFriendsPanel {
|
2021-04-20 12:31:36 +00:00
|
|
|
id: contactFieldAndList
|
2022-01-10 16:44:54 +00:00
|
|
|
rootStore: popup.rootStore
|
|
|
|
contactsStore: popup.contactsStore
|
|
|
|
community: popup.community
|
2020-12-11 20:38:10 +00:00
|
|
|
}
|
|
|
|
|
2021-07-21 09:49:03 +00:00
|
|
|
leftButtons: [
|
2020-12-11 20:38:10 +00:00
|
|
|
StatusRoundButton {
|
|
|
|
icon.name: "arrow-right"
|
|
|
|
icon.height: 16
|
2021-07-21 09:49:03 +00:00
|
|
|
icon.width: 20
|
2020-12-11 20:38:10 +00:00
|
|
|
rotation: 180
|
|
|
|
onClicked: {
|
2021-07-21 09:49:03 +00:00
|
|
|
popup.close()
|
2020-12-11 20:38:10 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-21 09:49:03 +00:00
|
|
|
]
|
2020-12-11 20:38:10 +00:00
|
|
|
|
2021-07-21 09:49:03 +00:00
|
|
|
rightButtons: [
|
2020-12-11 20:38:10 +00:00
|
|
|
StatusButton {
|
2021-09-07 13:45:00 +00:00
|
|
|
enabled: popup.contentItem.contactListSearch.pubKeys.length > 0
|
2021-02-18 16:36:05 +00:00
|
|
|
//% "Invite"
|
|
|
|
text: qsTrId("invite-button")
|
2020-12-11 20:38:10 +00:00
|
|
|
onClicked : {
|
2022-03-23 10:56:25 +00:00
|
|
|
popup.sendInvites(popup.contentItem.contactListSearch.pubKeys)
|
2020-12-11 20:38:10 +00:00
|
|
|
}
|
|
|
|
}
|
2021-07-21 09:49:03 +00:00
|
|
|
]
|
2020-12-11 20:38:10 +00:00
|
|
|
}
|
|
|
|
|