2023-03-13 16:32:14 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
import QtQuick.Controls 2.14
|
|
|
|
import QtQuick.Layouts 1.14
|
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Core.Utils 0.1
|
|
|
|
|
|
|
|
import AppLayouts.Chat.layouts 1.0
|
|
|
|
import AppLayouts.Chat.views.communities 1.0
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
SettingsPageLayout {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
// Token models:
|
|
|
|
required property var assetsModel
|
|
|
|
required property var collectiblesModel
|
|
|
|
|
2023-04-25 21:24:04 +00:00
|
|
|
required property var membersModel
|
|
|
|
|
2023-03-13 16:32:14 +00:00
|
|
|
property int viewWidth: 560 // by design
|
|
|
|
|
2023-04-25 21:24:04 +00:00
|
|
|
signal airdropClicked(var airdropTokens, var addresses, var membersPubKeys)
|
2023-03-24 12:41:46 +00:00
|
|
|
signal navigateToMintTokenSettings
|
2023-03-13 16:32:14 +00:00
|
|
|
|
2023-04-17 12:11:31 +00:00
|
|
|
|
2023-03-13 16:32:14 +00:00
|
|
|
function navigateBack() {
|
|
|
|
stackManager.pop(StackView.Immediate)
|
|
|
|
}
|
|
|
|
|
2023-04-17 12:11:31 +00:00
|
|
|
function selectCollectible(key, amount) {
|
|
|
|
d.selectCollectible(key, amount)
|
|
|
|
}
|
|
|
|
|
2023-06-05 13:49:36 +00:00
|
|
|
function addAddresses(addresses) {
|
|
|
|
d.addAddresses(addresses)
|
|
|
|
}
|
|
|
|
|
2023-03-13 16:32:14 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
|
|
|
|
readonly property string welcomeViewState: "WELCOME"
|
|
|
|
readonly property string newAirdropViewState: "NEW_AIRDROP"
|
|
|
|
|
|
|
|
readonly property string welcomePageTitle: qsTr("Airdrops")
|
|
|
|
readonly property string newAirdropViewPageTitle: qsTr("New airdrop")
|
2023-04-17 12:11:31 +00:00
|
|
|
|
|
|
|
signal selectCollectible(string key, int amount)
|
2023-06-05 13:49:36 +00:00
|
|
|
signal addAddresses(var addresses)
|
2023-03-13 16:32:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
content: StackView {
|
|
|
|
anchors.fill: parent
|
|
|
|
initialItem: welcomeView
|
|
|
|
|
|
|
|
Component.onCompleted: stackManager.pushInitialState(d.welcomeViewState)
|
|
|
|
}
|
|
|
|
|
|
|
|
state: stackManager.currentState
|
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: d.welcomeViewState
|
|
|
|
PropertyChanges {target: root; title: d.welcomePageTitle}
|
|
|
|
PropertyChanges {target: root; previousPageName: ""}
|
2023-05-30 15:18:45 +00:00
|
|
|
PropertyChanges {target: root; primaryHeaderButton.visible: true}
|
|
|
|
PropertyChanges {target: root; primaryHeaderButton.text: qsTr("New Airdrop")}
|
2023-03-13 16:32:14 +00:00
|
|
|
},
|
|
|
|
State {
|
|
|
|
name: d.newAirdropViewState
|
|
|
|
PropertyChanges {target: root; title: d.newAirdropViewPageTitle}
|
|
|
|
PropertyChanges {target: root; previousPageName: d.welcomePageTitle}
|
2023-05-30 15:18:45 +00:00
|
|
|
PropertyChanges {target: root; primaryHeaderButton.visible: false}
|
2023-03-13 16:32:14 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2023-05-30 15:18:45 +00:00
|
|
|
onPrimaryHeaderButtonClicked: stackManager.push(d.newAirdropViewState, newAirdropView, null, StackView.Immediate)
|
2023-03-13 16:32:14 +00:00
|
|
|
|
|
|
|
StackViewStates {
|
|
|
|
id: stackManager
|
|
|
|
|
|
|
|
stackView: root.contentItem
|
|
|
|
}
|
|
|
|
|
|
|
|
// Mint tokens possible view contents:
|
|
|
|
Component {
|
|
|
|
id: welcomeView
|
|
|
|
|
|
|
|
CommunityWelcomeSettingsView {
|
|
|
|
viewWidth: root.viewWidth
|
|
|
|
image: Style.png("community/airdrops8_1")
|
|
|
|
title: qsTr("Airdrop 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("Require holding a token or NFT to obtain exclusive membership rights")
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: newAirdropView
|
|
|
|
|
|
|
|
CommunityNewAirdropView {
|
2023-04-17 12:11:31 +00:00
|
|
|
id: view
|
|
|
|
|
2023-03-13 16:32:14 +00:00
|
|
|
assetsModel: root.assetsModel
|
|
|
|
collectiblesModel: root.collectiblesModel
|
2023-04-25 21:24:04 +00:00
|
|
|
membersModel: root.membersModel
|
2023-03-13 16:32:14 +00:00
|
|
|
|
|
|
|
onAirdropClicked: {
|
2023-04-25 21:24:04 +00:00
|
|
|
root.airdropClicked(airdropTokens, addresses, membersPubKeys)
|
2023-03-13 16:32:14 +00:00
|
|
|
stackManager.clear(d.welcomeViewState, StackView.Immediate)
|
|
|
|
}
|
2023-03-24 12:41:46 +00:00
|
|
|
onNavigateToMintTokenSettings: root.navigateToMintTokenSettings()
|
2023-04-17 12:11:31 +00:00
|
|
|
|
2023-06-05 13:49:36 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
d.selectCollectible.connect(view.selectCollectible)
|
|
|
|
d.addAddresses.connect(view.addAddresses)
|
|
|
|
}
|
2023-03-13 16:32:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|