2023-02-17 11:57:17 +00:00
|
|
|
import QtQuick 2.14
|
2023-03-09 11:12:49 +00:00
|
|
|
import QtQuick.Controls 2.14
|
2023-03-07 11:32:45 +00:00
|
|
|
import QtQuick.Layouts 1.14
|
2023-03-09 11:12:49 +00:00
|
|
|
import QtQml 2.15
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-03-09 11:12:49 +00:00
|
|
|
import StatusQ.Core.Utils 0.1
|
2023-02-17 11:57:17 +00:00
|
|
|
|
|
|
|
import AppLayouts.Chat.layouts 1.0
|
|
|
|
import AppLayouts.Chat.views.communities 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
SettingsPageLayout {
|
|
|
|
id: root
|
|
|
|
|
2023-03-08 13:44:47 +00:00
|
|
|
// Models:
|
2023-02-17 11:57:17 +00:00
|
|
|
property var tokensModel
|
2023-03-08 13:44:47 +00:00
|
|
|
property var holdersModel
|
|
|
|
|
|
|
|
// Network related properties:
|
|
|
|
property var layer1Networks
|
|
|
|
property var layer2Networks
|
|
|
|
property var testNetworks
|
|
|
|
property var enabledNetworks
|
|
|
|
property var allNetworks
|
|
|
|
|
2023-02-17 11:57:17 +00:00
|
|
|
property int viewWidth: 560 // by design
|
|
|
|
|
2023-03-08 13:44:47 +00:00
|
|
|
signal mintCollectible(url artworkSource,
|
|
|
|
string name,
|
|
|
|
string symbol,
|
|
|
|
string description,
|
|
|
|
int supply,
|
|
|
|
bool infiniteSupply,
|
|
|
|
bool transferable,
|
|
|
|
bool selfDestruct,
|
|
|
|
int chainId)
|
|
|
|
|
2023-02-17 11:57:17 +00:00
|
|
|
function navigateBack() {
|
2023-03-09 11:12:49 +00:00
|
|
|
stackManager.pop(StackView.Immediate)
|
2023-02-17 11:57:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
readonly property string initialViewState: "WELCOME_OR_LIST_COLLECTIBLES"
|
2023-02-17 11:57:17 +00:00
|
|
|
readonly property string newCollectibleViewState: "NEW_COLLECTIBLE"
|
2023-03-07 11:32:45 +00:00
|
|
|
readonly property string previewCollectibleViewState: "PREVIEW_COLLECTIBLE"
|
|
|
|
readonly property string collectibleViewState: "VIEW_COLLECTIBLE"
|
|
|
|
|
|
|
|
readonly property string welcomePageTitle: qsTr("Mint tokens")
|
|
|
|
readonly property string newCollectiblePageTitle: qsTr("Create new collectible")
|
2023-03-09 11:12:49 +00:00
|
|
|
readonly property string newTokenButtonText: qsTr("Create new token")
|
2023-03-07 11:32:45 +00:00
|
|
|
readonly property string backButtonText: qsTr("Back")
|
|
|
|
readonly property string backTokensText: qsTr("Tokens")
|
|
|
|
|
|
|
|
property bool preview: false
|
2023-03-09 11:12:49 +00:00
|
|
|
property string collectibleName
|
|
|
|
readonly property var initialItem: (root.tokensModel && root.tokensModel.count > 0) ? mintedTokensView : welcomeView
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
content: StackView {
|
|
|
|
anchors.fill: parent
|
|
|
|
initialItem: d.initialItem
|
2023-03-07 11:32:45 +00:00
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
Component.onCompleted: stackManager.pushInitialState(d.initialViewState)
|
2023-02-17 11:57:17 +00:00
|
|
|
}
|
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
state: stackManager.currentState
|
2023-02-17 11:57:17 +00:00
|
|
|
states: [
|
|
|
|
State {
|
2023-03-09 11:12:49 +00:00
|
|
|
name: d.initialViewState
|
2023-03-07 11:32:45 +00:00
|
|
|
PropertyChanges {target: root; title: d.welcomePageTitle}
|
2023-02-17 11:57:17 +00:00
|
|
|
PropertyChanges {target: root; previousPageName: ""}
|
|
|
|
PropertyChanges {target: root; headerButtonVisible: true}
|
2023-03-09 11:12:49 +00:00
|
|
|
PropertyChanges {target: root; headerButtonText: d.newTokenButtonText}
|
2023-02-17 11:57:17 +00:00
|
|
|
PropertyChanges {target: root; headerWidth: root.viewWidth}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: d.newCollectibleViewState
|
2023-03-07 11:32:45 +00:00
|
|
|
PropertyChanges {target: root; title: d.newCollectiblePageTitle}
|
|
|
|
PropertyChanges {target: root; previousPageName: d.welcomePageTitle}
|
2023-02-17 11:57:17 +00:00
|
|
|
PropertyChanges {target: root; headerButtonVisible: false}
|
|
|
|
PropertyChanges {target: root; headerWidth: 0}
|
2023-03-07 11:32:45 +00:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: d.previewCollectibleViewState
|
2023-03-09 11:12:49 +00:00
|
|
|
PropertyChanges {target: root; title: d.collectibleName}
|
2023-03-07 11:32:45 +00:00
|
|
|
PropertyChanges {target: root; previousPageName: d.backButtonText}
|
|
|
|
PropertyChanges {target: root; headerButtonVisible: false}
|
|
|
|
PropertyChanges {target: root; headerWidth: 0}
|
|
|
|
PropertyChanges {target: d; preview: true}
|
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: d.collectibleViewState
|
2023-03-09 11:12:49 +00:00
|
|
|
PropertyChanges {target: root; title: d.collectibleName}
|
2023-03-07 11:32:45 +00:00
|
|
|
PropertyChanges {target: root; previousPageName: d.backTokensText}
|
|
|
|
PropertyChanges {target: root; headerButtonVisible: false}
|
|
|
|
PropertyChanges {target: root; headerWidth: 0}
|
|
|
|
PropertyChanges {target: root; footer: mintTokenFooter}
|
|
|
|
PropertyChanges {target: d; preview: false}
|
2023-02-17 11:57:17 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
onHeaderButtonClicked: stackManager.push(d.newCollectibleViewState, newCollectiblesView, null, StackView.Immediate)
|
|
|
|
onTokensModelChanged: {
|
|
|
|
if(root.tokensModel && root.tokensModel.count === 1) {
|
|
|
|
stackManager.stackView.replace(welcomeView, d.initialItem, StackView.Immediate)
|
2023-02-17 11:57:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
StackViewStates {
|
|
|
|
id: stackManager
|
|
|
|
|
|
|
|
stackView: root.contentItem
|
|
|
|
}
|
|
|
|
|
2023-02-17 11:57:17 +00:00
|
|
|
// Mint tokens possible view contents:
|
|
|
|
Component {
|
|
|
|
id: welcomeView
|
|
|
|
|
|
|
|
CommunityWelcomeSettingsView {
|
|
|
|
viewWidth: root.viewWidth
|
|
|
|
image: Style.png("community/mint2_1")
|
|
|
|
title: qsTr("Mint community tokens")
|
|
|
|
subtitle: qsTr("You can mint custom tokens and collectibles for your community")
|
|
|
|
checkersModel: [
|
|
|
|
qsTr("Reward individual members with custom tokens for their contribution"),
|
|
|
|
qsTr("Incentivise joining, retention, moderation and desired behaviour"),
|
|
|
|
qsTr("Monetise your community by selling exclusive tokens")
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: newCollectiblesView
|
|
|
|
|
2023-02-22 17:10:46 +00:00
|
|
|
CommunityNewCollectibleView {
|
2023-03-09 11:12:49 +00:00
|
|
|
//anchors.fill: parent
|
|
|
|
viewWidth: root.viewWidth
|
2023-03-08 13:44:47 +00:00
|
|
|
layer1Networks: root.layer1Networks
|
|
|
|
layer2Networks: root.layer2Networks
|
|
|
|
testNetworks: root.testNetworks
|
|
|
|
enabledNetworks: root.testNetworks
|
|
|
|
allNetworks: root.allNetworks
|
2023-03-09 11:12:49 +00:00
|
|
|
|
|
|
|
onPreviewClicked: {
|
|
|
|
stackManager.push(d.previewCollectibleViewState,
|
|
|
|
collectibleView,
|
|
|
|
{
|
|
|
|
name,
|
|
|
|
artworkSource,
|
|
|
|
symbol,
|
|
|
|
description,
|
|
|
|
supplyText,
|
|
|
|
infiniteSupply,
|
|
|
|
transferable,
|
|
|
|
selfDestruct,
|
|
|
|
chainId,
|
|
|
|
chainName,
|
|
|
|
chainIcon
|
|
|
|
},
|
|
|
|
StackView.Immediate)
|
|
|
|
}
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: collectibleView
|
|
|
|
|
|
|
|
CommunityCollectibleView {
|
2023-03-09 11:12:49 +00:00
|
|
|
id: collectibleViewItem
|
|
|
|
//anchors.fill: parent
|
|
|
|
viewWidth: root.viewWidth
|
2023-03-07 11:32:45 +00:00
|
|
|
preview: d.preview
|
2023-03-08 13:44:47 +00:00
|
|
|
holdersModel: root.holdersModel
|
2023-03-07 11:32:45 +00:00
|
|
|
|
2023-03-08 13:44:47 +00:00
|
|
|
onMintCollectible: {
|
|
|
|
root.mintCollectible(artworkSource,
|
|
|
|
name,
|
|
|
|
symbol,
|
|
|
|
description,
|
|
|
|
supply,
|
|
|
|
infiniteSupply,
|
|
|
|
transferable,
|
|
|
|
selfDestruct,
|
|
|
|
chainId)
|
2023-03-07 11:32:45 +00:00
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
stackManager.clear(d.initialViewState, StackView.Immediate)
|
|
|
|
}
|
|
|
|
|
|
|
|
Binding {
|
|
|
|
target: d
|
|
|
|
property: "collectibleName"
|
|
|
|
value: collectibleViewItem.name
|
|
|
|
restoreMode: Binding.RestoreBindingOrValue
|
2023-03-07 11:32:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: mintTokenFooter
|
|
|
|
|
|
|
|
MintTokensFooterPanel {
|
|
|
|
airdropEnabled: false
|
|
|
|
retailEnabled: false
|
|
|
|
remotelySelfDestructEnabled: false
|
|
|
|
burnEnabled: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TEMPORAL:
|
|
|
|
Component {
|
|
|
|
id: mintedTokensView
|
|
|
|
|
|
|
|
// TEMPORAL:
|
|
|
|
Item {
|
2023-03-09 11:12:49 +00:00
|
|
|
id: mintedTokensViewItem
|
|
|
|
width: root.viewWidth
|
|
|
|
//anchors.fill: parent
|
2023-03-07 11:32:45 +00:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: backendChecker
|
|
|
|
width: parent.width
|
|
|
|
|
2023-03-09 11:12:49 +00:00
|
|
|
viewWidth: root.viewWidth
|
|
|
|
model: root.tokensModel
|
|
|
|
onItemClicked: {
|
|
|
|
selectedCollectibleName = name
|
|
|
|
stackManager.push(d.collectibleViewState,
|
|
|
|
collectibleView,
|
|
|
|
{
|
|
|
|
"deployState": Qt.binding(() => deployState),
|
|
|
|
name,
|
|
|
|
artworkSource,
|
|
|
|
symbol,
|
|
|
|
description,
|
|
|
|
"supplyText": supply.toString(),
|
|
|
|
infiniteSupply,
|
|
|
|
transferable,
|
|
|
|
remoteSelfDestruct,
|
|
|
|
chainId,
|
|
|
|
chainName,
|
|
|
|
chainIcon
|
|
|
|
},
|
|
|
|
StackView.Immediate)
|
|
|
|
}
|
|
|
|
|
|
|
|
Binding {
|
|
|
|
target: d
|
|
|
|
property: "collectibleName"
|
|
|
|
value: mintedTokensViewItem.model.name
|
|
|
|
restoreMode: Binding.RestoreBindingOrValue
|
2023-02-22 17:10:46 +00:00
|
|
|
}
|
2023-02-17 11:57:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|