Skip to content

Commit

Permalink
UserListPanel made store-independent, Storybook page fully operable
Browse files Browse the repository at this point in the history
Closes: #16717
  • Loading branch information
micieslak committed Nov 8, 2024
1 parent ffda5d1 commit 30d683f
Show file tree
Hide file tree
Showing 5 changed files with 286 additions and 178 deletions.
3 changes: 0 additions & 3 deletions storybook/pages/ProfileContextMenuPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ SplitView {
{ text: "Trusted", value: Constants.trustStatus.trusted },
{ text: "Untrusted", value: Constants.trustStatus.untrustworthy }
]
currentIndex: 0
}
}

Expand All @@ -176,7 +175,6 @@ SplitView {
{ text: "Contact Request Received", value: Constants.contactType.contactRequestReceived },
{ text: "Contact Request Sent", value: Constants.contactType.contactRequestSent }
]
currentIndex: 0
}
}

Expand Down Expand Up @@ -223,7 +221,6 @@ SplitView {
{ text: "Profile", value: Constants.chatType.profile },
{ text: "Community Chat", value: Constants.chatType.communityChat }
]
currentIndex: 0
}
}

Expand Down
102 changes: 81 additions & 21 deletions storybook/pages/UserListPanelPage.qml
Original file line number Diff line number Diff line change
@@ -1,47 +1,107 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

import AppLayouts.Chat.panels 1.0
import StatusQ 0.1

import Storybook 1.0
import Models 1.0

import SortFilterProxyModel 0.2
import utils 1.0

