2023-04-06 11:11:57 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.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
|
|
|
|
|
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-04-06 14:23:19 +00:00
|
|
|
import shared.views.chat 1.0
|
2023-09-15 08:51:06 +00:00
|
|
|
import shared.stores.send 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
|
|
|
|
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
|
|
|
|
2022-09-27 12:16:03 +00:00
|
|
|
property var rootStore
|
2022-03-23 15:38:23 +00:00
|
|
|
property var chatCommunitySectionModule
|
2023-11-22 13:50:07 +00:00
|
|
|
required property TokensStore tokensStore
|
2023-03-17 18:58:07 +00:00
|
|
|
property var community
|
2023-11-28 19:16:18 +00:00
|
|
|
required property var 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
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
backButtonName: stackLayout.children[d.currentIndex].previousPageName || ""
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onBackButtonClicked: stackLayout.children[d.currentIndex].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
|
|
|
|
topMargin: Style.current.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
|
2022-12-13 10:45:26 +00:00
|
|
|
subTitle: qsTr("%n member(s)", "", community.members.count || 0)
|
2022-10-05 12:14:29 +00:00
|
|
|
asset.name: community.image
|
|
|
|
asset.color: community.color
|
|
|
|
asset.isImage: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.leftMargin: Style.current.halfPadding
|
|
|
|
Layout.rightMargin: Style.current.halfPadding
|
|
|
|
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
|
2023-09-22 09:58:02 +00:00
|
|
|
Layout.leftMargin: Style.current.halfPadding
|
2022-10-05 12:14:29 +00:00
|
|
|
Layout.rightMargin: Style.current.padding
|
2023-07-04 14:35:00 +00:00
|
|
|
model: stackLayout.children
|
2023-09-22 09:58:02 +00:00
|
|
|
spacing: Style.current.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
|
|
|
|
|
|
|
|
OverviewSettingsPanel {
|
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
|
|
|
|
|
2023-09-14 10:02:51 +00:00
|
|
|
isOwner: root.isOwner
|
2024-04-17 13:25:45 +00:00
|
|
|
isAdmin: root.isAdmin
|
|
|
|
isTokenMaster: root.isTokenMasterOwner
|
2023-07-04 11:08:00 +00:00
|
|
|
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
|
2023-07-21 21:05:42 +00:00
|
|
|
archiveSupporVisible: root.community.isControlNode
|
2023-07-04 11:08:00 +00:00
|
|
|
requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess
|
|
|
|
pinMessagesEnabled: root.community.pinMessageAllMembersEnabled
|
|
|
|
editable: true
|
2023-07-06 08:02:41 +00:00
|
|
|
loginType: root.rootStore.loginType
|
2023-07-19 05:58:21 +00:00
|
|
|
isControlNode: root.isControlNode
|
2023-07-24 11:31:31 +00:00
|
|
|
communitySettingsDisabled: root.communitySettingsDisabled
|
2023-08-02 16:03:52 +00:00
|
|
|
overviewChartData: rootStore.overviewChartData
|
2024-04-17 13:25:45 +00:00
|
|
|
shardingEnabled: !isAdmin && !isTokenMaster && localAppSettings.wakuV2ShardedCommunitiesEnabled
|
2023-10-31 20:40:00 +00:00
|
|
|
shardIndex: root.community.shardIndex
|
|
|
|
shardingInProgress: root.chatCommunitySectionModule.shardingInProgress
|
|
|
|
pubsubTopic: root.community.pubsubTopic
|
|
|
|
pubsubTopicKey: root.community.pubsubTopicKey
|
2023-08-02 16:03:52 +00:00
|
|
|
|
2023-09-14 10:02:51 +00:00
|
|
|
sendModalPopup: root.sendModalPopup
|
2023-11-24 08:48:50 +00:00
|
|
|
ownerToken: tokensModelChangesTracker.ownerToken
|
2023-09-14 10:02:51 +00:00
|
|
|
|
2023-09-28 10:09:47 +00:00
|
|
|
isPendingOwnershipRequest: root.isPendingOwnershipRequest
|
|
|
|
|
2023-10-23 11:32:50 +00:00
|
|
|
onFinaliseOwnershipClicked: root.finaliseOwnershipClicked()
|
|
|
|
|
2023-08-03 20:30:34 +00:00
|
|
|
onCollectCommunityMetricsMessagesCount: {
|
|
|
|
rootStore.collectCommunityMetricsMessagesCount(intervals)
|
2023-08-02 16:03:52 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +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),
|
2023-07-04 14:35:00 +00:00
|
|
|
item.options.requestToJoinEnabled ? Constants.communityChatOnRequestAccess
|
|
|
|
: Constants.communityChatPublicAccess,
|
2023-07-04 11:08:00 +00:00
|
|
|
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
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2022-06-06 15:23:24 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onInviteNewPeopleClicked: {
|
|
|
|
Global.openInviteFriendsToCommunityPopup(root.community,
|
|
|
|
root.chatCommunitySectionModule,
|
|
|
|
null)
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onAirdropTokensClicked: root.goTo(Constants.CommunitySettingsSections.Airdrops)
|
2023-07-19 05:58:21 +00:00
|
|
|
onExportControlNodeClicked: {
|
|
|
|
if(!root.isControlNode)
|
|
|
|
return
|
2023-07-24 11:31:31 +00:00
|
|
|
|
2023-09-12 09:26:57 +00:00
|
|
|
Global.openExportControlNodePopup(root.community)
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2023-07-21 08:44:10 +00:00
|
|
|
|
|
|
|
onImportControlNodeClicked: {
|
|
|
|
if(root.isControlNode)
|
|
|
|
return
|
|
|
|
|
2023-09-12 09:26:57 +00:00
|
|
|
Global.openImportControlNodePopup(root.community)
|
2023-07-21 08:44:10 +00:00
|
|
|
}
|
2023-09-22 10:12:06 +00:00
|
|
|
|
|
|
|
onMintOwnerTokenClicked: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
|
|
|
mintPanel.openNewTokenForm(false/*Collectible owner token*/)
|
|
|
|
}
|
|
|
|
|
2024-03-20 10:50:10 +00:00
|
|
|
onShardIndexEdited: if (root.community.shardIndex !== shardIndex) {
|
2023-10-31 20:40:00 +00:00
|
|
|
root.chatCommunitySectionModule.setCommunityShard(shardIndex)
|
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MembersSettingsPanel {
|
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
|
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
rootStore: root.rootStore
|
|
|
|
membersModel: root.community.members
|
|
|
|
bannedMembersModel: root.community.bannedMembers
|
|
|
|
pendingMemberRequestsModel: root.community.pendingMemberRequests
|
|
|
|
declinedMemberRequestsModel: root.community.declinedMemberRequests
|
2023-08-22 18:09:34 +00:00
|
|
|
editable: root.isAdmin || root.isOwner || root.isTokenMasterOwner
|
2023-08-21 19:07:40 +00:00
|
|
|
memberRole: community.memberRole
|
2023-07-04 11:08:00 +00:00
|
|
|
communityName: root.community.name
|
|
|
|
|
|
|
|
onKickUserClicked: root.rootStore.removeUserFromCommunity(id)
|
2024-02-22 11:01:01 +00:00
|
|
|
onBanUserClicked: root.rootStore.banUserFromCommunity(id, deleteAllMessages)
|
2023-07-04 11:08:00 +00:00
|
|
|
onUnbanUserClicked: root.rootStore.unbanUserFromCommunity(id)
|
|
|
|
onAcceptRequestToJoin: root.rootStore.acceptRequestToJoinCommunity(id, root.community.id)
|
|
|
|
onDeclineRequestToJoin: root.rootStore.declineRequestToJoinCommunity(id, root.community.id)
|
2024-03-20 10:50:10 +00:00
|
|
|
onViewMemberMessagesClicked: {
|
|
|
|
root.rootStore.loadCommunityMemberMessages(root.community.id, pubKey)
|
|
|
|
Global.openCommunityMemberMessagesPopupRequested(root.rootStore, root.chatCommunitySectionModule, pubKey, displayName)
|
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2022-06-09 15:27:14 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
PermissionsSettingsPanel {
|
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
|
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
readonly property PermissionsStore permissionsStore:
|
|
|
|
rootStore.permissionsStore
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
permissionsModel: permissionsStore.permissionsModel
|
2023-03-09 10:08:43 +00:00
|
|
|
|
2023-07-04 11:08:00 +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
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
assetsModel: rootStore.assetsModel
|
2024-04-02 10:38:08 +00:00
|
|
|
|
2024-05-07 13:58:15 +00:00
|
|
|
collectiblesModel: rootStore.collectiblesModel
|
2023-07-04 11:08:00 +00:00
|
|
|
channelsModel: rootStore.chatCommunitySectionModule.model
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2024-07-19 18:45:40 +00:00
|
|
|
ensCommunityPermissionsEnabled: rootStore.ensCommunityPermissionsEnabled
|
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
communityDetails: d.communityDetails
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onCreatePermissionRequested:
|
|
|
|
permissionsStore.createPermission(holdings, permissionType,
|
|
|
|
isPrivate, channels)
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onUpdatePermissionRequested:
|
|
|
|
permissionsStore.editPermission(
|
|
|
|
key, holdings, permissionType, channels, isPrivate)
|
2023-03-07 08:47:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onRemovePermissionRequested:
|
|
|
|
permissionsStore.removePermission(key)
|
2023-02-22 17:51:49 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onNavigateToMintTokenSettings: {
|
2023-07-04 14:35:00 +00:00
|
|
|
root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
2023-07-05 21:43:15 +00:00
|
|
|
mintPanel.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
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
MintTokensSettingsPanel {
|
|
|
|
id: mintPanel
|
2023-03-23 13:17:07 +00:00
|
|
|
|
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
|
2024-07-22 13:52:44 +00:00
|
|
|
enabledChainIds: root.enabledChainIds
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
readonly property CommunityTokensStore communityTokensStore:
|
|
|
|
rootStore.communityTokensStore
|
2023-03-08 13:44:47 +00:00
|
|
|
|
2023-07-18 17:34:57 +00:00
|
|
|
// General community props
|
2023-08-30 07:20:28 +00:00
|
|
|
communityId: root.community.id
|
2023-07-04 11:08:00 +00:00
|
|
|
communityName: root.community.name
|
2023-07-10 14:12:25 +00:00
|
|
|
communityLogo: root.community.image
|
|
|
|
communityColor: root.community.color
|
2023-09-14 10:02:51 +00:00
|
|
|
sendModalPopup: root.sendModalPopup
|
2023-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// User profile props
|
2023-07-06 12:33:27 +00:00
|
|
|
isOwner: root.isOwner
|
|
|
|
isAdmin: root.isAdmin
|
2023-08-14 08:32:10 +00:00
|
|
|
isTokenMasterOwner: root.isTokenMasterOwner
|
2023-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// Owner and TMaster properties
|
|
|
|
isOwnerTokenDeployed: tokensModelChangesTracker.isOwnerTokenDeployed
|
|
|
|
isTMasterTokenDeployed: tokensModelChangesTracker.isTMasterTokenDeployed
|
2023-08-01 10:31:50 +00:00
|
|
|
anyPrivilegedTokenFailed: tokensModelChangesTracker.isOwnerTokenFailed || tokensModelChangesTracker.isTMasterTokenFailed
|
2023-09-22 10:12:06 +00:00
|
|
|
ownerOrTMasterTokenItemsExist: tokensModelChangesTracker.ownerOrTMasterTokenItemsExist
|
2023-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// Models
|
2023-07-04 11:08:00 +00:00
|
|
|
tokensModel: root.community.communityTokens
|
2024-02-28 18:02:44 +00:00
|
|
|
membersModel: root.community.members
|
2024-03-13 17:38:16 +00:00
|
|
|
flatNetworks: communityTokensStore.filteredFlatModel
|
2023-08-09 12:31:58 +00:00
|
|
|
accounts: root.walletAccountsModel
|
2023-11-22 13:50:07 +00:00
|
|
|
referenceAssetsBySymbolModel: root.tokensStore.assetsBySymbolModel
|
2023-07-04 11:08:00 +00:00
|
|
|
|
2023-09-01 09:27:44 +00:00
|
|
|
onRegisterDeployFeesSubscriber: d.feesBroker.registerDeployFeesSubscriber(feeSubscriber)
|
2023-07-04 11:08:00 +00:00
|
|
|
|
2023-09-01 09:27:44 +00:00
|
|
|
onRegisterSelfDestructFeesSubscriber: d.feesBroker.registerSelfDestructFeesSubscriber(feeSubscriber)
|
2023-08-07 13:31:07 +00:00
|
|
|
|
2023-09-01 09:27:44 +00:00
|
|
|
onRegisterBurnTokenFeesSubscriber: d.feesBroker.registerBurnFeesSubscriber(feeSubscriber)
|
2023-08-07 13:31:07 +00:00
|
|
|
|
2024-06-03 08:31:26 +00:00
|
|
|
onStartTokenHoldersManagement: communityTokensStore.startTokenHoldersManagement(chainId, address)
|
|
|
|
|
|
|
|
onStopTokenHoldersManagement: communityTokensStore.stopTokenHoldersManagement()
|
|
|
|
|
2024-07-22 13:52:44 +00:00
|
|
|
onEnableNetwork: root.enableNetwork(chainId)
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onMintCollectible:
|
|
|
|
communityTokensStore.deployCollectible(
|
|
|
|
root.community.id, collectibleItem)
|
2023-05-05 11:03:59 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onMintAsset:
|
|
|
|
communityTokensStore.deployAsset(root.community.id, assetItem)
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-18 12:39:38 +00:00
|
|
|
onMintOwnerToken:
|
|
|
|
communityTokensStore.deployOwnerToken(
|
|
|
|
root.community.id, ownerToken, tMasterToken)
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onRemotelyDestructCollectibles:
|
|
|
|
communityTokensStore.remoteSelfDestructCollectibles(
|
2023-08-17 13:58:04 +00:00
|
|
|
root.community.id, walletsAndAmounts, tokenKey, accountAddress)
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-09-21 13:02:18 +00:00
|
|
|
onRemotelyDestructAndBan:
|
|
|
|
communityTokensStore.remotelyDestructAndBan(
|
|
|
|
root.community.id, contactId, tokenKey, accountAddress)
|
|
|
|
|
|
|
|
onRemotelyDestructAndKick:
|
|
|
|
communityTokensStore.remotelyDestructAndKick(
|
|
|
|
root.community.id, contactId, tokenKey, accountAddress)
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onBurnToken:
|
2023-08-07 13:31:07 +00:00
|
|
|
communityTokensStore.burnToken(root.community.id, tokenKey, amount, accountAddress)
|
2023-03-31 12:52:51 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onDeleteToken:
|
|
|
|
communityTokensStore.deleteToken(root.community.id, tokenKey)
|
2024-05-21 08:53:33 +00:00
|
|
|
|
|
|
|
onRefreshToken:
|
|
|
|
communityTokensStore.refreshToken(tokenKey)
|
2023-04-28 18:48:20 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onAirdropToken: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.Airdrops)
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2023-08-10 12:23:59 +00:00
|
|
|
// Force a token selection to be airdroped with given amount
|
|
|
|
airdropPanel.selectToken(tokenKey, amount, type)
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
// Set given addresses as recipients
|
|
|
|
airdropPanel.addAddresses(addresses)
|
2023-01-09 12:51:31 +00:00
|
|
|
}
|
2023-08-31 22:26:24 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
AirdropsSettingsPanel {
|
|
|
|
id: airdropPanel
|
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
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
communityDetails: d.communityDetails
|
2023-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// Profile type
|
2023-07-06 12:33:27 +00:00
|
|
|
isOwner: root.isOwner
|
2023-08-22 18:09:34 +00:00
|
|
|
isTokenMasterOwner: root.isTokenMasterOwner
|
2023-07-13 15:51:53 +00:00
|
|
|
isAdmin: root.isAdmin
|
2023-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// Owner and TMaster properties
|
|
|
|
isOwnerTokenDeployed: tokensModelChangesTracker.isOwnerTokenDeployed
|
|
|
|
isTMasterTokenDeployed: tokensModelChangesTracker.isTMasterTokenDeployed
|
2023-07-06 12:33:27 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
readonly property CommunityTokensStore communityTokensStore:
|
|
|
|
rootStore.communityTokensStore
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
readonly property var communityTokens: root.community.communityTokens
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
Loader {
|
|
|
|
id: assetsModelLoader
|
|
|
|
active: airdropPanel.communityTokens
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
sourceComponent: SortFilterProxyModel {
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
sourceModel: airdropPanel.communityTokens
|
|
|
|
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: [
|
|
|
|
ExpressionRole {
|
|
|
|
name: "category"
|
|
|
|
|
|
|
|
// Singleton cannot be used directly in the expression
|
|
|
|
readonly property int category: TokenCategories.Category.Own
|
|
|
|
expression: category
|
|
|
|
},
|
|
|
|
ExpressionRole {
|
|
|
|
name: "iconSource"
|
|
|
|
expression: model.image
|
|
|
|
},
|
|
|
|
ExpressionRole {
|
|
|
|
name: "key"
|
|
|
|
expression: model.symbol
|
2023-07-06 09:58:15 +00:00
|
|
|
},
|
|
|
|
ExpressionRole {
|
|
|
|
name: "communityId"
|
|
|
|
expression: ""
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
|
|
|
]
|
2023-04-25 21:24:04 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
Loader {
|
|
|
|
id: collectiblesModelLoader
|
|
|
|
active: airdropPanel.communityTokens
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
sourceComponent: SortFilterProxyModel {
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
sourceModel: airdropPanel.communityTokens
|
2023-09-07 16:11:09 +00:00
|
|
|
filters: [
|
|
|
|
ValueFilter {
|
|
|
|
roleName: "tokenType"
|
|
|
|
value: Constants.TokenType.ERC721
|
|
|
|
},
|
|
|
|
ExpressionFilter {
|
|
|
|
function getPrivileges(privilegesLevel) {
|
|
|
|
return privilegesLevel === Constants.TokenPrivilegesLevel.Community ||
|
|
|
|
(root.isOwner && privilegesLevel === Constants.TokenPrivilegesLevel.TMaster)
|
|
|
|
}
|
|
|
|
|
|
|
|
expression: { return getPrivileges(model.privilegesLevel) }
|
|
|
|
}
|
|
|
|
]
|
2023-07-04 11:08:00 +00:00
|
|
|
proxyRoles: [
|
|
|
|
ExpressionRole {
|
|
|
|
name: "category"
|
|
|
|
|
|
|
|
// Singleton cannot be used directly in the epression
|
|
|
|
readonly property int category: TokenCategories.Category.Own
|
|
|
|
expression: category
|
|
|
|
},
|
|
|
|
ExpressionRole {
|
|
|
|
name: "iconSource"
|
|
|
|
expression: model.image
|
|
|
|
},
|
|
|
|
ExpressionRole {
|
|
|
|
name: "key"
|
|
|
|
expression: model.symbol
|
2023-07-06 09:58:15 +00:00
|
|
|
},
|
|
|
|
ExpressionRole {
|
|
|
|
name: "communityId"
|
|
|
|
expression: ""
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
|
|
|
]
|
2023-06-14 07:19:45 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2023-04-25 21:24:04 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
assetsModel: assetsModelLoader.item
|
|
|
|
collectiblesModel: collectiblesModelLoader.item
|
2023-08-07 19:27:56 +00:00
|
|
|
membersModel: community.members
|
2024-07-22 13:52:44 +00:00
|
|
|
enabledChainIds: root.enabledChainIds
|
|
|
|
onEnableNetwork: root.enableNetwork(chainId)
|
2023-03-13 16:32:14 +00:00
|
|
|
|
2023-08-09 12:31:58 +00:00
|
|
|
accountsModel: root.walletAccountsModel
|
2023-07-25 14:14:42 +00:00
|
|
|
onAirdropClicked: communityTokensStore.airdrop(
|
2023-09-01 09:27:44 +00:00
|
|
|
root.community.id, airdropTokens, addresses,
|
|
|
|
feeAccountAddress)
|
2023-10-31 20:40:00 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onNavigateToMintTokenSettings: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
|
|
|
mintPanel.openNewTokenForm(isAssetType)
|
|
|
|
}
|
2023-04-17 12:11:31 +00:00
|
|
|
|
2023-09-01 09:27:44 +00:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
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
|
2024-07-04 16:12:13 +00:00
|
|
|
airdropPanel.navigateBack()
|
2023-07-04 14:35:00 +00:00
|
|
|
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
|
|
|
}
|