From b1025fabd7d64adaf8ba4d5c45ac14ac64d168a7 Mon Sep 17 00:00:00 2001 From: Patryk Osmaczko Date: Fri, 9 Sep 2022 13:27:23 +0200 Subject: [PATCH] feat(StatusChatListItem): add online badge --- src/StatusQ/Components/StatusChatList.qml | 1 + src/StatusQ/Components/StatusChatListItem.qml | 15 +++++++++++++++ src/StatusQ/Components/StatusSmartIdenticon.qml | 2 ++ 3 files changed, 18 insertions(+) diff --git a/src/StatusQ/Components/StatusChatList.qml b/src/StatusQ/Components/StatusChatList.qml index a39e1963..8df2d903 100644 --- a/src/StatusQ/Components/StatusChatList.qml +++ b/src/StatusQ/Components/StatusChatList.qml @@ -123,6 +123,7 @@ Column { asset.isImage: model.icon.includes("data") asset.name: model.icon ringSettings.ringSpecModel: model.colorHash + onlineStatus: model.onlineStatus sensor.cursorShape: dragSensor.cursorShape diff --git a/src/StatusQ/Components/StatusChatListItem.qml b/src/StatusQ/Components/StatusChatListItem.qml index 386cbd80..292f627e 100644 --- a/src/StatusQ/Components/StatusChatListItem.qml +++ b/src/StatusQ/Components/StatusChatListItem.qml @@ -21,6 +21,7 @@ Rectangle { property bool hasUnreadMessages: false property int notificationsCount: 0 property bool muted: false + property int onlineStatus: StatusChatListItem.OnlineStatus.Inactive property StatusAssetSettings asset: StatusAssetSettings { width: 24 @@ -50,6 +51,11 @@ Rectangle { CommunityChat // 6 } + enum OnlineStatus { + Inactive, + Online + } + implicitWidth: 288 implicitHeight: 40 @@ -84,6 +90,15 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter asset: root.asset name: root.name + + badge { + visible: type === StatusChatListItem.Type.OneToOneChat + color: onlineStatus === StatusChatListItem.OnlineStatus.Online ? Theme.palette.successColor1 : Theme.palette.baseColor1 + border.width: 1 + border.color: root.color + implicitHeight: 9 + implicitWidth: 9 + } } StatusIcon { diff --git a/src/StatusQ/Components/StatusSmartIdenticon.qml b/src/StatusQ/Components/StatusSmartIdenticon.qml index cb50a80c..9e4e55a3 100644 --- a/src/StatusQ/Components/StatusSmartIdenticon.qml +++ b/src/StatusQ/Components/StatusSmartIdenticon.qml @@ -99,6 +99,8 @@ Loader { visible: false anchors.bottom: root.bottom anchors.right: root.right + anchors.rightMargin: -border.width + anchors.bottomMargin: -border.width border.width: 3 implicitHeight: 15 implicitWidth: 15