From 110e5af0c30701c5081b5688f21bde83d0829551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Thu, 4 May 2023 12:29:01 +0200 Subject: [PATCH] chore(CommunityAirdropsSettingsPanel): Storybook page fixed --- .../CommunityAirdropsSettingsPanelPage.qml | 115 ++++++++++++++++-- storybook/src/Models/UsersModel.qml | 2 +- 2 files changed, 106 insertions(+), 11 deletions(-) diff --git a/storybook/pages/CommunityAirdropsSettingsPanelPage.qml b/storybook/pages/CommunityAirdropsSettingsPanelPage.qml index 26e3a2b82f..2436f2235d 100644 --- a/storybook/pages/CommunityAirdropsSettingsPanelPage.qml +++ b/storybook/pages/CommunityAirdropsSettingsPanelPage.qml @@ -1,9 +1,13 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 +import QtQuick 2.15 +import QtQuick.Controls 2.15 + +import StatusQ.Core.Theme 0.1 import AppLayouts.Chat.panels.communities 1.0 -import AppLayouts.Chat.stores 1.0 -import StatusQ.Core.Theme 0.1 +import AppLayouts.Chat.controls.community 1.0 +import utils 1.0 + +import SortFilterProxyModel 0.2 import Storybook 1.0 import Models 1.0 @@ -13,21 +17,112 @@ SplitView { orientation: Qt.Vertical SplitView.fillWidth: true + property bool globalUtilsReady: false + property bool mainModuleReady: false + Logs { id: logs } + QtObject { + function isCompressedPubKey(publicKey) { + return true + } + + function getCompressedPk(publicKey) { + return "compressed_" + publicKey + } + + function getColorId(publicKey) { + return Math.floor(Math.random() * 10) + } + + Component.onCompleted: { + Utils.globalUtilsInst = this + globalUtilsReady = true + + } + Component.onDestruction: { + globalUtilsReady = false + Utils.globalUtilsInst = {} + } + } + + QtObject { + function getContactDetailsAsJson() { + return JSON.stringify({ ensVerified: true }) + } + + Component.onCompleted: { + mainModuleReady = true + Utils.mainModuleInst = this + } + Component.onDestruction: { + mainModuleReady = false + Utils.mainModuleInst = {} + } + } + Rectangle { SplitView.fillWidth: true SplitView.fillHeight: true color: Theme.palette.statusAppLayout.rightPanelBackgroundColor - CommunityAirdropsSettingsPanel { + Loader { anchors.fill: parent - anchors.topMargin: 50 - assetsModel: AssetsModel {} - collectiblesModel: CollectiblesModel {} - membersModel: ListModel {} + active: globalUtilsReady && mainModuleReady - onAirdropClicked: logs.logEvent("CommunityAirdropsSettingsPanel::onAirdropClicked") + sourceComponent: CommunityAirdropsSettingsPanel { + id: communityAirdropsSettingsPanel + anchors.fill: parent + anchors.topMargin: 50 + assetsModel: AssetsModel {} + collectiblesModel: ListModel {} + + CollectiblesModel { + id: collectiblesModel + } + + SortFilterProxyModel { + id: collectiblesModelWithSupply + + sourceModel: collectiblesModel + + proxyRoles: [ + ExpressionRole { + name: "supply" + expression: ((model.index + 1) * 115).toString() + }, + ExpressionRole { + name: "infiniteSupply" + expression: !(model.index % 4) + }, + ExpressionRole { + name: "chainName" + expression: model.index ? "Optimism" : "Arbitrum" + }, + ExpressionRole { + + readonly property string icon1: "network/Network=Optimism" + readonly property string icon2: "network/Network=Arbitrum" + + name: "chainIcon" + expression: model.index ? icon1 : icon2 + } + ] + + filters: ValueFilter { + roleName: "category" + value: TokenCategories.Category.Community + } + + Component.onCompleted: { + Qt.callLater(() => communityAirdropsSettingsPanel.collectiblesModel = this) + } + } + + membersModel: UsersModel {} + + onAirdropClicked: logs.logEvent("CommunityAirdropsSettingsPanel::onAirdropClicked") + } } } diff --git a/storybook/src/Models/UsersModel.qml b/storybook/src/Models/UsersModel.qml index a952c26ca4..bbd2360c1c 100644 --- a/storybook/src/Models/UsersModel.qml +++ b/storybook/src/Models/UsersModel.qml @@ -53,7 +53,7 @@ ListModel { isVerified: true isAdmin: false isUntrustworthy: true - displayName: "" + displayName: "Maria" alias: "meth" localNickname: "" ensName: "maria.eth"