status-desktop/ui/app/AppLayouts/Communities/popups/CommunityMemberMessagesPopup.qml
Lukáš Tinkl 3281e841db fix: Optimize ContactsView & MembersTabPanel settings pages
- removed nested ListViews inside StackLayouts, in order to reduce the
memory footprint and improve performance, and also to be able to better
manage the scrolling
- no more unrolled multiple listviews, which again hurt the performance;
now the views instantiate the delegates dynamically on the fly
- the tab bar and the search fields now stick to the top of the page,
with the users list view scrolling independently
- both views now uniformly use the common `ContactListItemDelegate`
- the received/sent CRs are now combined into one `pendingContacts`
model
- factored out common search/filter criteria into a new, separate SFPM
`UserFilterContainer` component
- fix an issue where StatusContactVerificationIcons wasn't properly
displaying the "blocked" state/icon
- fix documentation comments, removed relative imports, and updated some

Fixes #16612
Fixes #16958
2025-01-14 10:31:58 +01:00

149 lines
5.7 KiB
QML

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQml.Models 2.15
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
import StatusQ.Popups.Dialog 0.1
import utils 1.0
import shared.views.chat 1.0
import shared.stores 1.0 as SharedStores
import AppLayouts.Chat.stores 1.0 as ChatStores
StatusDialog {
id: root
property SharedStores.RootStore sharedRootStore
property SharedStores.UtilsStore utilsStore
property ChatStores.RootStore rootStore
property var chatCommunitySectionModule
property var memberMessagesModel: chatCommunitySectionModule.memberMessagesModel
property string memberPubKey: ""
property string displayName: ""
width: 800
title: qsTr("%1 messages").arg(root.displayName)
subtitle: qsTr("%n message(s)", "", root.memberMessagesModel.count)
ColumnLayout {
anchors.fill: parent
id: column
StatusBaseText {
visible: communityMemberMessageListView.count === 0
text: qsTr("No messages")
Layout.alignment: Qt.AlignCenter
verticalAlignment: Text.AlignVCenter
color: Theme.palette.secondaryText
Layout.topMargin: 40
Layout.bottomMargin: 40
}
StatusListView {
id: communityMemberMessageListView
model: root.memberMessagesModel
Layout.fillWidth: true
Layout.fillHeight: count
implicitHeight: contentHeight
delegate: Item {
id: messageDelegate
width: ListView.view.width
height: messageItem.height
MessageView {
id: messageItem
width: parent.width
sharedRootStore: root.sharedRootStore
utilsStore: root.utilsStore
rootStore: root.rootStore
chatCommunitySectionModule: root.chatCommunitySectionModule
messageStore: root.rootStore.messageStore
messageId: model.id
chatId: model.chatId
responseToMessageWithId: model.responseToMessageWithId
amIChatAdmin: true
senderId: model.senderId
senderDisplayName: model.senderDisplayName
senderOptionalName: model.senderOptionalName
senderIsEnsVerified: model.senderEnsVerified
senderIsAdded: model.senderIsAdded
senderIcon: model.senderIcon
senderColorHash: model.senderColorHash
senderTrustStatus: model.senderTrustStatus
amISender: model.amISender
messageText: model.messageText
messageImage: model.messageImage
messageTimestamp: model.timestamp
messageOutgoingStatus: model.outgoingStatus
messageContentType: model.contentType
pinnedMessage: model.pinned
messagePinnedBy: model.pinnedBy
sticker: model.sticker
stickerPack: model.stickerPack
linkPreviewModel: model.linkPreviewModel
links: model.links
transactionParams: model.transactionParameters
quotedMessageText: model.quotedMessageParsedText
quotedMessageFrom: model.quotedMessageFrom
quotedMessageContentType: model.quotedMessageContentType
quotedMessageDeleted: model.quotedMessageDeleted
quotedMessageAuthorDetailsName: model.quotedMessageAuthorName
quotedMessageAuthorDetailsDisplayName: model.quotedMessageAuthorDisplayName
quotedMessageAuthorDetailsThumbnailImage: model.quotedMessageAuthorThumbnailImage
quotedMessageAuthorDetailsEnsVerified: model.quotedMessageAuthorEnsVerified
quotedMessageAuthorDetailsIsContact: model.quotedMessageAuthorIsContact
quotedMessageAuthorDetailsColorHash: model.quotedMessageAuthorColorHash
bridgeName: model.bridgeName
isViewMemberMessagesePopup: true
shouldRepeatHeader: true
}
MouseArea {
id: mouseArea
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
root.chatCommunitySectionModule.openCommunityChatAndScrollToMessage(model.chatId, model.id)
Global.switchToCommunityChannelsView(root.chatCommunitySectionModule.getMySectionId())
root.chatCommunitySectionModule.openCommunityChatAndScrollToMessage(model.chatId, model.id)
root.closed()
}
}
}
}
}
footer: StatusDialogFooter {
id: footer
rightButtons: ObjectModel {
StatusFlatButton {
text: qsTr("Delete all messages by %1").arg(root.displayName)
enabled: communityMemberMessageListView.count > 0
type: StatusBaseButton.Type.Danger
onClicked: {
root.chatCommunitySectionModule.deleteCommunityMemberMessages(root.memberPubKey, "", "")
}
borderColor: "transparent"
}
StatusButton {
text: qsTr("Done")
onClicked: root.close()
}
}
}
}