chore(Storybook): add pages for InviteFriendsToCommunityPopup and related components

Closes: #8004
This commit is contained in:
Michał Cieślak 2022-10-25 10:24:47 +02:00 committed by Michał
parent fa265b5e79
commit 6b90d4d5a6
7 changed files with 288 additions and 4 deletions

View File

@ -13,7 +13,8 @@ DirectoriesWatcher::DirectoriesWatcher(QObject *parent)
void DirectoriesWatcher::addPaths(const QStringList &paths)
{
for (auto& path : paths) {
QDirIterator it(path, QDir::AllDirs | QDir::NoDotAndDotDot, QDirIterator::Subdirectories);
QDirIterator it(path, QDir::AllDirs | QDir::NoDotAndDotDot,
QDirIterator::Subdirectories);
while (it.hasNext()) {
const auto& subpath = it.filePath();

View File

@ -47,6 +47,15 @@ ApplicationWindow {
ListElement {
title: "LanguageCurrencySettings"
}
ListElement {
title: "CommunityProfilePopupInviteFriendsPanel"
}
ListElement {
title: "CommunityProfilePopupInviteMessagePanel"
}
ListElement {
title: "InviteFriendsToCommunityPopup"
}
}
SplitView {

View File

@ -0,0 +1,89 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import AppLayouts.Chat.panels.communities 1.0
import utils 1.0
Item {
property bool globalUtilsReady: false
property bool mainModuleReady: false
QtObject {
function getCompressedPk(publicKey) {
return "compressed"
}
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 = {}
}
}
Frame {
anchors.centerIn: parent
Loader {
active: globalUtilsReady && mainModuleReady
sourceComponent: CommunityProfilePopupInviteFriendsPanel {
id: panel
community: ({ id: "communityId" })
rootStore: QtObject {
function communityHasMember(communityId, pubKey) {
return false
}
}
contactsStore: QtObject {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
const keys = []
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
})
}
}
}
}
}
}
}
}

View File

@ -0,0 +1,89 @@
import QtQuick 2.14
import QtQuick.Controls 2.14
import AppLayouts.Chat.panels.communities 1.0
import utils 1.0
Item {
property bool globalUtilsReady: false
property bool mainModuleReady: false
QtObject {
function getCompressedPk(publicKey) {
return "compressed"
}
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: {
Utils.mainModuleInst = this
mainModuleReady = true
}
Component.onDestruction: {
mainModuleReady = false
Utils.mainModuleInst = {}
}
}
Frame {
anchors.centerIn: parent
height: parent.height * 0.8
width: parent.width * 0.8
Loader {
active: globalUtilsReady && mainModuleReady
anchors.fill: parent
sourceComponent: CommunityProfilePopupInviteMessagePanel {
id: panel
contactsStore: QtObject {
readonly property ListModel myContactsModel: ListModel {
Component.onCompleted: {
const keys = []
for (let i = 0; i < 20; i++) {
const key = `pub_key_${i}`
append({
isContact: true,
onlineStatus: 1,
displayName: `contact ${i}`,
icon: "",
colorId: "1",
pubKey: key
})
keys.push(key)
}
panel.pubKeys = keys
}
}
}
}
}
}
}

View File

@ -0,0 +1,96 @@
import QtQuick 2.14
import AppLayouts.Chat.popups 1.0
import utils 1.0
Item {
Rectangle {
color: 'lightgray'
anchors.fill: parent
}
property bool globalUtilsReady: false
property bool mainModuleReady: false
QtObject {
function getCompressedPk(publicKey) {
return "compressed"
}
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
anchors.centerIn: parent
community: ({
id: "communityId",
name: "community-name"
})
rootStore: QtObject {
function communityHasMember(communityId, pubKey) {
return false
}
}
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()
}
}
}

View File

@ -1,7 +1,5 @@
import QtQuick 2.14
import StatusQ.Core.Theme 0.1
Flickable {
id: root
@ -17,7 +15,7 @@ Flickable {
TextEdit {
id: logTextEdit
font.family: Theme.palette.monoFont.name
font.family: "courier"
font.letterSpacing: 1.2
readOnly: true
selectByMouse: true

View File

@ -0,0 +1,2 @@
CommunityProfilePopupInviteFriendsPanel 1.0 CommunityProfilePopupInviteFriendsPanel.qml
CommunityProfilePopupInviteMessagePanel 1.0 CommunityProfilePopupInviteMessagePanel.qml