diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index 8823183c62..35a7a8d2f2 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -87,13 +87,16 @@ StatusAppThreePanelLayout { return chatContentModule.chatDetails.isUsersListAvailable } - rightPanel: localAccountSensitiveSettings.communitiesEnabled && root.rootStore.chatCommunitySectionModule.isCommunity()? - communityUserListComponent : - userListComponent + rightPanel: userListComponent Component { - id: communityUserListComponent - CommunityUserListPanel { + id: userListComponent + UserListPanel { + label: localAccountSensitiveSettings.communitiesEnabled && + root.rootStore.chatCommunitySectionModule.isCommunity() ? + //% "Members" + qsTrId("members-label") : + qsTr("Last seen") messageContextMenu: quickActionMessageOptionsMenu usersModule: { let chatContentModule = root.rootStore.currentChatContentModule() @@ -106,17 +109,6 @@ StatusAppThreePanelLayout { } } - Component { - id: userListComponent - UserListPanel { - messageContextMenu: quickActionMessageOptionsMenu - usersModule: { - let chatContentModule = root.rootStore.currentChatContentModule() - return chatContentModule.usersModule - } - } - } - Component { id: contactsColumnComponent ContactsColumnView { diff --git a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml index 0c1ec551d4..2ec18c06dc 100644 --- a/ui/app/AppLayouts/Chat/panels/UserListPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/UserListPanel.qml @@ -4,9 +4,12 @@ import shared 1.0 import shared.panels 1.0 import shared.status 1.0 +import utils 1.0 + import "../controls" -import utils 1.0 +import StatusQ.Core 0.1 +import StatusQ.Core.Theme 0.1 Item { id: root @@ -17,8 +20,9 @@ Item { // usersModule on the backend contains everything needed for this component property var usersModule property var messageContextMenu + property string label - StyledText { + StatusBaseText { id: titleText anchors.top: parent.top anchors.topMargin: Style.current.padding @@ -27,8 +31,9 @@ Item { opacity: (root.width > 58) ? 1.0 : 0.0 visible: (opacity > 0.1) font.pixelSize: Style.current.primaryTextFontSize - //% "Members" - text: qsTr("Last seen") + font.weight: Font.Medium + color: Theme.palette.directColor1 + text: root.label } ListView { @@ -55,5 +60,30 @@ Item { userStatus: model.onlineStatus messageContextMenu: root.messageContextMenu } + section.property: "onlineStatus" + section.delegate: (root.width > 58) ? sectionDelegateComponent : null + } + + Component { + id: sectionDelegateComponent + Item { + width: parent.width + height: 24 + StyledText { + anchors.fill: parent + anchors.leftMargin: Style.current.padding + verticalAlignment: Text.AlignVCenter + font.pixelSize: Style.current.additionalTextSize + color: Theme.palette.baseColor1 + text: { + switch(parseInt(section)) { + case Constants.userStatus.offline: return qsTr("Offline") + case Constants.userStatus.online: return qsTr("Online") + case Constants.userStatus.doNotDisturb: return qsTr("Do not disturb") + case Constants.userStatus.idle: return qsTr("Idle") + } + } + } + } } } diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityUserListPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityUserListPanel.qml deleted file mode 100644 index 13a80c43d0..0000000000 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityUserListPanel.qml +++ /dev/null @@ -1,89 +0,0 @@ -import QtQuick 2.13 -import QtQuick.Controls 2.13 -import shared 1.0 -import shared.panels 1.0 -import shared.status 1.0 - -import utils 1.0 - -import "../../controls" - -import StatusQ.Core 0.1 -import StatusQ.Core.Theme 0.1 - -Item { - id: root - anchors.fill: parent - - // Important: - // Each chat/channel has its own ChatContentModule and each ChatContentModule has a single usersModule - // usersModule on the backend contains everything needed for this component - property var usersModule - property var messageContextMenu - - StatusBaseText { - id: titleText - anchors.top: parent.top - anchors.topMargin: Style.current.padding - anchors.left: parent.left - anchors.leftMargin: Style.current.padding - opacity: (root.width > 58) ? 1.0 : 0.0 - visible: (opacity > 0.1) - font.pixelSize: Style.current.primaryTextFontSize - font.weight: Font.Medium - color: Theme.palette.directColor1 - //% "Members" - text: qsTrId("members-label") - } - - ListView { - id: userListView - clip: true - ScrollBar.vertical: ScrollBar { - policy: ScrollBar.AsNeeded - } - anchors { - top: titleText.bottom - topMargin: Style.current.padding - left: parent.left - right: parent.right - bottom: parent.bottom - bottomMargin: Style.current.bigPadding - } - boundsBehavior: Flickable.StopAtBounds - model: usersModule.model - delegate: UserDelegate { - publicKey: model.id - name: model.name - icon: model.icon - isIdenticon: model.isIdenticon - userStatus: model.onlineStatus - messageContextMenu: root.messageContextMenu - } - section.property: "onlineStatus" - section.delegate: (root.width > 58) ? sectionDelegateComponent : null - } - - Component { - id: sectionDelegateComponent - Item { - width: parent.width - height: 24 - StyledText { - anchors.fill: parent - anchors.leftMargin: Style.current.padding - verticalAlignment: Text.AlignVCenter - font.pixelSize: Style.current.additionalTextSize - color: Theme.palette.baseColor1 - text: { - switch(parseInt(section)) { - case Constants.userStatus.offline: return qsTr("Offline") - case Constants.userStatus.online: return qsTr("Online") - case Constants.userStatus.doNotDisturb: return qsTr("Do not disturb") - case Constants.userStatus.idle: return qsTr("Idle") - } - } - } - } - } -}