2023-08-07 13:35:14 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
2023-08-08 08:41:59 +00:00
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
|
|
|
import Qt.labs.settings 1.0
|
2023-08-07 13:35:14 +00:00
|
|
|
|
|
|
|
import AppLayouts.Communities.panels 1.0
|
2024-10-15 12:26:45 +00:00
|
|
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
|
|
|
import AppLayouts.Profile.stores 1.0 as ProfileStores
|
2023-08-07 13:35:14 +00:00
|
|
|
|
2023-08-08 08:41:59 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2023-08-07 13:35:14 +00:00
|
|
|
import Models 1.0
|
|
|
|
import SortFilterProxyModel 0.2
|
2023-08-08 08:41:59 +00:00
|
|
|
import Storybook 1.0
|
2023-08-07 13:35:14 +00:00
|
|
|
|
2024-10-02 12:28:20 +00:00
|
|
|
import StatusQ 0.1
|
2023-08-17 08:55:28 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
|
|
|
|
2024-10-15 12:26:45 +00:00
|
|
|
|
2023-08-07 13:35:14 +00:00
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
2023-08-08 08:41:59 +00:00
|
|
|
orientation: Qt.Vertical
|
|
|
|
Logs { id: logs }
|
|
|
|
|
2023-08-17 08:55:28 +00:00
|
|
|
// Utils.globalUtilsInst mock
|
|
|
|
QtObject {
|
|
|
|
function getEmojiHashAsJson(publicKey) {
|
|
|
|
return JSON.stringify(["👨🏻🍼", "🏃🏿♂️", "🌇", "🤶🏿", "🏮","🤷🏻♂️", "🤦🏻", "📣", "🤎", "👷🏽", "😺", "🥞", "🔃", "🧝🏽♂️"])
|
|
|
|
}
|
|
|
|
|
|
|
|
function getColorId(publicKey) {
|
|
|
|
return SQUtils.ModelUtils.getByKey(usersModel, "pubKey", publicKey, "colorId")
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCompressedPk(publicKey) { return "zx3sh" + publicKey }
|
|
|
|
|
|
|
|
function getColorHashAsJson(publicKey) {
|
|
|
|
return JSON.stringify([{colorId: 0, segmentLength: 1},
|
|
|
|
{colorId: 19, segmentLength: 2}])
|
|
|
|
}
|
|
|
|
|
|
|
|
function isCompressedPubKey(publicKey) { return true }
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
Utils.globalUtilsInst = this
|
|
|
|
}
|
|
|
|
Component.onDestruction: {
|
|
|
|
Utils.globalUtilsInst = {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-07 13:35:14 +00:00
|
|
|
MembersTabPanel {
|
|
|
|
id: membersTabPanelPage
|
2023-08-08 08:41:59 +00:00
|
|
|
SplitView.fillWidth: true
|
|
|
|
SplitView.fillHeight: true
|
2023-08-17 08:55:28 +00:00
|
|
|
placeholderText: "Search users"
|
2023-08-07 13:35:14 +00:00
|
|
|
model: usersModelWithMembershipState
|
2023-08-08 08:41:59 +00:00
|
|
|
panelType: viewStateSelector.currentValue
|
|
|
|
|
2024-10-15 12:26:45 +00:00
|
|
|
rootStore: ChatStores.RootStore {
|
|
|
|
contactsStore: ProfileStores.ContactsStore {
|
|
|
|
readonly property string myPublicKey: "0x000"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-08 08:41:59 +00:00
|
|
|
onKickUserClicked: {
|
2023-08-17 08:55:28 +00:00
|
|
|
logs.logEvent("MembersTabPanel::onKickUserClicked", ["id", "name"], arguments)
|
2023-08-08 08:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onBanUserClicked: {
|
2023-08-17 08:55:28 +00:00
|
|
|
logs.logEvent("MembersTabPanel::onBanUserClicked", ["id", "name"], arguments)
|
2023-08-08 08:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onUnbanUserClicked: {
|
2023-08-17 08:55:28 +00:00
|
|
|
logs.logEvent("MembersTabPanel::onUnbanUserClicked", ["id"], arguments)
|
2023-08-08 08:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onAcceptRequestToJoin: {
|
2023-08-17 08:55:28 +00:00
|
|
|
logs.logEvent("MembersTabPanel::onAcceptRequestToJoin", ["id"], arguments)
|
2023-08-08 08:41:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onDeclineRequestToJoin: {
|
2023-08-17 08:55:28 +00:00
|
|
|
logs.logEvent("MembersTabPanel::onDeclineRequestToJoin", ["id"], arguments)
|
2023-08-08 08:41:59 +00:00
|
|
|
}
|
2024-10-02 12:28:20 +00:00
|
|
|
|
|
|
|
onViewMemberMessagesClicked: {
|
|
|
|
logs.logEvent("MembersTabPanel::onViewMemberMessagesClicked", ["pubKey", "displayName"], arguments)
|
|
|
|
}
|
2023-08-07 13:35:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
UsersModel {
|
|
|
|
id: usersModel
|
|
|
|
}
|
|
|
|
|
|
|
|
SortFilterProxyModel {
|
|
|
|
id: usersModelWithMembershipState
|
2023-08-08 08:41:59 +00:00
|
|
|
readonly property var membershipStatePerView: [
|
2023-10-04 21:41:51 +00:00
|
|
|
[Constants.CommunityMembershipRequestState.Accepted , Constants.CommunityMembershipRequestState.BannedPending, Constants.CommunityMembershipRequestState.UnbannedPending, Constants.CommunityMembershipRequestState.KickedPending],
|
2023-08-08 08:41:59 +00:00
|
|
|
[Constants.CommunityMembershipRequestState.Banned],
|
|
|
|
[Constants.CommunityMembershipRequestState.Pending, Constants.CommunityMembershipRequestState.AcceptedPending, Constants.CommunityMembershipRequestState.RejectedPending],
|
|
|
|
[Constants.CommunityMembershipRequestState.Rejected]
|
|
|
|
]
|
|
|
|
|
2023-08-07 13:35:14 +00:00
|
|
|
sourceModel: usersModel
|
2023-08-08 08:41:59 +00:00
|
|
|
sortRole: membersTabPanelPage.panelType
|
2023-08-07 13:35:14 +00:00
|
|
|
|
|
|
|
proxyRoles: [
|
2024-10-02 12:28:20 +00:00
|
|
|
FastExpressionRole {
|
2023-08-07 13:35:14 +00:00
|
|
|
name: "membershipRequestState"
|
2023-08-08 08:41:59 +00:00
|
|
|
expression: {
|
|
|
|
var memberStates = usersModelWithMembershipState.membershipStatePerView[membersTabPanelPage.panelType]
|
|
|
|
return memberStates[model.index % (memberStates.length)]
|
|
|
|
}
|
2024-10-02 12:28:20 +00:00
|
|
|
expectedRoles: ["index"]
|
2023-08-07 13:35:14 +00:00
|
|
|
},
|
2024-10-02 12:28:20 +00:00
|
|
|
ConstantRole {
|
2023-08-07 13:35:14 +00:00
|
|
|
name: "requestToJoinLoading"
|
2024-10-02 12:28:20 +00:00
|
|
|
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)
|
2023-08-07 13:35:14 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2023-08-08 08:41:59 +00:00
|
|
|
|
|
|
|
LogsAndControlsPanel {
|
|
|
|
SplitView.minimumHeight: 100
|
|
|
|
SplitView.preferredHeight: 320
|
|
|
|
|
|
|
|
logsView.logText: logs.logText
|
|
|
|
|
|
|
|
ColumnLayout {
|
2024-10-02 12:28:20 +00:00
|
|
|
Layout.fillWidth: true
|
2023-08-08 08:41:59 +00:00
|
|
|
Label {
|
|
|
|
text: "View state"
|
|
|
|
}
|
|
|
|
|
|
|
|
ComboBox {
|
|
|
|
id: viewStateSelector
|
|
|
|
textRole: "text"
|
|
|
|
valueRole: "value"
|
|
|
|
model: ListModel {
|
|
|
|
id: model
|
|
|
|
ListElement { text: "All members"; value: MembersTabPanel.TabType.AllMembers }
|
|
|
|
ListElement { text: "Banned Members"; value: MembersTabPanel.TabType.BannedMembers }
|
|
|
|
ListElement { text: "Pending Members"; value: MembersTabPanel.TabType.PendingRequests }
|
|
|
|
ListElement { text: "Declined Members"; value: MembersTabPanel.TabType.DeclinedRequests }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Settings {
|
|
|
|
property alias membersTabPanelSelection: viewStateSelector.currentIndex
|
|
|
|
}
|
2023-08-07 13:35:14 +00:00
|
|
|
}
|
2023-10-03 11:56:30 +00:00
|
|
|
|
|
|
|
// https://www.figma.com/file/17fc13UBFvInrLgNUKJJg5/Kuba⎜Desktop?type=design&node-id=35909-605774&mode=design&t=KfrAekLfW5mTy68x-0
|