Community invite flow: dependency on stores reduced
This commit is contained in:
parent
ff5e1654ec
commit
143cf63dc0
|
@ -118,24 +118,22 @@ 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}`
|
|
||||||
|
|
||||||
append({
|
append({
|
||||||
alias: "",
|
alias: "",
|
||||||
colorId: "1",
|
colorId: "1",
|
||||||
displayName: `contact ${i}`,
|
displayName: `contact ${i}`,
|
||||||
ensName: "",
|
ensName: "",
|
||||||
icon: "",
|
icon: "",
|
||||||
isContact: true,
|
isContact: true,
|
||||||
localNickname: "",
|
localNickname: "",
|
||||||
onlineStatus: 1,
|
onlineStatus: 1,
|
||||||
pubKey: key
|
pubKey: key
|
||||||
})
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,28 +65,26 @@ 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 = []
|
|
||||||
|
|
||||||
for (let i = 0; i < 20; i++) {
|
for (let i = 0; i < 20; i++) {
|
||||||
const key = `pub_key_${i}`
|
const key = `pub_key_${i}`
|
||||||
|
|
||||||
append({
|
append({
|
||||||
isContact: true,
|
isContact: true,
|
||||||
onlineStatus: 1,
|
onlineStatus: 1,
|
||||||
displayName: `contact ${i}`,
|
displayName: `contact ${i}`,
|
||||||
icon: "",
|
icon: "",
|
||||||
colorId: "1",
|
colorId: "1",
|
||||||
pubKey: key
|
pubKey: key
|
||||||
})
|
})
|
||||||
|
|
||||||
keys.push(key)
|
keys.push(key)
|
||||||
}
|
|
||||||
|
|
||||||
panel.pubKeys = keys
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
panel.pubKeys = keys
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -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: {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue