fix(Storybook): update InviteFriendsToCommunityPopup page

This commit is contained in:
Michał Cieślak 2022-11-07 14:14:18 +01:00 committed by Michał
parent 6e705eab2a
commit c21337a02f
3 changed files with 121 additions and 72 deletions

View File

@ -18,6 +18,10 @@ Item {
{colorId: 19, segmentLength: 2}])
}
function isCompressedPubKey() {
return true
}
Component.onCompleted: {
Utils.globalUtilsInst = this
globalUtilsReady = true

View File

@ -13,6 +13,10 @@ Item {
return "compressed"
}
function isCompressedPubKey() {
return true
}
function getColorHashAsJson(publicKey) {
return JSON.stringify([{colorId: 0, segmentLength: 1},
{colorId: 19, segmentLength: 2}])

View File

@ -1,96 +1,137 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import AppLayouts.Chat.popups 1.0
import utils 1.0
Item {
Rectangle {
color: 'lightgray'
anchors.fill: parent
}
import Storybook 1.0
SplitView {
orientation: Qt.Vertical
Logs { id: logs }
property bool globalUtilsReady: false
property bool mainModuleReady: false
QtObject {
function getCompressedPk(publicKey) {
return "compressed"
Item {
SplitView.fillWidth: true
SplitView.fillHeight: true
Rectangle {
color: 'lightgray'
anchors.fill: parent
}
function getColorHashAsJson(publicKey) {
return JSON.stringify([{colorId: 0, segmentLength: 1},
{colorId: 19, segmentLength: 2}])
}
Component.onCompleted: {
Utils.globalUtilsInst = this
globalUtilsReady = true
}
Component.onDestruction: {
globalUtilsReady = false
Utils.globalUtilsInst = {}
}
}
QtObject {
function getContactDetailsAsJson() {
return JSON.stringify({})
}
Component.onCompleted: {
mainModuleReady = true
Utils.mainModuleInst = this
}
Component.onDestruction: {
mainModuleReady = false
Utils.mainModuleInst = {}
}
}
Loader {
active: globalUtilsReady && mainModuleReady
anchors.fill: parent
sourceComponent: InviteFriendsToCommunityPopup {
parent: parent
modal: false
Button {
anchors.centerIn: parent
text: "Reopen"
community: ({
id: "communityId",
name: "community-name"
})
onClicked: loader.item.open()
}
rootStore: QtObject {
function communityHasMember(communityId, pubKey) {
return false
}
QtObject {
function getCompressedPk(publicKey) {
return "compressed"
}
contactsStore: QtObject {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}`
function isCompressedPubKey() {
return true
}
append({
alias: "",
colorId: "1",
displayName: `contact ${i}`,
ensName: "",
icon: "",
isContact: true,
localNickname: "",
onlineStatus: 1,
pubKey: key
})
function getColorHashAsJson(publicKey) {
return JSON.stringify([{colorId: 0, segmentLength: 1},
{colorId: 19, segmentLength: 2}])
}
Component.onCompleted: {
Utils.globalUtilsInst = this
globalUtilsReady = true
}
Component.onDestruction: {
globalUtilsReady = false
Utils.globalUtilsInst = {}
}
}
QtObject {
function getContactDetailsAsJson() {
return JSON.stringify({})
}
Component.onCompleted: {
mainModuleReady = true
Utils.mainModuleInst = this
}
Component.onDestruction: {
mainModuleReady = false
Utils.mainModuleInst = {}
}
}
Loader {
id: loader
active: globalUtilsReady && mainModuleReady
anchors.fill: parent
sourceComponent: InviteFriendsToCommunityPopup {
parent: parent
modal: false
anchors.centerIn: parent
community: ({
id: "communityId",
name: "community-name"
})
rootStore: QtObject {
function communityHasMember(communityId, pubKey) {
return false
}
}
communitySectionModule: QtObject {
function inviteUsersToCommunity() {
logs.logEvent("communitySectionModule::inviteUsersToCommunity",
["keys", "message"], arguments)
}
}
contactsStore: QtObject {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}`
append({
alias: "",
colorId: "1",
displayName: `contact ${i}`,
ensName: "",
icon: "",
isContact: true,
localNickname: "",
onlineStatus: 1,
pubKey: key
})
}
}
}
}
}
Component.onCompleted: open()
Component.onCompleted: open()
}
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 200
logsView.logText: logs.logText
}
}