From 2c46764829f41d35f2541b8517f8d493690bac64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tinkl?= Date: Wed, 2 Oct 2024 14:28:20 +0200 Subject: [PATCH] fix(MembersTabPanel): Buttons in the Member tab do not work - move the MouseArea into `background` so that it doesn't obscure the potential action buttons - fixup SB page Fixes #16426 --- storybook/pages/MembersTabPanelPage.qml | 27 ++++++++++++++----- .../Components/StatusMemberListItem.qml | 14 +++++----- .../Communities/panels/MembersTabPanel.qml | 9 +++---- 3 files changed, 31 insertions(+), 19 deletions(-) diff --git a/storybook/pages/MembersTabPanelPage.qml b/storybook/pages/MembersTabPanelPage.qml index b7923172b3..fda5bfd2bb 100644 --- a/storybook/pages/MembersTabPanelPage.qml +++ b/storybook/pages/MembersTabPanelPage.qml @@ -12,6 +12,7 @@ import Models 1.0 import SortFilterProxyModel 0.2 import Storybook 1.0 +import StatusQ 0.1 import StatusQ.Core.Utils 0.1 as SQUtils SplitView { @@ -54,7 +55,7 @@ SplitView { Global.userProfile = this } Component.onDestruction: { - Utils.userProfile = {} + Global.userProfile = {} } } @@ -85,6 +86,10 @@ SplitView { onDeclineRequestToJoin: { logs.logEvent("MembersTabPanel::onDeclineRequestToJoin", ["id"], arguments) } + + onViewMemberMessagesClicked: { + logs.logEvent("MembersTabPanel::onViewMemberMessagesClicked", ["pubKey", "displayName"], arguments) + } } UsersModel { @@ -104,16 +109,26 @@ SplitView { sortRole: membersTabPanelPage.panelType proxyRoles: [ - ExpressionRole { + FastExpressionRole { name: "membershipRequestState" expression: { var memberStates = usersModelWithMembershipState.membershipStatePerView[membersTabPanelPage.panelType] return memberStates[model.index % (memberStates.length)] } + expectedRoles: ["index"] }, - ExpressionRole { + ConstantRole { name: "requestToJoinLoading" - expression: false + value: false + }, + FastExpressionRole { + function displayNameProxy(localNickname, ensName, displayName, aliasName) { + return ProfileUtils.displayName(localNickname, ensName, displayName, aliasName) + } + + name: "preferredDisplayName" + expectedRoles: ["localNickname", "displayName", "ensName", "alias"] + expression: displayNameProxy(model.localNickname, model.ensName, model.displayName, model.alias) } ] } @@ -125,9 +140,7 @@ SplitView { logsView.logText: logs.logText ColumnLayout { - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right + Layout.fillWidth: true Label { text: "View state" } diff --git a/ui/StatusQ/src/StatusQ/Components/StatusMemberListItem.qml b/ui/StatusQ/src/StatusQ/Components/StatusMemberListItem.qml index 411b699bd2..d52db524eb 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusMemberListItem.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusMemberListItem.qml @@ -170,6 +170,13 @@ ItemDelegate { background: Rectangle { color: root.color radius: 8 + + MouseArea { + anchors.fill: parent + cursorShape: root.enabled && root.hoverEnabled && root.hovered ? Qt.PointingHandCursor : undefined + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: root.clicked(mouse) + } } contentItem: RowLayout { @@ -268,13 +275,6 @@ ItemDelegate { } } - MouseArea { - anchors.fill: parent - cursorShape: root.enabled && root.hoverEnabled && root.hovered ? Qt.PointingHandCursor : undefined - acceptedButtons: Qt.LeftButton | Qt.RightButton - onClicked: root.clicked(mouse) - } - Component { id: statusContactVerificationIcons StatusContactVerificationIcons { diff --git a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml index 8d23316b1a..1d175a36ec 100644 --- a/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml +++ b/ui/app/AppLayouts/Communities/panels/MembersTabPanel.qml @@ -1,6 +1,6 @@ -import QtQuick 2.14 -import QtQuick.Layouts 1.14 -import QtQuick.Controls 2.14 +import QtQuick 2.15 +import QtQuick.Layouts 1.15 +import QtQuick.Controls 2.15 import StatusQ 0.1 import StatusQ.Core 0.1 @@ -68,7 +68,6 @@ Item { Layout.fillHeight: true model: SortFilterProxyModel { - sourceModel: root.model sorters : [ @@ -234,7 +233,7 @@ Item { text: qsTr("View Messages") visible: viewMessagesButtonVisible size: StatusBaseButton.Size.Small - onClicked: root.viewMemberMessagesClicked(model.pubKey, model.displayName) + onClicked: root.viewMemberMessagesClicked(model.pubKey, memberItem.title) }, StatusButton {