SplitView {
Logs { id: logs }

orientation: Qt.Vertical

UsersModel {
id: model
}

UserListPanel {
Pane {
SplitView.fillWidth: true
SplitView.fillHeight: true

label: "Some label"
padding: 100

usersModel: SortFilterProxyModel {
sourceModel: model
Rectangle {
anchors.fill: parent
anchors.margins: -1
color: "transparent"
border.color: "black"
}

proxyRoles: FastExpressionRole {
name: "compressedKey"
expression: "compressed"
}
UserListPanel {
anchors.fill: parent

usersModel: UsersModel {}

label: labelTextField.text
isAdmin: isAdminCheckBox.checked
chatType: chatTypeSelector.currentValue
communityMemberReevaluationStatus:
communityMemberReevaluationStatusSelector.currentValue
}
}

LogsAndControlsPanel {
id: logsAndControlsPanel

Pane {
SplitView.minimumHeight: 100
SplitView.preferredHeight: 200

logsView.logText: logs.logText
ColumnLayout {
RowLayout {
Label {
text: "Label:"
}

TextField {
id: labelTextField

text: "Some label here"
}
}

CheckBox {
id: isAdminCheckBox

text: "Is admin (allows to remove used from private group chat)"
}

RowLayout {
Label {
text: "Chat Type:"
}

ComboBox {
id: chatTypeSelector

textRole: "text"
valueRole: "value"
model: [
{ text: "Unknown", value: Constants.chatType.unknown },
{ text: "Category", value: Constants.chatType.category },
{ text: "One-to-One", value: Constants.chatType.oneToOne },
{ text: "Public Chat", value: Constants.chatType.publicChat },
{ text: "Private Group Chat", value: Constants.chatType.privateGroupChat },
{ text: "Profile", value: Constants.chatType.profile },
{ text: "Community Chat", value: Constants.chatType.communityChat }
]
}
}

RowLayout {
Label {
text: "Community member reevaluation status:"
}

ComboBox {
id: communityMemberReevaluationStatusSelector

textRole: "text"
valueRole: "value"
model: [
{ text: "Unknown", value: Constants.CommunityMemberReevaluationStatus.None },
{ text: "InProgress", value: Constants.CommunityMemberReevaluationStatus.InProgress },
{ text: "Done", value: Constants.CommunityMemberReevaluationStatus.Done }
]
}
}
}
}
}

// category: Panels
// status: good
240 changes: 128 additions & 112 deletions storybook/src/Models/UsersModel.qml
Original file line number Diff line number Diff line change
@@ -1,117 +1,133 @@
import QtQuick 2.15

import utils 1.0

ListModel {
id: root
readonly property var data: [
{
pubKey: "0x043a7ed0e8d1012cf04",
compressedPubKey: "zQ3shQBu4PRDX17vewYyvSczbTj344viTXxcMNvQLeyQsBDF4",
onlineStatus: Constants.onlineStatus.online,
isContact: true,
isVerified: false,
isAdmin: false,
isUntrustworthy: true,
displayName: "Mike has a very long name that should elide " +
"eventually and result in a tooltip displayed instead",
alias: "",
localNickname: "",
ensName: "",
icon: ModelsData.icons.cryptPunks,
colorId: 7,
isEnsVerified: false,
colorHash: [
{ colorId: 0, segmentLength: 2 },
{ colorId: 17, segmentLength: 2}
],
isAwaitingAddress: false,
memberRole: Constants.memberRole.none,
trustStatus: Constants.trustStatus.untrustworthy
},
{
pubKey: "0x04df12f12f12f12f1234",
compressedPubKey: "zQ3shQBAAPRDX17vewYyvSczbTj344viTXxcMNvQLeyQsBDF4",
onlineStatus: Constants.onlineStatus.inactive,
isContact: false,
isVerified: false,
isAdmin: false,
isUntrustworthy: false,
displayName: "Jane",
alias: "",
localNickname: "",
ensName: "",
icon: "",
colorId: 9,
isEnsVerified: false,
colorHash: [
{ colorId: 0, segmentLength: 1 },
{ colorId: 19, segmentLength: 2 }
],
isAwaitingAddress: false,
memberRole: Constants.memberRole.owner,
trustStatus: Constants.trustStatus.trusted
},
{
pubKey: "0x04d1b7cc0ef3f470f1238",
compressedPubKey: "zQ3shQ7u3PRDX17vewYyvSczbTj344viTXxcMNvQLeyQsCDF4",
onlineStatus: Constants.onlineStatus.inactive,
isContact: false,
isVerified: false,
isAdmin: false,
isUntrustworthy: true,
displayName: "John",
alias: "",
localNickname: "Johnny Johny",
ensName: "",
icon: ModelsData.icons.dragonereum,
colorId: 4,
isEnsVerified: false,
isAwaitingAddress: false,
memberRole: Constants.memberRole.none,
trustStatus: Constants.trustStatus.untrustworthy
},
{
pubKey: "0x04d1bed192343f470f1257",
compressedPubKey: "zQ3shQAL4PRDX17vewYyvSczbTj344viTXxcMNvQLeyQsBDF4",
onlineStatus: Constants.onlineStatus.online,
isContact: true,
isVerified: true,
isAdmin: false,
isUntrustworthy: true,
displayName: "Maria",
alias: "meth",
localNickname: "86.eth",
ensName: "8⃣_6⃣.eth",
icon: "",
colorId: 5,
isEnsVerified: true,
isAwaitingAddress: false,
memberRole: Constants.memberRole.none,
trustStatus: Constants.trustStatus.untrustworthy
},
{
pubKey: "0x04d1bed192343f470f1255",
compressedPubKey: "zQ3shQBu4PGDX17vewYyvSczbTj344viTXxcMNvQLeyQsBD1A",
onlineStatus: Constants.onlineStatus.online,
isContact: true,
isVerified: true,
isAdmin: true,
isUntrustworthy: true,
displayName: "",
alias: "Richard The Lionheart",
localNickname: "",
ensName: "richard-the-lionheart.eth",
icon: "",
colorId: 3,
isEnsVerified: true,
isAwaitingAddress: false,
memberRole: Constants.memberRole.none,
trustStatus: Constants.trustStatus.untrustworthy
},
{
pubKey: "0x04d1bed192343f470fabc",
compressedPubKey: "zQ3shQBk4PRDX17vewYyvSczbTj344viTXxcMNvQLeyQsB994",
onlineStatus: Constants.onlineStatus.inactive,
isContact: true,
isVerified: false,
isAdmin: false,
isUntrustworthy: false,
displayName: "",
alias: "",
localNickname: "",
ensName: "8⃣6⃣.sth.eth",
icon: "",
colorId: 7,
isEnsVerified: true,
isAwaitingAddress: true,
memberRole: Constants.memberRole.none,
trustStatus: Constants.trustStatus.trusted
}
]

ListElement {
pubKey: "0x043a7ed0e8d1012cf04"
onlineStatus: 1
isContact: true
isVerified: false
isAdmin: false
isUntrustworthy: true
displayName: "Mike has a very long name that should elide eventually and result in a tooltip displayed instead"
alias: ""
localNickname: ""
ensName: ""
icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAlklEQVR4nOzW0QmDQBAG4SSkl7SUQlJGCrElq9F3QdjjVhh/5nv3cFhY9vUIYQiNITSG0BhCExPynn1gWf9bx498P7/
nzPcxEzGExhBdJGYihtAYQlO+tUZvqrPbqeudo5iJGEJjCE15a3VtodH3q2ImYgiNITTlTdG1nUZ5a92VITQxITFiJmIIjSE0htAYQrMHAAD//+wwFVpz+yqXAAAAAElFTkSuQmCC"
colorId: 7
isEnsVerified: false
colorHash: [
ListElement {colorId: 0; segmentLength: 2},
ListElement {colorId: 17; segmentLength: 2}
]
isAwaitingAddress: false
memberRole: 0 // Constants.memberRole.none
}
ListElement {
pubKey: "0x04df12f12f12f12f1234"
onlineStatus: 0
isContact: false
isVerified: false
isAdmin: false
isUntrustworthy: false
displayName: "Jane"
alias: ""
localNickname: ""
ensName: ""
icon: ""
colorId: 9
isEnsVerified: false
colorHash: [
ListElement {colorId: 0; segmentLength: 1},
ListElement {colorId: 19; segmentLength: 2}
]
isAwaitingAddress: false
memberRole: 1 // Constants.memberRole.owner
}
ListElement {
pubKey: "0x04d1b7cc0ef3f470f1238"
onlineStatus: 0
isContact: false
isVerified: false
isAdmin: false
isUntrustworthy: true
displayName: "John"
alias: ""
localNickname: "Johnny Johny"
ensName: ""
icon: "https://cryptologos.cc/logos/status-snt-logo.svg?v=033"
colorId: 4
isEnsVerified: false
isAwaitingAddress: false
memberRole: 0
}
ListElement {
pubKey: "0x04d1bed192343f470f1257"
onlineStatus: 1
isContact: true
isVerified: true
isAdmin: false
isUntrustworthy: true
displayName: "Maria"
alias: "meth"
localNickname: "86.eth"
ensName: "8⃣6⃣.eth"
icon: ""
colorId: 5
isEnsVerified: true
isAwaitingAddress: false
memberRole: 0
}
ListElement {
pubKey: "0x04d1bed192343f470f1255"
onlineStatus: 1
isContact: true
isVerified: true
isAdmin: true
isUntrustworthy: true
displayName: ""
alias: "Richard The Lionheart"
localNickname: ""
ensName: "richard-the-lionheart.eth"
icon: ""
colorId: 3
isEnsVerified: true
isAwaitingAddress: false
memberRole: 0
}
ListElement {
pubKey: "0x04d1bed192343f470fabc"
onlineStatus: 0
isContact: true
isVerified: false
isAdmin: false
isUntrustworthy: false
displayName: ""
alias: ""
localNickname: ""
ensName: "8⃣6⃣.eth"
icon: ""
colorId: 7
isEnsVerified: true
isAwaitingAddress: true
memberRole: 0
}
Component.onCompleted: append(data)
}
Loading

0 comments on commit 30d683f

Please sign in to comment.