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-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
|
|
|
|
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-03-17 18:58:07 +00:00
|
|
|
property var community
|
2023-02-17 11:57:17 +00:00
|
|
|
property var transactionStore: TransactionStore {}
|
2023-07-24 11:31:31 +00:00
|
|
|
property bool communitySettingsDisabled
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-06-26 12:07:49 +00:00
|
|
|
readonly property bool isOwner: community.memberRole === Constants.memberRole.owner
|
|
|
|
readonly property bool isAdmin: isOwner || community.memberRole === Constants.memberRole.admin
|
2023-07-21 08:44:10 +00:00
|
|
|
readonly property bool isControlNode: community.isControlNode
|
2023-06-14 16:00:41 +00:00
|
|
|
|
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
|
|
|
|
hoverEnabled: false
|
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
|
2022-10-05 12:14:29 +00:00
|
|
|
Layout.leftMargin: Style.current.padding
|
|
|
|
Layout.rightMargin: Style.current.padding
|
2023-07-04 14:35:00 +00:00
|
|
|
model: stackLayout.children
|
2023-04-05 14:39:52 +00:00
|
|
|
spacing: 8
|
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
|
2022-10-05 12:14:29 +00:00
|
|
|
asset.height: 24
|
|
|
|
asset.width: 24
|
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-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
|
|
|
|
owned: root.community.memberRole === Constants.memberRole.owner
|
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
|
|
|
|
|
|
|
|
onCollectCommunityMetricsMessagesTimestamps: {
|
|
|
|
rootStore.collectCommunityMetricsMessagesTimestamps(intervals)
|
|
|
|
}
|
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-07-19 05:58:21 +00:00
|
|
|
root.rootStore.authenticateWithCallback((authenticated) => {
|
|
|
|
if(!authenticated)
|
|
|
|
return
|
|
|
|
|
|
|
|
Global.openExportControlNodePopup(root.community.name, root.chatCommunitySectionModule.exportCommunity(root.community.id), (popup) => {
|
|
|
|
popup.onDeletePrivateKey.connect(() => {
|
2023-07-24 09:14:25 +00:00
|
|
|
root.rootStore.removePrivateKey(root.community.id)
|
|
|
|
})
|
2023-07-19 05:58:21 +00:00
|
|
|
})
|
|
|
|
})
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2023-07-21 08:44:10 +00:00
|
|
|
|
|
|
|
onImportControlNodeClicked: {
|
|
|
|
if(root.isControlNode)
|
|
|
|
return
|
|
|
|
|
|
|
|
Global.openImportControlNodePopup(root.community, d.importControlNodePopupOpened)
|
|
|
|
}
|
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
|
|
|
|
editable: root.isAdmin
|
|
|
|
communityName: root.community.name
|
|
|
|
|
|
|
|
onKickUserClicked: root.rootStore.removeUserFromCommunity(id)
|
|
|
|
onBanUserClicked: root.rootStore.banUserFromCommunity(id)
|
|
|
|
onUnbanUserClicked: root.rootStore.unbanUserFromCommunity(id)
|
|
|
|
onAcceptRequestToJoin: root.rootStore.acceptRequestToJoinCommunity(id, root.community.id)
|
|
|
|
onDeclineRequestToJoin: root.rootStore.declineRequestToJoinCommunity(id, root.community.id)
|
|
|
|
}
|
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
|
|
|
|
collectiblesModel: rootStore.collectiblesModel
|
|
|
|
channelsModel: rootStore.chatCommunitySectionModule.model
|
2023-03-07 08:47:04 +00:00
|
|
|
|
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"
|
|
|
|
readonly property bool sectionEnabled: root.isOwner
|
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
readonly property CommunityTokensStore communityTokensStore:
|
|
|
|
rootStore.communityTokensStore
|
2023-03-08 13:44:47 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function setFeesInfo(ethCurrency, fiatCurrency, errorCode) {
|
2023-07-04 14:35:00 +00:00
|
|
|
if (errorCode === Constants.ComputeFeeErrorCode.Success
|
|
|
|
|| errorCode === Constants.ComputeFeeErrorCode.Balance) {
|
|
|
|
|
|
|
|
const valueStr = LocaleUtils.currencyAmountToLocaleString(ethCurrency)
|
|
|
|
+ "(" + LocaleUtils.currencyAmountToLocaleString(fiatCurrency) + ")"
|
2023-07-04 11:08:00 +00:00
|
|
|
mintPanel.feeText = valueStr
|
2023-07-04 14:35:00 +00:00
|
|
|
|
|
|
|
if (errorCode === Constants.ComputeFeeErrorCode.Balance)
|
2023-07-26 22:39:13 +00:00
|
|
|
mintPanel.feeErrorText = qsTr("Not enough funds to make transaction")
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
mintPanel.isFeeLoading = false
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
return
|
|
|
|
} else if (errorCode === Constants.ComputeFeeErrorCode.Infura) {
|
2023-07-26 22:39:13 +00:00
|
|
|
mintPanel.feeErrorText = qsTr("Infura error")
|
2023-05-05 11:03:59 +00:00
|
|
|
mintPanel.isFeeLoading = true
|
2023-07-04 11:08:00 +00:00
|
|
|
return
|
2023-05-05 11:03:59 +00:00
|
|
|
}
|
2023-07-26 22:39:13 +00:00
|
|
|
mintPanel.feeErrorText = qsTr("Unknown error")
|
2023-07-04 11:08:00 +00:00
|
|
|
mintPanel.isFeeLoading = true
|
|
|
|
}
|
|
|
|
|
2023-07-18 17:34:57 +00:00
|
|
|
// General community props
|
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-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-07-10 14:12:25 +00:00
|
|
|
isTokenMasterOwner: false // TODO: Backend
|
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-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// Models
|
2023-07-04 11:08:00 +00:00
|
|
|
tokensModel: root.community.communityTokens
|
2023-07-04 13:21:15 +00:00
|
|
|
tokensModelWallet: root.rootStore.tokensModelWallet
|
2023-07-04 11:08:00 +00:00
|
|
|
layer1Networks: communityTokensStore.layer1Networks
|
|
|
|
layer2Networks: communityTokensStore.layer2Networks
|
|
|
|
enabledNetworks: communityTokensStore.enabledNetworks
|
|
|
|
allNetworks: communityTokensStore.allNetworks
|
|
|
|
accounts: root.rootStore.accounts
|
|
|
|
|
2023-07-27 20:29:31 +00:00
|
|
|
onDeployFeesRequested: {
|
|
|
|
feeText = ""
|
|
|
|
feeErrorText = ""
|
|
|
|
isFeeLoading = true
|
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
communityTokensStore.computeDeployFee(
|
|
|
|
chainId, accountAddress, tokenType)
|
2023-07-27 20:29:31 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
|
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
|
|
|
onSignRemoteDestructTransactionOpened:
|
|
|
|
communityTokensStore.computeSelfDestructFee(
|
|
|
|
remotelyDestructTokensList, tokenKey)
|
2023-04-03 11:29:36 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onRemotelyDestructCollectibles:
|
|
|
|
communityTokensStore.remoteSelfDestructCollectibles(
|
|
|
|
root.community.id, remotelyDestructTokensList, tokenKey)
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onSignBurnTransactionOpened:
|
|
|
|
communityTokensStore.computeBurnFee(tokenKey, amount)
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onBurnToken:
|
|
|
|
communityTokensStore.burnToken(root.community.id, tokenKey, amount)
|
2023-03-31 12:52:51 +00:00
|
|
|
|
2023-07-04 14:35:00 +00:00
|
|
|
onDeleteToken:
|
|
|
|
communityTokensStore.deleteToken(root.community.id, 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-07-04 14:35:00 +00:00
|
|
|
// Force a token selection to be airdroped with default amount 1
|
|
|
|
airdropPanel.selectToken(tokenKey, 1, 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-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"
|
|
|
|
readonly property bool sectionEnabled: root.isOwner
|
|
|
|
|
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-07-13 15:51:53 +00:00
|
|
|
isTokenMasterOwner: false // TODO: Backend
|
|
|
|
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
|
|
|
|
filters: ValueFilter {
|
|
|
|
roleName: "tokenType"
|
|
|
|
value: Constants.TokenType.ERC721
|
2023-06-14 07:19:45 +00:00
|
|
|
}
|
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
|
|
|
|
membersModel: {
|
|
|
|
const chatContentModule = root.rootStore.currentChatContentModule()
|
|
|
|
if (!chatContentModule || !chatContentModule.usersModule) {
|
|
|
|
// New communities have no chats, so no chatContentModule
|
|
|
|
return null
|
2023-04-25 21:24:04 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
return chatContentModule.usersModule.model
|
|
|
|
}
|
2023-03-13 16:32:14 +00:00
|
|
|
|
2023-07-25 14:14:42 +00:00
|
|
|
accountsModel: SortFilterProxyModel {
|
|
|
|
sourceModel: root.rootStore.accounts
|
|
|
|
proxyRoles: [
|
|
|
|
ExpressionRole {
|
|
|
|
name: "color"
|
|
|
|
|
|
|
|
function getColor(colorId) {
|
|
|
|
return Utils.getColorForId(colorId)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Direct call for singleton function is not handled properly by
|
|
|
|
// SortFilterProxyModel that's why helper function is used instead.
|
|
|
|
expression: { return getColor(model.colorId) }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
filters: ValueFilter {
|
|
|
|
roleName: "walletType"
|
|
|
|
value: Constants.watchWalletType
|
|
|
|
inverted: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onAirdropClicked: communityTokensStore.airdrop(
|
|
|
|
root.community.id, airdropTokens, addresses,
|
|
|
|
feeAccountAddress)
|
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-07-04 11:08:00 +00:00
|
|
|
onAirdropFeesRequested:
|
|
|
|
communityTokensStore.computeAirdropFee(
|
2023-07-25 14:14:42 +00:00
|
|
|
root.community.id, contractKeysAndAmounts, addresses,
|
|
|
|
feeAccountAddress)
|
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-06-21 14:20:39 +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
|
|
|
}
|
2023-07-21 08:44:10 +00:00
|
|
|
|
|
|
|
function requestCommunityInfoWithCallback(privateKey, callback) {
|
|
|
|
if(!callback) return
|
|
|
|
|
|
|
|
//success
|
|
|
|
root.rootStore.communityAdded.connect(function communityAddedHandler(communityId) {
|
|
|
|
root.rootStore.communityAdded.disconnect(communityAddedHandler)
|
|
|
|
let community = null
|
|
|
|
try {
|
|
|
|
const communityJson = root.rootStore.getSectionByIdJson(communityId)
|
|
|
|
community = JSON.parse(communityJson)
|
|
|
|
} catch (e) {
|
|
|
|
console.warn("Error parsing community json: ", communityJson, " error: ", e.message)
|
|
|
|
}
|
|
|
|
|
|
|
|
callback(community)
|
|
|
|
})
|
|
|
|
|
|
|
|
//error
|
|
|
|
root.rootStore.importingCommunityStateChanged.connect(function communityImportingStateChangedHandler(communityId, status) {
|
|
|
|
root.rootStore.importingCommunityStateChanged.disconnect(communityImportingStateChangedHandler)
|
|
|
|
if(status === Constants.communityImportingError) {
|
|
|
|
callback(null)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
root.rootStore.requestCommunityInfo(privateKey, false)
|
|
|
|
}
|
|
|
|
|
|
|
|
function importControlNodePopupOpened(popup) {
|
|
|
|
popup.requestCommunityInfo.connect((privateKey) => {
|
|
|
|
requestCommunityInfoWithCallback(privateKey, popup.setCommunityInfo)
|
|
|
|
})
|
|
|
|
|
|
|
|
popup.importControlNode.connect((privateKey) => {
|
|
|
|
root.rootStore.importCommunity(privateKey)
|
|
|
|
})
|
|
|
|
}
|
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
|
|
|
|
|
|
|
|
// 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-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-01 10:31:50 +00:00
|
|
|
return StatusQUtils.ModelUtils.contains(model, "name", PermissionsHelpers.ownerTokenNameTag + root.communityName) ||
|
|
|
|
StatusQUtils.ModelUtils.contains(model, "name", PermissionsHelpers.tMasterTokenNameTag + root.communityName)
|
2023-07-18 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
2023-08-01 10:31:50 +00:00
|
|
|
function reviewTokenDeployState(tagType, isOwner, deployState) {
|
|
|
|
const index = StatusQUtils.ModelUtils.indexOf(model, "name", tagType + root.communityName)
|
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:
|
|
|
|
if(!token.isPrivilegedToken)
|
|
|
|
return false
|
|
|
|
|
|
|
|
if(token.isOwner !== isOwner)
|
|
|
|
return false
|
|
|
|
|
|
|
|
// Deploy state check:
|
2023-08-01 10:31:50 +00:00
|
|
|
return token.deployState !== deployState
|
2023-07-18 17:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
model: root.community.communityTokens
|
|
|
|
|
|
|
|
onRevisionChanged: {
|
|
|
|
// 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:
|
2023-08-01 10:31:50 +00:00
|
|
|
if(!isOwnerTokenDeployed) {
|
|
|
|
isOwnerTokenDeployed = reviewTokenDeployState(PermissionsHelpers.ownerTokenNameTag, true, Constants.ContractTransactionStatus.Completed)
|
|
|
|
isOwnerTokenFailed = reviewTokenDeployState(PermissionsHelpers.ownerTokenNameTag, true, Constants.ContractTransactionStatus.Failed)
|
|
|
|
}
|
2023-07-18 17:34:57 +00:00
|
|
|
|
2023-08-01 10:31:50 +00:00
|
|
|
if(!isTMasterTokenDeployed) {
|
|
|
|
isTMasterTokenDeployed = reviewTokenDeployState(PermissionsHelpers.tMasterTokenNameTag, false, Constants.ContractTransactionStatus.Completed)
|
|
|
|
isTMasterTokenFailed = reviewTokenDeployState(PermissionsHelpers.tMasterTokenNameTag, false, Constants.ContractTransactionStatus.Failed)
|
|
|
|
}
|
2023-07-18 17:34:57 +00:00
|
|
|
|
|
|
|
// Not necessary to track more changes since privileged tokens have been correctly deployed.
|
|
|
|
if(isOwnerTokenDeployed && isTMasterTokenDeployed)
|
|
|
|
tokensModelChangesTracker.enabled = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
|
|
Component {
|
|
|
|
id: transferOwnershipPopup
|
2023-07-04 14:35:00 +00:00
|
|
|
|
2022-06-06 15:23:24 +00:00
|
|
|
TransferOwnershipPopup {
|
|
|
|
anchors.centerIn: parent
|
2022-06-29 13:19:18 +00:00
|
|
|
store: root.rootStore
|
2023-06-21 20:37:51 +00:00
|
|
|
onClosed: destroy()
|
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 onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
|
|
|
|
|
|
|
function onSelfDestructFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
|
|
|
|
|
|
|
function onBurnFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
|
|
|
|
|
|
|
function onAirdropFeeUpdated(airdropFees) {
|
|
|
|
airdropPanel.airdropFees = airdropFees
|
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|