2023-04-06 11:11:57 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2024-10-04 11:01:08 +00:00
|
|
|
import QtQuick.Window 2.15
|
2022-03-23 15:38:23 +00:00
|
|
|
import QtQuick.Dialogs 1.3
|
|
|
|
|
2023-03-09 10:08:43 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
import StatusQ 0.1
|
2023-07-04 14:35:00 +00:00
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
2022-03-23 15:38:23 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2022-07-05 10:12:27 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
2022-03-23 15:38:23 +00:00
|
|
|
import StatusQ.Layout 0.1
|
2023-01-09 12:51:31 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
2023-02-17 11:57:17 +00:00
|
|
|
import shared.stores 1.0
|
2023-09-15 08:51:06 +00:00
|
|
|
import shared.stores.send 1.0
|
2024-05-22 08:13:39 +00:00
|
|
|
import shared.views.chat 1.0
|
2023-07-04 14:35:00 +00:00
|
|
|
import utils 1.0
|
2023-02-17 11:57:17 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
import AppLayouts.Communities.controls 1.0
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.panels 1.0
|
|
|
|
import AppLayouts.Communities.popups 1.0
|
2023-07-18 17:34:57 +00:00
|
|
|
import AppLayouts.Communities.helpers 1.0
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.Chat.stores 1.0 as ChatStores
|
2023-11-22 13:50:07 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
StatusSectionLayout {
|
2022-03-23 15:38:23 +00:00
|
|
|
id: root
|
|
|
|
|
2022-10-26 16:00:20 +00:00
|
|
|
notificationCount: activityCenterStore.unreadNotificationsCount
|
2023-02-07 15:53:56 +00:00
|
|
|
hasUnseenNotifications: activityCenterStore.hasUnseenNotifications
|
2022-08-09 15:08:39 +00:00
|
|
|
onNotificationButtonClicked: Global.openActivityCenterPopup()
|
2023-06-14 16:00:41 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
property ChatStores.RootStore rootStore
|
2024-10-22 12:39:42 +00:00
|
|
|
property UtilsStore utilsStore
|
2022-03-23 15:38:23 +00:00
|
|
|
property var chatCommunitySectionModule
|
2023-11-22 13:50:07 +00:00
|
|
|
required property TokensStore tokensStore
|
2024-10-26 01:25:50 +00:00
|
|
|
required property var community
|
|
|
|
required property var joinedMembers
|
|
|
|
required property var bannedMembers
|
|
|
|
required property var pendingMembers
|
|
|
|
required property var declinedMembers
|
2024-05-22 08:13:39 +00:00
|
|
|
required property TransactionStore transactionStore
|
2023-07-24 11:31:31 +00:00
|
|
|
property bool communitySettingsDisabled
|
2023-09-14 10:02:51 +00:00
|
|
|
property var sendModalPopup
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2024-07-22 13:52:44 +00:00
|
|
|
required property string enabledChainIds
|
|
|
|
|
2023-08-09 12:31:58 +00:00
|
|
|
required property var walletAccountsModel // name, address, emoji, color
|
|
|
|
|
2023-06-26 12:07:49 +00:00
|
|
|
readonly property bool isOwner: community.memberRole === Constants.memberRole.owner
|
2023-08-22 18:09:34 +00:00
|
|
|
readonly property bool isAdmin: community.memberRole === Constants.memberRole.admin
|
2023-08-14 08:32:10 +00:00
|
|
|
readonly property bool isTokenMasterOwner: community.memberRole === Constants.memberRole.tokenMaster
|
2023-07-21 08:44:10 +00:00
|
|
|
readonly property bool isControlNode: community.isControlNode
|
2023-06-14 16:00:41 +00:00
|
|
|
|
2023-09-28 10:09:47 +00:00
|
|
|
// Community transfer ownership related props:
|
|
|
|
required property bool isPendingOwnershipRequest
|
2023-10-23 11:32:50 +00:00
|
|
|
signal finaliseOwnershipClicked
|
2023-09-28 10:09:47 +00:00
|
|
|
|
2024-07-22 13:52:44 +00:00
|
|
|
signal enableNetwork(int chainId)
|
|
|
|
|
2022-07-01 11:58:56 +00:00
|
|
|
readonly property string filteredSelectedTags: {
|
2023-07-04 11:08:00 +00:00
|
|
|
let tagsArray = []
|
2022-12-20 15:23:49 +00:00
|
|
|
if (community && community.tags) {
|
|
|
|
try {
|
2023-01-11 13:04:38 +00:00
|
|
|
const json = JSON.parse(community.tags)
|
2023-07-04 11:08:00 +00:00
|
|
|
|
|
|
|
if (!!json)
|
|
|
|
tagsArray = json.map(tag => tag.name)
|
|
|
|
} catch (e) {
|
2023-07-04 14:35:00 +00:00
|
|
|
console.warn("Error parsing community tags: ", community.tags,
|
|
|
|
" error: ", e.message)
|
2022-12-20 15:23:49 +00:00
|
|
|
}
|
2022-12-14 15:40:00 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
return JSON.stringify(tagsArray)
|
2022-07-01 11:58:56 +00:00
|
|
|
}
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
signal backToCommunityClicked
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
backButtonName: {
|
|
|
|
if (!stackLayout.children[d.currentIndex].item || !stackLayout.children[d.currentIndex].item.previousPageName) {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
return stackLayout.children[d.currentIndex].item.previousPageName
|
|
|
|
}
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2023-04-06 11:11:57 +00:00
|
|
|
//navigate to a specific section and subsection
|
|
|
|
function goTo(section: int, subSection: int) {
|
|
|
|
d.goTo(section, subSection)
|
|
|
|
}
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onBackButtonClicked: stackLayout.children[d.currentIndex].item.navigateBack()
|
2022-09-13 16:17:54 +00:00
|
|
|
|
2022-10-05 11:07:39 +00:00
|
|
|
leftPanel: Item {
|
2022-09-27 12:16:03 +00:00
|
|
|
anchors.fill: parent
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-09-27 12:16:03 +00:00
|
|
|
ColumnLayout {
|
|
|
|
anchors {
|
|
|
|
top: parent.top
|
2023-05-05 11:11:59 +00:00
|
|
|
bottom: backToCommunityButton.top
|
2022-10-05 12:14:29 +00:00
|
|
|
bottomMargin: 12
|
2024-10-15 19:26:12 +00:00
|
|
|
topMargin: Theme.smallPadding
|
2022-09-27 12:16:03 +00:00
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
2022-10-05 12:14:29 +00:00
|
|
|
width: parent.width
|
|
|
|
spacing: 32
|
2022-09-27 12:16:03 +00:00
|
|
|
clip: true
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-10-05 12:14:29 +00:00
|
|
|
StatusChatInfoButton {
|
|
|
|
id: communityHeader
|
|
|
|
|
|
|
|
title: community.name
|
2024-10-26 01:25:50 +00:00
|
|
|
subTitle: qsTr("%n member(s)", "", root.joinedMembers.ModelCount.count || 0)
|
2022-10-05 12:14:29 +00:00
|
|
|
asset.name: community.image
|
|
|
|
asset.color: community.color
|
|
|
|
asset.isImage: true
|
|
|
|
Layout.fillWidth: true
|
2024-10-15 19:26:12 +00:00
|
|
|
Layout.leftMargin: Theme.halfPadding
|
|
|
|
Layout.rightMargin: Theme.halfPadding
|
2022-10-05 12:14:29 +00:00
|
|
|
type: StatusChatInfoButton.Type.OneToOneChat
|
2024-05-02 17:24:56 +00:00
|
|
|
hoverEnabled: true
|
|
|
|
onClicked: root.backToCommunityClicked()
|
2022-09-27 12:16:03 +00:00
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2022-09-27 12:16:03 +00:00
|
|
|
StatusListView {
|
|
|
|
id: listView
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2024-10-15 19:26:12 +00:00
|
|
|
Layout.leftMargin: Theme.halfPadding
|
|
|
|
Layout.rightMargin: Theme.padding
|
2023-07-04 14:35:00 +00:00
|
|
|
model: stackLayout.children
|
2024-10-15 19:26:12 +00:00
|
|
|
spacing: Theme.halfPadding
|
2023-07-24 11:31:31 +00:00
|
|
|
enabled: !root.communitySettingsDisabled
|
2023-04-05 14:39:52 +00:00
|
|
|
|
2022-09-27 12:16:03 +00:00
|
|
|
delegate: StatusNavigationListItem {
|
2023-07-04 14:35:00 +00:00
|
|
|
objectName: "CommunitySettingsView_NavigationListItem_" + model.sectionName
|
|
|
|
width: ListView.view.width
|
|
|
|
title: model.sectionName
|
|
|
|
asset.name: model.sectionIcon
|
2023-07-24 11:31:31 +00:00
|
|
|
selected: d.currentIndex === index && !root.communitySettingsDisabled
|
2022-09-27 12:16:03 +00:00
|
|
|
onClicked: d.currentIndex = index
|
2023-07-04 14:35:00 +00:00
|
|
|
visible: model.sectionEnabled
|
|
|
|
height: visible ? implicitHeight : 0
|
2022-09-27 12:16:03 +00:00
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-21 12:40:42 +00:00
|
|
|
StatusBaseText {
|
2023-05-05 11:11:59 +00:00
|
|
|
id: backToCommunityButton
|
2023-03-21 12:40:42 +00:00
|
|
|
objectName: "communitySettingsBackToCommunityButton"
|
2022-09-27 12:16:03 +00:00
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: 16
|
2023-03-21 12:40:42 +00:00
|
|
|
horizontalCenter: parent.horizontalCenter
|
2022-09-27 12:16:03 +00:00
|
|
|
}
|
2023-03-21 12:40:42 +00:00
|
|
|
text: "<- " + qsTr("Back to community")
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
font.pixelSize: 15
|
|
|
|
font.underline: true
|
|
|
|
|
|
|
|
MouseArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
cursorShape: Qt.PointingHandCursor
|
|
|
|
onClicked: root.backToCommunityClicked()
|
|
|
|
hoverEnabled: true
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
centerPanel: StackLayout {
|
|
|
|
id: stackLayout
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
anchors.fill: parent
|
2022-06-06 15:23:24 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
currentIndex: d.currentIndex
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onCurrentIndexChanged: {
|
|
|
|
children[currentIndex].active = true
|
|
|
|
}
|
|
|
|
|
|
|
|
// OVERVIEW
|
|
|
|
Loader {
|
|
|
|
active: true
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
readonly property int sectionKey: Constants.CommunitySettingsSections.Overview
|
|
|
|
readonly property string sectionName: qsTr("Overview")
|
|
|
|
readonly property string sectionIcon: "show"
|
|
|
|
readonly property bool sectionEnabled: true
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
sourceComponent: OverviewSettingsPanel {
|
|
|
|
isOwner: root.isOwner
|
|
|
|
isAdmin: root.isAdmin
|
|
|
|
isTokenMaster: root.isTokenMasterOwner
|
|
|
|
communityId: root.community.id
|
|
|
|
name: root.community.name
|
|
|
|
description: root.community.description
|
|
|
|
introMessage: root.community.introMessage
|
|
|
|
outroMessage: root.community.outroMessage
|
|
|
|
logoImageData: root.community.image
|
|
|
|
bannerImageData: root.community.bannerImageData
|
|
|
|
color: root.community.color
|
|
|
|
tags: root.rootStore.communityTags
|
|
|
|
selectedTags: root.filteredSelectedTags
|
|
|
|
archiveSupportEnabled: root.community.historyArchiveSupportEnabled
|
|
|
|
archiveSupporVisible: root.community.isControlNode
|
|
|
|
requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess
|
|
|
|
pinMessagesEnabled: root.community.pinMessageAllMembersEnabled
|
|
|
|
editable: true
|
|
|
|
loginType: root.rootStore.loginType
|
|
|
|
isControlNode: root.isControlNode
|
|
|
|
communitySettingsDisabled: root.communitySettingsDisabled
|
|
|
|
overviewChartData: rootStore.overviewChartData
|
|
|
|
shardingEnabled: !isAdmin && !isTokenMaster && localAppSettings.wakuV2ShardedCommunitiesEnabled
|
|
|
|
shardIndex: root.community.shardIndex
|
|
|
|
shardingInProgress: root.chatCommunitySectionModule.shardingInProgress
|
|
|
|
pubsubTopic: root.community.pubsubTopic
|
|
|
|
pubsubTopicKey: root.community.pubsubTopicKey
|
|
|
|
|
|
|
|
sendModalPopup: root.sendModalPopup
|
|
|
|
ownerToken: tokensModelChangesTracker.ownerToken
|
|
|
|
|
|
|
|
isPendingOwnershipRequest: root.isPendingOwnershipRequest
|
|
|
|
|
|
|
|
onFinaliseOwnershipClicked: root.finaliseOwnershipClicked()
|
|
|
|
|
|
|
|
onCollectCommunityMetricsMessagesCount: {
|
|
|
|
rootStore.collectCommunityMetricsMessagesCount(intervals)
|
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
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
|
|
|
|
)
|
|
|
|
if (error) {
|
|
|
|
errorDialog.text = error.error
|
|
|
|
errorDialog.open()
|
|
|
|
}
|
2022-06-06 15:23:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onAirdropTokensClicked: root.goTo(Constants.CommunitySettingsSections.Airdrops)
|
|
|
|
onExportControlNodeClicked: {
|
|
|
|
if(!root.isControlNode)
|
|
|
|
return
|
2023-07-24 11:31:31 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
Global.openExportControlNodePopup(root.community)
|
|
|
|
}
|
2023-07-21 08:44:10 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onImportControlNodeClicked: {
|
|
|
|
if(root.isControlNode)
|
|
|
|
return
|
2023-07-21 08:44:10 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
Global.openImportControlNodePopup(root.community)
|
|
|
|
}
|
2023-09-22 10:12:06 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onMintOwnerTokenClicked: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
|
|
|
mintPanel.openNewTokenForm(false/*Collectible owner token*/)
|
|
|
|
}
|
2023-09-22 10:12:06 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onShardIndexEdited: if (root.community.shardIndex !== shardIndex) {
|
|
|
|
root.chatCommunitySectionModule.setCommunityShard(shardIndex)
|
|
|
|
}
|
2023-10-31 20:40:00 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// MEMBERS
|
|
|
|
Loader {
|
|
|
|
active: false
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
readonly property int sectionKey: Constants.CommunitySettingsSections.Members
|
|
|
|
readonly property string sectionName: qsTr("Members")
|
|
|
|
readonly property string sectionIcon: "group-chat"
|
|
|
|
readonly property bool sectionEnabled: true
|
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
sourceComponent: MembersSettingsPanel {
|
|
|
|
rootStore: root.rootStore
|
2024-10-22 12:39:42 +00:00
|
|
|
utilsStore: root.utilsStore
|
|
|
|
|
2024-10-26 01:25:50 +00:00
|
|
|
membersModel: root.joinedMembers
|
|
|
|
bannedMembersModel: root.bannedMembers
|
|
|
|
pendingMembersModel: root.pendingMembers
|
|
|
|
declinedMembersModel: root.declinedMembers
|
2024-10-22 12:39:42 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
editable: root.isAdmin || root.isOwner || root.isTokenMasterOwner
|
|
|
|
memberRole: community.memberRole
|
|
|
|
communityName: root.community.name
|
|
|
|
|
|
|
|
onKickUserClicked: root.rootStore.removeUserFromCommunity(id)
|
|
|
|
onBanUserClicked: root.rootStore.banUserFromCommunity(id, deleteAllMessages)
|
|
|
|
onUnbanUserClicked: root.rootStore.unbanUserFromCommunity(id)
|
|
|
|
onAcceptRequestToJoin: root.rootStore.acceptRequestToJoinCommunity(id, root.community.id)
|
|
|
|
onDeclineRequestToJoin: root.rootStore.declineRequestToJoinCommunity(id, root.community.id)
|
|
|
|
onViewMemberMessagesClicked: {
|
|
|
|
root.rootStore.loadCommunityMemberMessages(root.community.id, pubKey)
|
|
|
|
Global.openCommunityMemberMessagesPopupRequested(root.rootStore, root.chatCommunitySectionModule, pubKey, displayName)
|
|
|
|
}
|
2024-10-25 15:20:56 +00:00
|
|
|
onInviteNewPeopleClicked: Global.openInviteFriendsToCommunityPopup(root.community, root.chatCommunitySectionModule, null)
|
2024-03-20 10:50:10 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2022-06-09 15:27:14 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// PERMISISONS
|
|
|
|
Loader {
|
|
|
|
active: false
|
2023-07-04 14:35:00 +00:00
|
|
|
readonly property int sectionKey: Constants.CommunitySettingsSections.Permissions
|
|
|
|
readonly property string sectionName: qsTr("Permissions")
|
|
|
|
readonly property string sectionIcon: "objects"
|
|
|
|
readonly property bool sectionEnabled: true
|
2024-09-27 17:28:27 +00:00
|
|
|
|
|
|
|
sourceComponent: PermissionsSettingsPanel {
|
|
|
|
readonly property PermissionsStore permissionsStore:
|
|
|
|
rootStore.permissionsStore
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
permissionsModel: permissionsStore.permissionsModel
|
2023-03-09 10:08:43 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// temporary solution to provide icons for assets, similar
|
|
|
|
// method is used in wallet (constructing filename from asset's
|
|
|
|
// symbol) and is intended to be replaced by more robust
|
|
|
|
// solution soon.
|
2023-03-09 10:08:43 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
assetsModel: rootStore.assetsModel
|
2024-04-02 10:38:08 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
collectiblesModel: rootStore.collectiblesModel
|
|
|
|
channelsModel: rootStore.chatCommunitySectionModule.model
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
ensCommunityPermissionsEnabled: rootStore.ensCommunityPermissionsEnabled
|
2024-07-19 18:45:40 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
communityDetails: d.communityDetails
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onCreatePermissionRequested:
|
|
|
|
permissionsStore.createPermission(holdings, permissionType,
|
|
|
|
isPrivate, channels)
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onUpdatePermissionRequested:
|
|
|
|
permissionsStore.editPermission(
|
|
|
|
key, holdings, permissionType, channels, isPrivate)
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRemovePermissionRequested:
|
|
|
|
permissionsStore.removePermission(key)
|
2023-02-22 17:51:49 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onNavigateToMintTokenSettings: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
|
|
|
mintPanelLoader.item.openNewTokenForm(isAssetType)
|
|
|
|
}
|
2022-09-13 16:17:54 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2022-12-07 16:14:36 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// TOKEN
|
|
|
|
Loader {
|
|
|
|
id: mintPanelLoader
|
|
|
|
active: false
|
2023-07-04 14:35:00 +00:00
|
|
|
readonly property int sectionKey: Constants.CommunitySettingsSections.MintTokens
|
2023-07-05 14:52:47 +00:00
|
|
|
readonly property string sectionName: qsTr("Tokens")
|
2023-07-04 14:35:00 +00:00
|
|
|
readonly property string sectionIcon: "token"
|
2023-08-22 18:09:34 +00:00
|
|
|
readonly property bool sectionEnabled: true
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
sourceComponent: MintTokensSettingsPanel {
|
|
|
|
enabledChainIds: root.enabledChainIds
|
2023-03-08 13:44:47 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
readonly property CommunityTokensStore communityTokensStore:
|
|
|
|
rootStore.communityTokensStore
|
2023-07-18 17:34:57 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// General community props
|
|
|
|
communityId: root.community.id
|
|
|
|
communityName: root.community.name
|
|
|
|
communityLogo: root.community.image
|
|
|
|
communityColor: root.community.color
|
|
|
|
sendModalPopup: root.sendModalPopup
|
2023-07-18 17:34:57 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// User profile props
|
|
|
|
isOwner: root.isOwner
|
|
|
|
isAdmin: root.isAdmin
|
|
|
|
isTokenMasterOwner: root.isTokenMasterOwner
|
2023-07-18 17:34:57 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// Owner and TMaster properties
|
|
|
|
isOwnerTokenDeployed: tokensModelChangesTracker.isOwnerTokenDeployed
|
|
|
|
isTMasterTokenDeployed: tokensModelChangesTracker.isTMasterTokenDeployed
|
|
|
|
anyPrivilegedTokenFailed: tokensModelChangesTracker.isOwnerTokenFailed || tokensModelChangesTracker.isTMasterTokenFailed
|
|
|
|
ownerOrTMasterTokenItemsExist: tokensModelChangesTracker.ownerOrTMasterTokenItemsExist
|
2023-07-04 11:08:00 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// Models
|
|
|
|
tokensModel: root.community.communityTokens
|
2024-10-26 01:25:50 +00:00
|
|
|
membersModel: root.joinedMembers
|
2024-09-27 17:28:27 +00:00
|
|
|
flatNetworks: communityTokensStore.filteredFlatModel
|
|
|
|
accounts: root.walletAccountsModel
|
|
|
|
referenceAssetsBySymbolModel: root.tokensStore.assetsBySymbolModel
|
2023-07-04 11:08:00 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRegisterDeployFeesSubscriber: d.feesBroker.registerDeployFeesSubscriber(feeSubscriber)
|
2023-08-07 13:31:07 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRegisterSelfDestructFeesSubscriber: d.feesBroker.registerSelfDestructFeesSubscriber(feeSubscriber)
|
2023-08-07 13:31:07 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRegisterBurnTokenFeesSubscriber: d.feesBroker.registerBurnFeesSubscriber(feeSubscriber)
|
2024-06-03 08:31:26 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onStartTokenHoldersManagement: communityTokensStore.startTokenHoldersManagement(root.community.id, chainId, address)
|
2024-06-03 08:31:26 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onStopTokenHoldersManagement: communityTokensStore.stopTokenHoldersManagement()
|
2024-07-22 13:52:44 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onEnableNetwork: root.enableNetwork(chainId)
|
2023-05-05 11:03:59 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onMintCollectible:
|
|
|
|
communityTokensStore.deployCollectible(
|
|
|
|
root.community.id, collectibleItem)
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onMintAsset:
|
|
|
|
communityTokensStore.deployAsset(root.community.id, assetItem)
|
2023-07-18 12:39:38 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onMintOwnerToken:
|
|
|
|
communityTokensStore.deployOwnerToken(
|
|
|
|
root.community.id, ownerToken, tMasterToken)
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRemotelyDestructCollectibles:
|
|
|
|
communityTokensStore.remoteSelfDestructCollectibles(
|
|
|
|
root.community.id, walletsAndAmounts, tokenKey, accountAddress)
|
2023-09-21 13:02:18 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRemotelyDestructAndBan:
|
|
|
|
communityTokensStore.remotelyDestructAndBan(
|
|
|
|
root.community.id, contactId, tokenKey, accountAddress)
|
2023-09-21 13:02:18 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRemotelyDestructAndKick:
|
|
|
|
communityTokensStore.remotelyDestructAndKick(
|
|
|
|
root.community.id, contactId, tokenKey, accountAddress)
|
2023-03-31 12:52:51 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onBurnToken:
|
|
|
|
communityTokensStore.burnToken(root.community.id, tokenKey, amount, accountAddress)
|
2024-05-21 08:53:33 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onDeleteToken:
|
|
|
|
communityTokensStore.deleteToken(root.community.id, tokenKey)
|
2023-04-28 18:48:20 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onRefreshToken:
|
|
|
|
communityTokensStore.refreshToken(tokenKey)
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onAirdropToken: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.Airdrops)
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// Force a token selection to be airdroped with given amount
|
|
|
|
airdropPanelLoader.item.selectToken(tokenKey, amount, type)
|
2023-08-31 22:26:24 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// Set given addresses as recipients
|
|
|
|
airdropPanelLoader.item.addAddresses(addresses)
|
|
|
|
}
|
|
|
|
|
|
|
|
onKickUserRequested: root.rootStore.removeUserFromCommunity(contactId)
|
|
|
|
onBanUserRequested: root.rootStore.banUserFromCommunity(contactId)
|
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2023-01-09 12:51:31 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// AIRDROPS
|
|
|
|
Loader {
|
|
|
|
id: airdropPanelLoader
|
|
|
|
active: false
|
2023-04-17 12:11:31 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
readonly property int sectionKey: Constants.CommunitySettingsSections.Airdrops
|
|
|
|
readonly property string sectionName: qsTr("Airdrops")
|
|
|
|
readonly property string sectionIcon: "airdrop"
|
2023-08-22 18:09:34 +00:00
|
|
|
readonly property bool sectionEnabled: true
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
sourceComponent: AirdropsSettingsPanel {
|
|
|
|
id: airdropsSettingsPanel
|
2023-07-18 17:34:57 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
communityDetails: d.communityDetails
|
2023-07-06 12:33:27 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// Profile type
|
|
|
|
isOwner: root.isOwner
|
|
|
|
isTokenMasterOwner: root.isTokenMasterOwner
|
|
|
|
isAdmin: root.isAdmin
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
// Owner and TMaster properties
|
|
|
|
isOwnerTokenDeployed: tokensModelChangesTracker.isOwnerTokenDeployed
|
|
|
|
isTMasterTokenDeployed: tokensModelChangesTracker.isTMasterTokenDeployed
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
readonly property CommunityTokensStore communityTokensStore:
|
|
|
|
rootStore.communityTokensStore
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
readonly property RolesRenamingModel renamedTokensBySymbolModel: RolesRenamingModel {
|
|
|
|
sourceModel: root.community.communityTokens || null
|
|
|
|
mapping: [
|
|
|
|
RoleRename {
|
|
|
|
from: "symbol"
|
|
|
|
to: "key"
|
|
|
|
},
|
|
|
|
RoleRename {
|
|
|
|
from: "image"
|
|
|
|
to: "iconSource"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
assetsModel: SortFilterProxyModel {
|
|
|
|
sourceModel: renamedTokensBySymbolModel
|
2023-07-04 11:08:00 +00:00
|
|
|
filters: ValueFilter {
|
|
|
|
roleName: "tokenType"
|
|
|
|
value: Constants.TokenType.ERC20
|
2023-04-25 21:24:04 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
proxyRoles: [
|
2024-09-27 17:28:27 +00:00
|
|
|
ConstantRole {
|
2023-07-04 11:08:00 +00:00
|
|
|
name: "category"
|
2024-09-27 17:28:27 +00:00
|
|
|
value: TokenCategories.Category.Own
|
2023-07-06 09:58:15 +00:00
|
|
|
},
|
2024-09-27 17:28:27 +00:00
|
|
|
ConstantRole {
|
2023-07-06 09:58:15 +00:00
|
|
|
name: "communityId"
|
2024-09-27 17:28:27 +00:00
|
|
|
value: ""
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
|
|
|
]
|
2023-04-25 21:24:04 +00:00
|
|
|
}
|
2024-09-27 17:28:27 +00:00
|
|
|
collectiblesModel: SortFilterProxyModel {
|
|
|
|
sourceModel: renamedTokensBySymbolModel
|
2023-09-07 16:11:09 +00:00
|
|
|
filters: [
|
|
|
|
ValueFilter {
|
|
|
|
roleName: "tokenType"
|
|
|
|
value: Constants.TokenType.ERC721
|
|
|
|
},
|
2024-09-27 17:28:27 +00:00
|
|
|
AnyOf {
|
|
|
|
ValueFilter {
|
|
|
|
roleName: "privilegesLevel"
|
|
|
|
value: Constants.TokenPrivilegesLevel.Community
|
|
|
|
}
|
|
|
|
ValueFilter {
|
|
|
|
roleName: "privilegesLevel"
|
|
|
|
value: Constants.TokenPrivilegesLevel.TMaster
|
|
|
|
enabled: root.isOwner
|
2023-09-07 16:11:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2023-07-04 11:08:00 +00:00
|
|
|
proxyRoles: [
|
2024-09-27 17:28:27 +00:00
|
|
|
ConstantRole {
|
2023-07-04 11:08:00 +00:00
|
|
|
name: "category"
|
2024-09-27 17:28:27 +00:00
|
|
|
value: TokenCategories.Category.Own
|
2023-07-04 11:08:00 +00:00
|
|
|
},
|
2024-09-27 17:28:27 +00:00
|
|
|
ConstantRole {
|
2023-07-06 09:58:15 +00:00
|
|
|
name: "communityId"
|
2024-09-27 17:28:27 +00:00
|
|
|
value: ""
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
|
|
|
]
|
2023-06-14 07:19:45 +00:00
|
|
|
}
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
Connections {
|
|
|
|
target: root.rootStore.communityTokensStore
|
2023-03-13 16:32:14 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
function onAirdropStateChanged(communityId, tokenName, chainName, status, url) {
|
|
|
|
if (root.community.id !== communityId) {
|
|
|
|
return
|
|
|
|
}
|
2023-10-31 20:40:00 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
if (status == Constants.ContractTransactionStatus.InProgress) {
|
|
|
|
airdropsSettingsPanel.navigateBack()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-10-26 01:25:50 +00:00
|
|
|
membersModel: root.joinedMembers
|
2024-09-27 17:28:27 +00:00
|
|
|
enabledChainIds: root.enabledChainIds
|
|
|
|
onEnableNetwork: root.enableNetwork(chainId)
|
|
|
|
|
|
|
|
accountsModel: root.walletAccountsModel
|
|
|
|
onAirdropClicked: communityTokensStore.airdrop(
|
|
|
|
root.community.id, airdropTokens, addresses,
|
|
|
|
feeAccountAddress)
|
2023-04-17 12:11:31 +00:00
|
|
|
|
2024-09-27 17:28:27 +00:00
|
|
|
onNavigateToMintTokenSettings: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
|
|
|
mintPanelLoader.item.openNewTokenForm(isAssetType)
|
|
|
|
}
|
|
|
|
|
|
|
|
onRegisterAirdropFeeSubscriber: d.feesBroker.registerAirdropFeesSubscriber(feeSubscriber)
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
2023-03-24 12:41:46 +00:00
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
property int currentIndex: 0
|
2023-04-06 11:11:57 +00:00
|
|
|
|
2023-06-21 14:20:39 +00:00
|
|
|
readonly property QtObject communityDetails: QtObject {
|
|
|
|
readonly property string id: root.community.id
|
|
|
|
readonly property string name: root.community.name
|
|
|
|
readonly property string image: root.community.image
|
|
|
|
readonly property string color: root.community.color
|
|
|
|
readonly property bool owner: root.community.memberRole === Constants.memberRole.owner
|
2023-06-29 07:37:49 +00:00
|
|
|
readonly property bool admin: root.community.memberRole === Constants.memberRole.admin
|
2023-08-22 18:09:34 +00:00
|
|
|
readonly property bool tokenMaster: root.community.memberRole === Constants.memberRole.tokenMaster
|
2023-06-21 14:20:39 +00:00
|
|
|
}
|
|
|
|
|
2023-09-01 09:27:44 +00:00
|
|
|
readonly property TransactionFeesBroker feesBroker: TransactionFeesBroker {
|
|
|
|
communityTokensStore: root.rootStore.communityTokensStore
|
2024-10-04 11:01:08 +00:00
|
|
|
active: root.Window.window.active
|
2023-09-01 09:27:44 +00:00
|
|
|
}
|
|
|
|
|
2023-04-06 11:11:57 +00:00
|
|
|
function goTo(section: int, subSection: int) {
|
2023-07-04 14:35:00 +00:00
|
|
|
const stackContent = stackLayout.children
|
2023-06-05 13:49:36 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
for (let i = 0; stackContent.length; i++) {
|
|
|
|
const item = stackContent[i]
|
|
|
|
|
|
|
|
if (item.sectionKey === section) {
|
|
|
|
d.currentIndex = i
|
2023-06-05 13:49:36 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
if(item.goTo)
|
|
|
|
item.goTo(subSection)
|
2023-06-05 13:49:36 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
break
|
|
|
|
}
|
2023-04-25 21:24:04 +00:00
|
|
|
}
|
2023-04-06 11:11:57 +00:00
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-05-26 15:46:02 +00:00
|
|
|
|
2023-07-18 17:34:57 +00:00
|
|
|
StatusQUtils.ModelChangeTracker {
|
|
|
|
id: tokensModelChangesTracker
|
|
|
|
|
2023-10-10 08:47:03 +00:00
|
|
|
Component.onCompleted: {
|
|
|
|
updateOwnerAndTMasterProperties()
|
|
|
|
}
|
|
|
|
|
2023-07-18 17:34:57 +00:00
|
|
|
// Owner and TMaster token deployment states
|
|
|
|
property bool isOwnerTokenDeployed: false
|
|
|
|
property bool isTMasterTokenDeployed: false
|
2023-08-01 10:31:50 +00:00
|
|
|
property bool isOwnerTokenFailed: false
|
|
|
|
property bool isTMasterTokenFailed: false
|
2023-11-24 08:48:50 +00:00
|
|
|
property var ownerToken: null
|
2023-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// It will monitorize if Owner and/or TMaster token items are included in the `model` despite the deployment state
|
|
|
|
property bool ownerOrTMasterTokenItemsExist: false
|
|
|
|
|
|
|
|
function checkIfPrivilegedTokenItemsExist() {
|
2023-08-04 16:41:21 +00:00
|
|
|
return StatusQUtils.ModelUtils.contains(model, "privilegesLevel", Constants.TokenPrivilegesLevel.Owner) ||
|
|
|
|
StatusQUtils.ModelUtils.contains(model, "privilegesLevel", Constants.TokenPrivilegesLevel.TMaster)
|
2023-07-18 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
2023-10-10 08:47:03 +00:00
|
|
|
function updateOwnerAndTMasterProperties() {
|
|
|
|
// It will update property to know if Owner and TMaster token items have been added into the tokens list.
|
|
|
|
ownerOrTMasterTokenItemsExist = checkIfPrivilegedTokenItemsExist()
|
|
|
|
if(!ownerOrTMasterTokenItemsExist)
|
|
|
|
return
|
|
|
|
// It monitors the deployment:
|
|
|
|
if(!isOwnerTokenDeployed) {
|
|
|
|
isOwnerTokenDeployed = reviewTokenDeployState(true, Constants.ContractTransactionStatus.Completed)
|
|
|
|
isOwnerTokenFailed = reviewTokenDeployState(true, Constants.ContractTransactionStatus.Failed)
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!isTMasterTokenDeployed) {
|
|
|
|
isTMasterTokenDeployed = reviewTokenDeployState(false, Constants.ContractTransactionStatus.Completed)
|
|
|
|
isTMasterTokenFailed = reviewTokenDeployState(false, Constants.ContractTransactionStatus.Failed)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Not necessary to track more changes since privileged tokens have been correctly deployed.
|
2023-11-24 08:48:50 +00:00
|
|
|
if(isOwnerTokenDeployed && isTMasterTokenDeployed) {
|
|
|
|
tokensModelChangesTracker.ownerToken = StatusQUtils.ModelUtils.getByKey(model, "privilegesLevel", Constants.TokenPrivilegesLevel.Owner)
|
2023-10-10 08:47:03 +00:00
|
|
|
tokensModelChangesTracker.enabled = false
|
2023-11-24 08:48:50 +00:00
|
|
|
}
|
2023-10-10 08:47:03 +00:00
|
|
|
}
|
|
|
|
|
2023-07-11 13:23:00 +00:00
|
|
|
function reviewTokenDeployState(isOwner, deployState) {
|
|
|
|
const privileges = isOwner ? Constants.TokenPrivilegesLevel.Owner : Constants.TokenPrivilegesLevel.TMaster
|
|
|
|
const index = StatusQUtils.ModelUtils.indexOf(model, "privilegesLevel", privileges)
|
2023-07-18 17:34:57 +00:00
|
|
|
if(index === -1)
|
|
|
|
return false
|
|
|
|
|
2023-08-01 10:31:50 +00:00
|
|
|
const token = StatusQUtils.ModelUtils.get(model, index)
|
2023-07-18 17:34:57 +00:00
|
|
|
// Some assertions:
|
2023-07-11 13:23:00 +00:00
|
|
|
if(isOwner && token.privilegesLevel !== Constants.TokenPrivilegesLevel.Owner)
|
|
|
|
return false
|
|
|
|
if(!isOwner && token.privilegesLevel !== Constants.TokenPrivilegesLevel.TMaster)
|
2023-07-18 17:34:57 +00:00
|
|
|
return false
|
|
|
|
|
|
|
|
// Deploy state check:
|
2023-07-11 13:23:00 +00:00
|
|
|
return token.deployState === deployState
|
2023-07-18 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model: root.community.communityTokens
|
|
|
|
|
|
|
|
onRevisionChanged: {
|
2023-10-10 08:47:03 +00:00
|
|
|
updateOwnerAndTMasterProperties()
|
2023-07-18 17:34:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-26 15:46:02 +00:00
|
|
|
MessageDialog {
|
|
|
|
id: errorDialog
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2022-05-26 15:46:02 +00:00
|
|
|
title: qsTr("Error editing the community")
|
|
|
|
icon: StandardIcon.Critical
|
|
|
|
standardButtons: StandardButton.Ok
|
|
|
|
}
|
2022-06-06 15:23:24 +00:00
|
|
|
|
2023-03-21 11:21:23 +00:00
|
|
|
Component {
|
|
|
|
id: noPermissionsPopupCmp
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2023-03-21 11:21:23 +00:00
|
|
|
NoPermissionsToJoinPopup {
|
|
|
|
onRejectButtonClicked: {
|
|
|
|
root.rootStore.declineRequestToJoinCommunity(requestId, communityId)
|
|
|
|
close()
|
|
|
|
}
|
|
|
|
onClosed: destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2023-03-21 11:21:23 +00:00
|
|
|
Connections {
|
2023-07-04 14:35:00 +00:00
|
|
|
target: rootStore.communityTokensStore
|
|
|
|
|
|
|
|
function onRemoteDestructStateChanged(communityId, tokenName, status, url) {
|
|
|
|
if (root.community.id !== communityId)
|
|
|
|
return
|
|
|
|
|
|
|
|
let title = ""
|
|
|
|
let loading = false
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
case Constants.ContractTransactionStatus.InProgress:
|
|
|
|
title = qsTr("Remotely destroying tokens...")
|
|
|
|
loading = true
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Completed:
|
|
|
|
title = qsTr("%1 tokens destroyed").arg(tokenName)
|
|
|
|
type = Constants.ephemeralNotificationType.success
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Failed:
|
|
|
|
title = qsTr("%1 tokens destruction failed").arg(tokenName)
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
console.warn("Unknown destruction state: "+status)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
Global.displayToastMessage(title, qsTr("View on etherscan"), "",
|
|
|
|
loading, type, url)
|
|
|
|
}
|
|
|
|
|
|
|
|
function onAirdropStateChanged(communityId, tokenName, chainName,
|
|
|
|
status, url) {
|
|
|
|
if (root.community.id !== communityId)
|
|
|
|
return
|
|
|
|
|
|
|
|
let title = ""
|
|
|
|
let loading = false
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
case Constants.ContractTransactionStatus.InProgress:
|
|
|
|
title = qsTr("Airdrop on %1 in progress...").arg(chainName)
|
|
|
|
loading = true
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Completed:
|
|
|
|
title = qsTr("Airdrop on %1 in complete").arg(chainName)
|
|
|
|
type = Constants.ephemeralNotificationType.success
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Failed:
|
|
|
|
title = qsTr("Airdrop on %1 failed").arg(chainName)
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
console.warn("Unknown airdrop state: "+status)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
Global.displayToastMessage(title, qsTr("View on etherscan"), "",
|
|
|
|
loading, type, url)
|
|
|
|
}
|
|
|
|
|
|
|
|
function onBurnStateChanged(communityId, tokenName, status, url) {
|
|
|
|
if (root.community.id !== communityId)
|
|
|
|
return
|
|
|
|
|
|
|
|
let title = ""
|
|
|
|
let loading = false
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
case Constants.ContractTransactionStatus.InProgress:
|
|
|
|
title = qsTr("%1 being burned...").arg(tokenName)
|
|
|
|
loading = true
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Completed:
|
|
|
|
title = qsTr("%1 burning is complete").arg(tokenName)
|
|
|
|
type = Constants.ephemeralNotificationType.success
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Failed:
|
|
|
|
title = qsTr("%1 burning is failed").arg(tokenName)
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
console.warn("Unknown burning state: "+status)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
Global.displayToastMessage(title, qsTr("View on etherscan"), "",
|
|
|
|
loading, type, url)
|
2023-03-21 11:21:23 +00:00
|
|
|
}
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
function onDeploymentStateChanged(communityId, status, url) {
|
|
|
|
if (root.community.id !== communityId)
|
|
|
|
return
|
|
|
|
|
|
|
|
let title = ""
|
|
|
|
let loading = false
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
|
|
|
|
switch (status) {
|
|
|
|
case Constants.ContractTransactionStatus.InProgress:
|
|
|
|
title = qsTr("Token is being minted...")
|
|
|
|
loading = true
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Completed:
|
|
|
|
title = qsTr("Token minting finished")
|
|
|
|
type = Constants.ephemeralNotificationType.success
|
|
|
|
break
|
|
|
|
case Constants.ContractTransactionStatus.Failed:
|
|
|
|
title = qsTr("Token minting failed")
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
console.warn("Unknown deploy state: "+status)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-07-05 11:46:56 +00:00
|
|
|
Global.displayToastMessage(title, url === "" ? qsTr("Something went wrong") : qsTr("View on etherscan"), "",
|
2023-07-04 14:35:00 +00:00
|
|
|
loading, type, url)
|
|
|
|
}
|
2023-07-11 13:23:00 +00:00
|
|
|
|
|
|
|
function onOwnerTokenDeploymentStateChanged(communityId, status, url) {
|
|
|
|
if (root.community.id !== communityId)
|
|
|
|
return
|
|
|
|
|
|
|
|
if (status === Constants.ContractTransactionStatus.Completed)
|
|
|
|
{
|
|
|
|
let title1 = qsTr("%1 Owner and TokenMaster tokens minting complete").arg(community.name)
|
|
|
|
let title2 = qsTr("%1 Owner token airdropped to you").arg(community.name)
|
|
|
|
let title3 = qsTr("%1 Owner and TokenMaster permissions created").arg(community.name)
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
|
|
|
|
Global.displayToastMessage(title1, url, "", true, type, url)
|
|
|
|
Global.displayToastMessage(title2, url, "", true, type, url)
|
|
|
|
Global.displayToastMessage(title3, url, "", true, type, url)
|
|
|
|
} else if (status === Constants.ContractTransactionStatus.Failed) {
|
|
|
|
let title = qsTr("%1 Owner and TokenMaster tokens minting failed").arg(community.name)
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
Global.displayToastMessage(title, url, "", true, type, url)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function onOwnerTokenDeploymentStarted(communityId, url) {
|
|
|
|
if (root.community.id !== communityId)
|
|
|
|
return
|
|
|
|
|
|
|
|
let title1 = qsTr("%1 Owner and TokenMaster tokens are being minted...").arg(community.name)
|
|
|
|
let title2 = qsTr("Airdropping %1 Owner token to you...").arg(community.name)
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
|
|
|
|
Global.displayToastMessage(title1, url, "", true, type, url)
|
|
|
|
Global.displayToastMessage(title2, url, "", true, type, url)
|
|
|
|
}
|
2023-07-04 14:35:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: root.chatCommunitySectionModule
|
|
|
|
|
|
|
|
function onOpenNoPermissionsToJoinPopup(communityName: string,
|
|
|
|
userName: string, communityId:
|
|
|
|
string, requestId: string) {
|
|
|
|
const properties = {
|
|
|
|
communityName: communityName,
|
|
|
|
userName: userName,
|
|
|
|
communityId: communityId,
|
|
|
|
requestId: requestId
|
|
|
|
}
|
|
|
|
|
|
|
|
Global.openPopup(noPermissionsPopupCmp, properties)
|
|
|
|
}
|
2023-03-21 11:21:23 +00:00
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|