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,24 +118,22 @@ SplitView {
}
}
contactsStore: ProfileStores.ContactsStore {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}`
contactsModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}`
append({
alias: "",
colorId: "1",
displayName: `contact ${i}`,
ensName: "",
icon: "",
isContact: true,
localNickname: "",
onlineStatus: 1,
pubKey: key
})
}
append({
alias: "",
colorId: "1",
displayName: `contact ${i}`,
ensName: "",
icon: "",
isContact: true,
localNickname: "",
onlineStatus: 1,
pubKey: key
})
}
}
}

View File

@ -65,28 +65,26 @@ Item {
sourceComponent: ProfilePopupInviteMessagePanel {
id: panel
contactsStore: ProfileStores.ContactsStore {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
const keys = []
contactsModel: ListModel {
Component.onCompleted: {
const keys = []
for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}`
for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}`
append({
isContact: true,
onlineStatus: 1,
displayName: `contact ${i}`,
icon: "",
colorId: "1",
pubKey: key
})
append({
isContact: true,
onlineStatus: 1,
displayName: `contact ${i}`,
icon: "",
colorId: "1",
pubKey: key
})
keys.push(key)
}
panel.pubKeys = keys
keys.push(key)
}
panel.pubKeys = keys
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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