fix(Communities): use `StatusModal` in `InviteFriendsToCommunityPopup`
This refactors the popup to use StatusQ APIs and also fixes a bug where the inner view isn't properly hydrated with community data. Fixes #2998
This commit is contained in:
parent
5b05bef3d5
commit
aa3c68ec3d
|
@ -66,7 +66,9 @@ Item {
|
||||||
text: qsTrId("invite-people")
|
text: qsTrId("invite-people")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
enabled: chatsModel.communities.activeCommunity.canManageUsers
|
enabled: chatsModel.communities.activeCommunity.canManageUsers
|
||||||
onTriggered: openPopup(inviteFriendsToCommunityPopup, {communityId: chatsModel.communities.activeCommunity.id})
|
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
|
||||||
|
community: chatsModel.communities.activeCommunity
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,7 +163,9 @@ Item {
|
||||||
text: qsTrId("invite-people")
|
text: qsTrId("invite-people")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
enabled: chatsModel.communities.activeCommunity.canManageUsers
|
enabled: chatsModel.communities.activeCommunity.canManageUsers
|
||||||
onTriggered: openPopup(inviteFriendsToCommunityPopup, {communityId: chatsModel.communities.activeCommunity.id})
|
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
|
||||||
|
community: chatsModel.communities.activeCommunity
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ Column {
|
||||||
|
|
||||||
StatusDescriptionListItem {
|
StatusDescriptionListItem {
|
||||||
title: qsTr("Share community")
|
title: qsTr("Share community")
|
||||||
subTitle: `${Constants.communityLinkPrefix}${root.community.id.substring(0, 4)}...${root.community.id.substring(root.community.id.length -2)}`
|
subTitle: `${Constants.communityLinkPrefix}${root.community && root.community.id.substring(0, 4)}...${root.community && root.community.id.substring(root.community.id.length -2)}`
|
||||||
tooltip.text: qsTr("Copy to clipboard")
|
tooltip.text: qsTr("Copy to clipboard")
|
||||||
icon.name: "copy"
|
icon.name: "copy"
|
||||||
iconButton.onClicked: {
|
iconButton.onClicked: {
|
||||||
|
|
|
@ -76,7 +76,9 @@ Rectangle {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
anchors.bottom: manageBtn.top
|
anchors.bottom: manageBtn.top
|
||||||
anchors.bottomMargin: Style.current.halfPadding
|
anchors.bottomMargin: Style.current.halfPadding
|
||||||
onClicked: openPopup(inviteFriendsToCommunityPopup)
|
onClicked: openPopup(inviteFriendsToCommunityPopup, {
|
||||||
|
community: chatsModel.communities.activeCommunity
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusButton {
|
StatusButton {
|
||||||
|
|
|
@ -2,36 +2,37 @@ import QtQuick 2.12
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Layouts 1.3
|
import QtQuick.Layouts 1.3
|
||||||
import QtQml.Models 2.3
|
import QtQml.Models 2.3
|
||||||
|
|
||||||
|
import StatusQ.Controls 0.1
|
||||||
|
import StatusQ.Components 0.1
|
||||||
|
import StatusQ.Popups 0.1
|
||||||
|
|
||||||
import "../../../../imports"
|
import "../../../../imports"
|
||||||
import "../../../../shared"
|
import "../../../../shared"
|
||||||
import "../../../../shared/status"
|
|
||||||
import "./"
|
|
||||||
import "../components"
|
import "../components"
|
||||||
|
|
||||||
ModalPopup {
|
StatusModal {
|
||||||
id: popup
|
id: popup
|
||||||
|
|
||||||
property string communityId: chatsModel.communities.activeCommunity.id
|
property var community
|
||||||
property var goBack
|
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
contactFieldAndList.contactListSearch.chatKey.text = ""
|
contentComponent.community = community
|
||||||
contactFieldAndList.contactListSearch.pubKey = ""
|
|
||||||
contactFieldAndList.contactListSearch.pubKeys = []
|
contentComponent.contactListSearch.chatKey.text = ""
|
||||||
contactFieldAndList.contactListSearch.ensUsername = ""
|
contentComponent.contactListSearch.pubKey = ""
|
||||||
contactFieldAndList.contactListSearch.chatKey.forceActiveFocus(Qt.MouseFocusReason)
|
contentComponent.contactListSearch.pubKeys = []
|
||||||
contactFieldAndList.contactListSearch.existingContacts.visible = profileModel.contacts.list.hasAddedContacts()
|
contentComponent.contactListSearch.ensUsername = ""
|
||||||
contactFieldAndList.contactListSearch.noContactsRect.visible = !contactFieldAndList.contactListSearch.existingContacts.visible
|
contentComponent.contactListSearch.chatKey.forceActiveFocus(Qt.MouseFocusReason)
|
||||||
|
contentComponent.contactListSearch.existingContacts.visible = profileModel.contacts.list.hasAddedContacts()
|
||||||
|
contentComponent.contactListSearch.noContactsRect.visible = !contentComponent.contactListSearch.existingContacts.visible
|
||||||
}
|
}
|
||||||
|
|
||||||
//% "Invite friends"
|
//% "Invite friends"
|
||||||
title: qsTrId("invite-friends")
|
header.title: qsTrId("invite-friends")
|
||||||
|
|
||||||
height: 630
|
content: CommunityProfilePopupInviteFriendsView {
|
||||||
|
|
||||||
CommunityProfilePopupInviteFriendsView {
|
|
||||||
id: contactFieldAndList
|
id: contactFieldAndList
|
||||||
anchors.fill: parent
|
|
||||||
contactListSearch.onUserClicked: {
|
contactListSearch.onUserClicked: {
|
||||||
if (isContact) {
|
if (isContact) {
|
||||||
// those are just added to the list to by added by the bunch
|
// those are just added to the list to by added by the bunch
|
||||||
|
@ -41,35 +42,27 @@ ModalPopup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: Item {
|
leftButtons: [
|
||||||
width: parent.width
|
|
||||||
height: inviteBtn.height
|
|
||||||
|
|
||||||
StatusRoundButton {
|
StatusRoundButton {
|
||||||
id: btnBack
|
|
||||||
anchors.left: parent.left
|
|
||||||
visible: !!popup.goBack
|
|
||||||
icon.name: "arrow-right"
|
icon.name: "arrow-right"
|
||||||
icon.width: 20
|
|
||||||
icon.height: 16
|
icon.height: 16
|
||||||
|
icon.width: 20
|
||||||
rotation: 180
|
rotation: 180
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// Go back? Make it work when it's
|
popup.close()
|
||||||
popup.goBack()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
rightButtons: [
|
||||||
StatusButton {
|
StatusButton {
|
||||||
id: inviteBtn
|
enabled: popup.contentComponent.contactListSearch.pubKeys.length > 0
|
||||||
anchors.bottom: parent.bottom
|
|
||||||
anchors.right: parent.right
|
|
||||||
enabled: contactFieldAndList.contactListSearch.pubKeys.length > 0
|
|
||||||
//% "Invite"
|
//% "Invite"
|
||||||
text: qsTrId("invite-button")
|
text: qsTrId("invite-button")
|
||||||
onClicked : {
|
onClicked : {
|
||||||
contactFieldAndList.sendInvites(contactFieldAndList.contactListSearch.pubKeys)
|
popup.contentComponent.sendInvites(popup.contentComponent.contactListSearch.pubKeys)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,9 @@ StatusAppLayout {
|
||||||
text: qsTrId("invite-people")
|
text: qsTrId("invite-people")
|
||||||
icon.name: "share-ios"
|
icon.name: "share-ios"
|
||||||
enabled: chatsModel.communities.observedCommunity.canManageUsers
|
enabled: chatsModel.communities.observedCommunity.canManageUsers
|
||||||
onTriggered: openPopup(inviteFriendsToCommunityPopup, { communityId: model.id })
|
onTriggered: openPopup(inviteFriendsToCommunityPopup, {
|
||||||
|
community: chatsModel.communities.observedCommunity
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusMenuItem {
|
StatusMenuItem {
|
||||||
|
|
Loading…
Reference in New Issue