From e8b1dad80f8048aeab510b833b21e34c86a27b89 Mon Sep 17 00:00:00 2001 From: Noelia Date: Fri, 10 Mar 2023 16:55:50 +0100 Subject: [PATCH] feat(MintTokens): Added list of collectibles view Added list of collectibles view. Closes #8736 --- .../CommunityMintTokensSettingsPanel.qml | 37 +------ .../communities/CommunityMintedTokensView.qml | 103 ++++++++++++++++++ .../CommunityNewCollectibleView.qml | 2 + .../AppLayouts/Chat/views/communities/qmldir | 3 +- .../Wallet/views/collectibles/qmldir | 1 + 5 files changed, 114 insertions(+), 32 deletions(-) create mode 100644 ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml create mode 100644 ui/app/AppLayouts/Wallet/views/collectibles/qmldir diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml index 40cb917721..2d5fab4407 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml @@ -139,7 +139,6 @@ SettingsPageLayout { id: newCollectiblesView CommunityNewCollectibleView { - //anchors.fill: parent viewWidth: root.viewWidth layer1Networks: root.layer1Networks layer2Networks: root.layer2Networks @@ -148,6 +147,7 @@ SettingsPageLayout { allNetworks: root.allNetworks onPreviewClicked: { + d.collectibleName = name stackManager.push(d.previewCollectibleViewState, collectibleView, { @@ -172,13 +172,12 @@ SettingsPageLayout { id: collectibleView CommunityCollectibleView { - id: collectibleViewItem - //anchors.fill: parent viewWidth: root.viewWidth preview: d.preview holdersModel: root.holdersModel onMintCollectible: { + d.collectibleName = name root.mintCollectible(artworkSource, name, symbol, @@ -191,13 +190,6 @@ SettingsPageLayout { stackManager.clear(d.initialViewState, StackView.Immediate) } - - Binding { - target: d - property: "collectibleName" - value: collectibleViewItem.name - restoreMode: Binding.RestoreBindingOrValue - } } } @@ -212,33 +204,23 @@ SettingsPageLayout { } } - // TEMPORAL: Component { id: mintedTokensView - // TEMPORAL: - Item { - id: mintedTokensViewItem - width: root.viewWidth - //anchors.fill: parent - - ColumnLayout { - id: backendChecker - width: parent.width - + CommunityMintedTokensView { viewWidth: root.viewWidth model: root.tokensModel onItemClicked: { - selectedCollectibleName = name + d.collectibleName = name stackManager.push(d.collectibleViewState, collectibleView, { - "deployState": Qt.binding(() => deployState), + deployState: Qt.binding(() => deployState), name, artworkSource, symbol, description, - "supplyText": supply.toString(), + supplyText: supply.toString(), infiniteSupply, transferable, remoteSelfDestruct, @@ -248,13 +230,6 @@ SettingsPageLayout { }, StackView.Immediate) } - - Binding { - target: d - property: "collectibleName" - value: mintedTokensViewItem.model.name - restoreMode: Binding.RestoreBindingOrValue - } } } } diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml new file mode 100644 index 0000000000..ca0a47950f --- /dev/null +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityMintedTokensView.qml @@ -0,0 +1,103 @@ +import QtQuick 2.0 +import QtQuick.Layouts 1.14 + +import StatusQ.Core 0.1 +import StatusQ.Components 0.1 +import StatusQ.Core.Theme 0.1 + +import utils 1.0 + +import AppLayouts.Wallet.views.collectibles 1.0 + +StatusScrollView { + id: root + + property int viewWidth: 560 // by design + property var model + + signal itemClicked(int deployState, + string name, + string artworkSource, + string symbol, + string description, + int supply, + bool infiniteSupply, + bool transferable, + bool remoteSelfDestruct, + int chainId, + string chainName, + string chainIcon) + + + enum DeployState { + Failed, + InProgress, + Deployed + } + + QtObject { + id: d + + function getStateText(deployState) { + if(deployState === CommunityMintedTokensView.DeployState.Failed) { + return qsTr("Failed") + } + + if(deployState === CommunityMintedTokensView.DeployState.InProgress) { + return qsTr("Minting...") + } + return "" + } + } + + contentWidth: mainLayout.width + contentHeight: mainLayout.height + padding: 0 + + ColumnLayout { + id: mainLayout + + width: root.viewWidth + spacing: Style.current.padding + + StatusBaseText { + text: qsTr("Collectibles") + font.pixelSize: Theme.primaryTextFontSize + color: Theme.palette.baseColor1 + } + + StatusGridView { + id: gridView + + Layout.fillWidth: true + Layout.preferredHeight: 500 // TODO + model: root.model + cellHeight: 229 + cellWidth: 176 + delegate: CollectibleView { + height: gridView.cellHeight + width: gridView.cellWidth + title: model.name ? model.name : "..." + subTitle: d.getStateText(model.deployState) + imageUrl: model.image ? model.image : "" + backgroundColor: model.backgroundColor ? model.backgroundColor : "transparent" // TODO BACKEND + isLoading: false// model.isLoading // TODO BACKEND + navigationIconVisible: true + + onClicked: root.itemClicked(model.deployState, + model.name, + model.image, + model.symbol, + model.description, + model.supply, + model.infiniteSupply, + model.transferable, + model.remoteSelfDestruct, + model.chainId, + "Goerli", //model.chainName, TODO BACKEND + "network/Network=Custom")//model.chainIcon) TODO BACKEND + + } + } + } +} diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml index 2c508db671..d2a0c17d54 100644 --- a/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml @@ -120,6 +120,7 @@ StatusScrollView { id: symbolInput label: qsTr("Token symbol") + charLimit: 5 placeholderText: qsTr("Letter token abbreviation e.g. ABC") errorText: qsTr("Token symbol") } @@ -226,6 +227,7 @@ StatusScrollView { Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true Layout.topMargin: Style.current.padding + Layout.bottomMargin: Style.current.padding text: qsTr("Preview") enabled: d.isFullyFilled diff --git a/ui/app/AppLayouts/Chat/views/communities/qmldir b/ui/app/AppLayouts/Chat/views/communities/qmldir index fd786f3c4c..d77ecd52d8 100644 --- a/ui/app/AppLayouts/Chat/views/communities/qmldir +++ b/ui/app/AppLayouts/Chat/views/communities/qmldir @@ -1,8 +1,9 @@ ChannelsSelectionModel 1.0 ChannelsSelectionModel.qml CommunityCollectibleView 1.0 CommunityCollectibleView.qml +CommunityMintedTokensView 1.0 CommunityMintedTokensView.qml CommunityNewCollectibleView 1.0 CommunityNewCollectibleView.qml CommunityNewPermissionView 1.0 CommunityNewPermissionView.qml CommunityPermissionsView 1.0 CommunityPermissionsView.qml CommunityWelcomeSettingsView 1.0 CommunityWelcomeSettingsView.qml HoldingsSelectionModel 1.0 HoldingsSelectionModel.qml -JoinCommunityView 1.0 JoinCommunityView.qml \ No newline at end of file +JoinCommunityView 1.0 JoinCommunityView.qml diff --git a/ui/app/AppLayouts/Wallet/views/collectibles/qmldir b/ui/app/AppLayouts/Wallet/views/collectibles/qmldir new file mode 100644 index 0000000000..12d9db8c93 --- /dev/null +++ b/ui/app/AppLayouts/Wallet/views/collectibles/qmldir @@ -0,0 +1 @@ +CollectibleView 1.0 CollectibleView.qml