chore(CommunityAirdropsSettingsPanel): Storybook page fixed

This commit is contained in:
Michał Cieślak 2023-05-04 12:29:01 +02:00 committed by Michał
parent a5d339eb45
commit 110e5af0c3
2 changed files with 106 additions and 11 deletions

View File

@ -1,9 +1,13 @@
import QtQuick 2.14 import QtQuick 2.15
import QtQuick.Controls 2.14 import QtQuick.Controls 2.15
import StatusQ.Core.Theme 0.1
import AppLayouts.Chat.panels.communities 1.0 import AppLayouts.Chat.panels.communities 1.0
import AppLayouts.Chat.stores 1.0 import AppLayouts.Chat.controls.community 1.0
import StatusQ.Core.Theme 0.1 import utils 1.0
import SortFilterProxyModel 0.2
import Storybook 1.0 import Storybook 1.0
import Models 1.0 import Models 1.0
@ -13,21 +17,112 @@ SplitView {
orientation: Qt.Vertical orientation: Qt.Vertical
SplitView.fillWidth: true SplitView.fillWidth: true
property bool globalUtilsReady: false
property bool mainModuleReady: false
Logs { id: logs } 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 { Rectangle {
SplitView.fillWidth: true SplitView.fillWidth: true
SplitView.fillHeight: true SplitView.fillHeight: true
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
CommunityAirdropsSettingsPanel { Loader {
anchors.fill: parent anchors.fill: parent
anchors.topMargin: 50 active: globalUtilsReady && mainModuleReady
assetsModel: AssetsModel {}
collectiblesModel: CollectiblesModel {}
membersModel: ListModel {}
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")
}
} }
} }

View File

@ -53,7 +53,7 @@ ListModel {
isVerified: true isVerified: true
isAdmin: false isAdmin: false
isUntrustworthy: true isUntrustworthy: true
displayName: "" displayName: "Maria"
alias: "meth" alias: "meth"
localNickname: "" localNickname: ""
ensName: "maria.eth" ensName: "maria.eth"