diff --git a/storybook/pages/CommunityMintTokensSettingsPanelPage.qml b/storybook/pages/CommunityMintTokensSettingsPanelPage.qml index e9de60962e..4488fe78a4 100644 --- a/storybook/pages/CommunityMintTokensSettingsPanelPage.qml +++ b/storybook/pages/CommunityMintTokensSettingsPanelPage.qml @@ -23,28 +23,16 @@ SplitView { CommunityMintTokensSettingsPanel { anchors.fill: parent anchors.topMargin: 50 - transactionStore: QtObject { - readonly property var currentAccount: QtObject { - readonly property string address: "0x0000001" - } - } - communitiesStore: QtObject { - readonly property TokenHoldersModel holdersModel: TokenHoldersModel {} - property var layer1Networks: NetworksModel.layer1Networks - property var layer2Networks: NetworksModel.layer2Networks - property var testNetworks: NetworksModel.testNetworks - property var enabledNetworks: NetworksModel.enabledNetworks - property var allNetworks: enabledNetworks - - function mintCollectible(communityId, address, artworkSource, name, symbol, description, supply, - infiniteSupply, transferable, selfDestruct, chainId) - { - logs.logEvent("CommunityMintTokensSettingsPanel::mintCollectible") - } - } - tokensModel: ListModel {} - } + holdersModel: TokenHoldersModel {} + layer1Networks: NetworksModel.layer1Networks + layer2Networks: NetworksModel.layer2Networks + testNetworks: NetworksModel.testNetworks + enabledNetworks: NetworksModel.enabledNetworks + allNetworks: enabledNetworks + + onMintCollectible: ogs.logEvent("CommunityMintTokensSettingsPanel::mintCollectible") + } } LogsAndControlsPanel { diff --git a/storybook/pages/CommunityNewCollectibleViewPage.qml b/storybook/pages/CommunityNewCollectibleViewPage.qml index 8401361f58..428dcf6dfc 100644 --- a/storybook/pages/CommunityNewCollectibleViewPage.qml +++ b/storybook/pages/CommunityNewCollectibleViewPage.qml @@ -27,13 +27,11 @@ SplitView { CommunityNewCollectibleView { anchors.fill: parent anchors.margins: 50 - store: QtObject { - property var layer1Networks: NetworksModel.layer1Networks - property var layer2Networks: NetworksModel.layer2Networks - property var testNetworks: NetworksModel.testNetworks - property var enabledNetworks: NetworksModel.enabledNetworks - property var allNetworks: enabledNetworks - } + layer1Networks: NetworksModel.layer1Networks + layer2Networks: NetworksModel.layer2Networks + testNetworks: NetworksModel.testNetworks + enabledNetworks: NetworksModel.enabledNetworks + allNetworks: enabledNetworks onPreviewClicked: logs.logEvent("CommunityNewCollectibleView::previewClicked") } diff --git a/ui/app/AppLayouts/Chat/ChatLayout.qml b/ui/app/AppLayouts/Chat/ChatLayout.qml index da75b7a0e4..93ca68045e 100644 --- a/ui/app/AppLayouts/Chat/ChatLayout.qml +++ b/ui/app/AppLayouts/Chat/ChatLayout.qml @@ -112,7 +112,6 @@ StackLayout { sourceComponent: CommunitySettingsView { rootStore: root.rootStore - communityStore: CommunitiesStore {} hasAddedContacts: root.contactsStore.myContactsModel.count > 0 chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule diff --git a/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml b/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml index 3e1b05e630..b0e0d5320a 100644 --- a/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml +++ b/ui/app/AppLayouts/Chat/panels/communities/CommunityMintTokensSettingsPanel.qml @@ -13,12 +13,36 @@ import utils 1.0 SettingsPageLayout { id: root - property string communityId + // Models: property var tokensModel - property var communitiesStore - property var transactionStore + property var holdersModel + + // Network related properties: + property var layer1Networks + property var layer2Networks + property var testNetworks + property var enabledNetworks + property var allNetworks + + // Other properties: + property alias chainName: collectibleItem.chainName + property alias chainIcon: collectibleItem.chainIcon + property int viewWidth: 560 // by design + signal mintCollectible(url artworkSource, + string name, + string symbol, + string description, + int supply, + bool infiniteSupply, + bool transferable, + bool selfDestruct, + int chainId) + + signal requestChainName(int chainId) + signal requestChainIcon(int chainId) + function navigateBack() { if (root.state === d.newCollectibleViewState) { root.state = d.initialState @@ -86,12 +110,12 @@ SettingsPageLayout { supplyText = model.supply.toString() infiniteSupply = model.infiniteSupply transferable = model.transferable - chainName = communitiesStore.getChainName(model.chainId) - chainIcon = communitiesStore.getChainIcon(model.chainId) artworkSource = model.image symbol = model.symbol selfDestruct = model.remoteSelfDestruct chainId = model.chainId + requestChainName(model.chainId) + requestChainIcon(model.chainId) } } @@ -174,7 +198,11 @@ SettingsPageLayout { CommunityNewCollectibleView { anchors.fill: parent - store: root.communitiesStore + layer1Networks: root.layer1Networks + layer2Networks: root.layer2Networks + testNetworks: root.testNetworks + enabledNetworks: root.testNetworks + allNetworks: root.allNetworks name: collectibleItem.collectibleName artworkSource: collectibleItem.artworkSource symbol: collectibleItem.symbol @@ -208,7 +236,7 @@ SettingsPageLayout { CommunityCollectibleView { anchors.fill: parent preview: d.preview - holdersModel: root.communitiesStore.holdersModel + holdersModel: root.holdersModel deployState: collectibleItem.deployState name: collectibleItem.collectibleName artworkSource: collectibleItem.artworkSource @@ -222,18 +250,16 @@ SettingsPageLayout { chainName: collectibleItem.chainName chainIcon: collectibleItem.chainIcon - onDeployCollectible: { - root.communitiesStore.deployCollectible(root.communityId, - root.transactionStore.currentAccount.address, /*TODO use address from SendModal*/ - name, - symbol, - description, - supply, - infiniteSupply, - transferable, - selfDestruct, - chainId, - artworkSource) + onMintCollectible: { + root.mintCollectible(artworkSource, + name, + symbol, + description, + supply, + infiniteSupply, + transferable, + selfDestruct, + chainId) root.state = d.mintedCollectibleViewState } diff --git a/ui/app/AppLayouts/Chat/stores/CommunitiesStore.qml b/ui/app/AppLayouts/Chat/stores/CommunityTokensStore.qml similarity index 100% rename from ui/app/AppLayouts/Chat/stores/CommunitiesStore.qml rename to ui/app/AppLayouts/Chat/stores/CommunityTokensStore.qml diff --git a/ui/app/AppLayouts/Chat/stores/RootStore.qml b/ui/app/AppLayouts/Chat/stores/RootStore.qml index 15de65f2fb..e083a3a711 100644 --- a/ui/app/AppLayouts/Chat/stores/RootStore.qml +++ b/ui/app/AppLayouts/Chat/stores/RootStore.qml @@ -15,6 +15,8 @@ QtObject { chatCommunitySectionModuleInst: chatCommunitySectionModule } + readonly property CommunityTokensStore communityTokensStore: CommunityTokensStore {} + property bool openCreateChat: false property string createChatInitMessage: "" property var createChatFileUrls: [] diff --git a/ui/app/AppLayouts/Chat/stores/qmldir b/ui/app/AppLayouts/Chat/stores/qmldir index 22a8298fd0..00d7e85583 100644 --- a/ui/app/AppLayouts/Chat/stores/qmldir +++ b/ui/app/AppLayouts/Chat/stores/qmldir @@ -1,4 +1,5 @@ CommunitiesStore 1.0 CommunitiesStore.qml +CommunityTokensStore 1.0 CommunityTokensStore.qml PermissionsStore 1.0 PermissionsStore.qml RootStore 1.0 RootStore.qml StickerData 1.0 StickerData.qml diff --git a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml index 0d040e0d68..9bc1de985f 100644 --- a/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml +++ b/ui/app/AppLayouts/Chat/views/CommunitySettingsView.qml @@ -34,19 +34,16 @@ StatusSectionLayout { onNotificationButtonClicked: Global.openActivityCenterPopup() // TODO: get this model from backend? property var settingsMenuModel: [{name: qsTr("Overview"), icon: "show", enabled: true}, - {name: qsTr("Members"), icon: "group-chat", enabled: true}, - {name: qsTr("Permissions"), icon: "objects", enabled: root.rootStore.communityPermissionsEnabled}, - {name: qsTr("Mint Tokens"), icon: "token", enabled: root.rootStore.communityTokensEnabled}] - + {name: qsTr("Members"), icon: "group-chat", enabled: true}, + {name: qsTr("Permissions"), icon: "objects", enabled: root.rootStore.communityPermissionsEnabled}, + {name: qsTr("Mint Tokens"), icon: "token", enabled: root.rootStore.communityTokensEnabled}] // TODO: Next community settings options: // {name: qsTr("Airdrops"), icon: "airdrop"}, // {name: qsTr("Token sales"), icon: "token-sale"}, // {name: qsTr("Subscriptions"), icon: "subscription"}, - property var rootStore property var community property var chatCommunitySectionModule - required property CommunitiesStore communityStore property bool hasAddedContacts: false property var transactionStore: TransactionStore {} @@ -198,18 +195,18 @@ StatusSectionLayout { onEdited: { const error = root.chatCommunitySectionModule.editCommunity( - StatusQUtils.Utils.filterXSS(item.name), - StatusQUtils.Utils.filterXSS(item.description), - StatusQUtils.Utils.filterXSS(item.introMessage), - StatusQUtils.Utils.filterXSS(item.outroMessage), - item.options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess : Constants.communityChatPublicAccess, - item.color.toString().toUpperCase(), - item.selectedTags, - Utils.getImageAndCropInfoJson(item.logoImagePath, item.logoCropRect), - Utils.getImageAndCropInfoJson(item.bannerPath, item.bannerCropRect), - item.options.archiveSupportEnabled, - item.options.pinMessagesEnabled - ) + StatusQUtils.Utils.filterXSS(item.name), + StatusQUtils.Utils.filterXSS(item.description), + StatusQUtils.Utils.filterXSS(item.introMessage), + StatusQUtils.Utils.filterXSS(item.outroMessage), + item.options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess : Constants.communityChatPublicAccess, + item.color.toString().toUpperCase(), + item.selectedTags, + Utils.getImageAndCropInfoJson(item.logoImagePath, item.logoCropRect), + Utils.getImageAndCropInfoJson(item.bannerPath, item.bannerCropRect), + item.options.archiveSupportEnabled, + item.options.pinMessagesEnabled + ) if (error) { errorDialog.text = error.error errorDialog.open() @@ -225,8 +222,8 @@ StatusSectionLayout { onAirdropTokensClicked: { /* TODO in future */ } onBackUpClicked: { Global.openPopup(transferOwnershipPopup, { - privateKey: root.chatCommunitySectionModule.exportCommunity(root.communityId), - }) + privateKey: root.chatCommunitySectionModule.exportCommunity(root.communityId), + }) } onPreviousPageNameChanged: root.backButtonName = previousPageName } @@ -286,11 +283,35 @@ StatusSectionLayout { } CommunityMintTokensSettingsPanel { - communityId: root.community.id - communitiesStore: root.communityStore - transactionStore: root.transactionStore + readonly property CommunityTokensStore communityTokensStore: + rootStore.communityTokensStore + tokensModel: root.community.communityTokens + holdersModel: communityTokensStore.holdersModel + layer1Networks: communityTokensStore.layer1Networks + layer2Networks: communityTokensStore.layer2Networks + testNetworks: communityTokensStore.testNetworks + enabledNetworks: communityTokensStore.enabledNetworks + allNetworks: communityTokensStore.allNetworks + onPreviousPageNameChanged: root.backButtonName = previousPageName + onRequestChainName: chainName = communityTokensStore.getChainName(chainId) + onRequestChainIcon: chainIcon = communityTokensStore.getChainIcon(chainId) + onMintCollectible: { + communityTokensStore.deployCollectible(root.community.id, + root.transactionStore.currentAccount.address, /*TODO use address from SendModal*/ + name, + symbol, + description, + supply, + infiniteSupply, + transferable, + selfDestruct, + chainId, + artworkSource) + + root.state = d.mintedCollectibleViewState + } } onCurrentIndexChanged: root.backButtonName = centerPanelContentLoader.item.children[d.currentIndex].previousPageName diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityCollectibleView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityCollectibleView.qml index f98271d48d..64eb7b1ac5 100644 --- a/ui/app/AppLayouts/Chat/views/communities/CommunityCollectibleView.qml +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityCollectibleView.qml @@ -32,7 +32,7 @@ StatusScrollView { property string chainIcon property int deployState - signal deployCollectible(url artworkSource, + signal mintCollectible(url artworkSource, string name, string symbol, string description, @@ -231,7 +231,7 @@ StatusScrollView { text: qsTr("Mint") onClicked: { - root.deployCollectible(root.artworkSource, + root.mintCollectible(root.artworkSource, root.name, root.symbol, root.description, diff --git a/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml b/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml index 2a48e4522b..2c508db671 100644 --- a/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml +++ b/ui/app/AppLayouts/Chat/views/communities/CommunityNewCollectibleView.qml @@ -14,7 +14,6 @@ import shared.panels 1.0 StatusScrollView { id: root - property var store property int viewWidth: 560 // by design // Collectible properties @@ -30,6 +29,13 @@ StatusScrollView { property string chainName property string chainIcon + // Network related properties: + property var layer1Networks + property var layer2Networks + property var testNetworks + property var enabledNetworks + property var allNetworks + signal chooseArtWork signal previewClicked @@ -159,7 +165,11 @@ StatusScrollView { NetworkFilter { visible: !rowComponent.isSwitchCase Layout.preferredWidth: 160 - store: root.store + layer1Networks: root.layer1Networks + layer2Networks: root.layer2Networks + testNetworks: root.testNetworks + enabledNetworks: root.testNetworks + allNetworks: root.allNetworks isChainVisible: false multiSelection: false diff --git a/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml b/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml index 6922c1c729..876832a8d6 100644 --- a/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml +++ b/ui/app/AppLayouts/Wallet/controls/NetworkFilter.qml @@ -16,10 +16,15 @@ Item { implicitWidth: 130 implicitHeight: parent.height - property var store + property var layer1Networks + property var layer2Networks + property var testNetworks + property var enabledNetworks + property var allNetworks property bool isChainVisible: true property bool multiSelection: true + signal toggleNetwork(int chainId) signal singleNetworkSelected(int chainId, string chainName, string chainIcon) QtObject { @@ -47,7 +52,7 @@ Item { statusListItemTitle.font.pixelSize: 13 statusListItemTitle.font.weight: Font.Medium statusListItemTitle.color: Theme.palette.baseColor1 - title: root.multiSelection ? (store.enabledNetworks.count === store.allNetworks.count ? qsTr("All networks") : qsTr("%n network(s)", "", store.enabledNetworks.count)) : + title: root.multiSelection ? (root.enabledNetworks.count === root.allNetworks.count ? qsTr("All networks") : qsTr("%n network(s)", "", root.enabledNetworks.count)) : d.selectedChainName asset.height: 24 asset.width: asset.height @@ -80,7 +85,7 @@ Item { Repeater { id: chainRepeater - model: store.enabledNetworks + model: root.enabledNetworks delegate: InformationTag { tagPrimaryLabel.text: model.shortName tagPrimaryLabel.color: model.chainColor @@ -93,13 +98,13 @@ Item { id: selectPopup x: (parent.width - width + 5) y: (selectRectangleItem.height + 5) - layer1Networks: store.layer1Networks - layer2Networks: store.layer2Networks - testNetworks: store.testNetworks + layer1Networks: root.layer1Networks + layer2Networks: root.layer2Networks + testNetworks: root.testNetworks multiSelection: root.multiSelection onToggleNetwork: { - store.toggleNetwork(network.chainId) + root.toggleNetwork(network.chainId) } onSingleNetworkSelected: { diff --git a/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml b/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml index 3906c9a322..cb6a12ee1f 100644 --- a/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml +++ b/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml @@ -55,7 +55,13 @@ Item { id: networkFilter Layout.alignment: Qt.AlignTrailing Layout.rowSpan: 2 - store: root.walletStore + layer1Networks: walletStore.layer1Networks + layer2Networks: walletStore.layer2Networks + testNetworks: walletStore.testNetworks + enabledNetworks: walletStore.enabledNetworks + allNetworks: walletStore.allNetworks + + onToggleNetwork: walletStore.toggleNetwork(chainId) } StatusAddressPanel {