Community invite flow: dependency on stores reduced

This commit is contained in:
Michał Cieślak 2024-10-28 11:40:58 +01:00 committed by Michał
parent ff5e1654ec
commit 143cf63dc0
8 changed files with 54 additions and 60 deletions

View File

@ -118,8 +118,7 @@ SplitView {
} }
} }
contactsStore: ProfileStores.ContactsStore { contactsModel: ListModel {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: { Component.onCompleted: {
for (let i = 0; i < 20; i++) { for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}` const key = `pub_key_${i}`
@ -138,7 +137,6 @@ SplitView {
} }
} }
} }
}
Component.onCompleted: open() Component.onCompleted: open()
} }

View File

@ -65,8 +65,7 @@ Item {
sourceComponent: ProfilePopupInviteMessagePanel { sourceComponent: ProfilePopupInviteMessagePanel {
id: panel id: panel
contactsStore: ProfileStores.ContactsStore { contactsModel: ListModel {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: { Component.onCompleted: {
const keys = [] const keys = []
@ -92,7 +91,6 @@ Item {
} }
} }
} }
}
// category: Panels // category: Panels

View File

@ -15,7 +15,6 @@ import shared.views 1.0
import shared.status 1.0 import shared.status 1.0
import AppLayouts.stores 1.0 as AppLayoutStores import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Profile.stores 1.0 as ProfileStores
ColumnLayout { ColumnLayout {
id: root id: root
@ -24,7 +23,8 @@ ColumnLayout {
property string headerTitle: "" property string headerTitle: ""
property AppLayoutStores.RootStore rootStore property AppLayoutStores.RootStore rootStore
property ProfileStores.ContactsStore contactsStore
property var contactsModel
property string communityId property string communityId
property var pubKeys: ([]) property var pubKeys: ([])
@ -57,7 +57,8 @@ ColumnLayout {
id: existingContacts id: existingContacts
rootStore: root.rootStore rootStore: root.rootStore
contactsStore: root.contactsStore
contactsModel: root.contactsModel
communityId: root.communityId communityId: root.communityId
hideCommunityMembers: true hideCommunityMembers: true

View File

@ -13,16 +13,13 @@ import shared.panels 1.0
import shared.views 1.0 import shared.views 1.0
import shared.status 1.0 import shared.status 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores
ColumnLayout { ColumnLayout {
id: root id: root
objectName: "CommunityProfilePopupInviteMessagePanel_ColumnLayout" objectName: "CommunityProfilePopupInviteMessagePanel_ColumnLayout"
property var contactsModel
property var pubKeys: ([]) property var pubKeys: ([])
property ProfileStores.ContactsStore contactsStore
property alias inviteMessage: messageInput.text property alias inviteMessage: messageInput.text
spacing: Theme.padding spacing: Theme.padding
@ -62,7 +59,8 @@ ColumnLayout {
PickedContacts { PickedContacts {
id: existingContacts id: existingContacts
contactsStore: root.contactsStore
contactsModel: root.contactsModel
pubKeys: root.pubKeys pubKeys: root.pubKeys
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true

View File

@ -17,7 +17,8 @@ StatusStackModal {
id: root id: root
property AppLayoutStores.RootStore rootStore property AppLayoutStores.RootStore rootStore
property ProfileStores.ContactsStore contactsStore
property var contactsModel
property var community property var community
property var communitySectionModule property var communitySectionModule
@ -95,13 +96,15 @@ StatusStackModal {
stackItems: [ stackItems: [
ProfilePopupInviteFriendsPanel { ProfilePopupInviteFriendsPanel {
rootStore: root.rootStore rootStore: root.rootStore
contactsStore: root.contactsStore
contactsModel: root.contactsModel
communityId: root.community.id communityId: root.community.id
onPubKeysChanged: root.pubKeys = pubKeys onPubKeysChanged: root.pubKeys = pubKeys
}, },
ProfilePopupInviteMessagePanel { ProfilePopupInviteMessagePanel {
contactsStore: root.contactsStore contactsModel: root.contactsModel
pubKeys: root.pubKeys pubKeys: root.pubKeys
onInviteMessageChanged: root.inviteMessage = inviteMessage onInviteMessageChanged: root.inviteMessage = inviteMessage
} }

View File

@ -440,7 +440,7 @@ QtObject {
InviteFriendsToCommunityPopup { InviteFriendsToCommunityPopup {
rootStore: root.rootStore rootStore: root.rootStore
contactsStore: root.rootStore.contactStore contactsModel: root.rootStore.contactStore.myContactsModel
onClosed: destroy() onClosed: destroy()
} }
}, },

View File

@ -13,7 +13,6 @@ import shared.stores 1.0
// TODO move Contact into shared to get rid of that import // TODO move Contact into shared to get rid of that import
import AppLayouts.Chat.controls 1.0 import AppLayouts.Chat.controls 1.0
import AppLayouts.stores 1.0 as AppLayoutStores import AppLayouts.stores 1.0 as AppLayoutStores
import AppLayouts.Profile.stores 1.0 as ProfileStores
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
@ -21,7 +20,8 @@ Item {
id: root id: root
property AppLayoutStores.RootStore rootStore property AppLayoutStores.RootStore rootStore
property ProfileStores.ContactsStore contactsStore
property var contactsModel
property string communityId property string communityId
property string filterText: "" property string filterText: ""
@ -51,7 +51,7 @@ Item {
spacing: Theme.padding spacing: Theme.padding
model: SortFilterProxyModel { model: SortFilterProxyModel {
sourceModel: root.contactsStore.myContactsModel sourceModel: root.contactsModel
filters: [ filters: [
ExpressionFilter { ExpressionFilter {
expression: { expression: {

View File

@ -7,15 +7,13 @@ import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1 import StatusQ.Core.Theme 0.1
import utils 1.0 import utils 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
Item { Item {
id: root id: root
property ProfileStores.ContactsStore contactsStore property var contactsModel
property var pubKeys: ([]) property var pubKeys: ([])
readonly property alias count: contactGridView.count readonly property alias count: contactGridView.count
@ -28,13 +26,11 @@ Item {
cellHeight: 2 * Theme.xlPadding + Theme.halfPadding cellHeight: 2 * Theme.xlPadding + Theme.halfPadding
model: SortFilterProxyModel { model: SortFilterProxyModel {
sourceModel: root.contactsStore.myContactsModel sourceModel: root.contactsModel
filters: [ filters: FastExpressionFilter {
FastExpressionFilter {
expression: root.pubKeys.indexOf(model.pubKey) > -1 expression: root.pubKeys.indexOf(model.pubKey) > -1
expectedRoles: ["pubKey"] expectedRoles: ["pubKey"]
} }
]
} }
delegate: StatusMemberListItem { delegate: StatusMemberListItem {