2023-04-06 11:11:57 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
2022-03-23 15:38:23 +00:00
|
|
|
import QtQuick.Dialogs 1.3
|
2023-04-06 11:11:57 +00:00
|
|
|
import QtGraphicalEffects 1.15
|
2022-03-23 15:38:23 +00:00
|
|
|
|
2023-03-09 10:08:43 +00:00
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
import utils 1.0
|
|
|
|
import shared.panels 1.0
|
|
|
|
import shared.popups 1.0
|
|
|
|
|
|
|
|
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
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Controls.Validators 0.1
|
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.controls 1.0
|
2023-01-09 12:51:31 +00:00
|
|
|
|
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-02-17 11:57:17 +00:00
|
|
|
|
2023-06-23 06:17:04 +00:00
|
|
|
import AppLayouts.Communities.panels 1.0
|
|
|
|
import AppLayouts.Communities.popups 1.0
|
|
|
|
import AppLayouts.Communities.layouts 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
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
readonly property var settingsMenuModel: [
|
|
|
|
{
|
|
|
|
id: Constants.CommunitySettingsSections.Overview,
|
|
|
|
name: qsTr("Overview"), icon: "show", enabled: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: Constants.CommunitySettingsSections.Members,
|
|
|
|
name: qsTr("Members"), icon: "group-chat", enabled: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: Constants.CommunitySettingsSections.Permissions,
|
|
|
|
name: qsTr("Permissions"), icon: "objects", enabled: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: Constants.CommunitySettingsSections.MintTokens,
|
|
|
|
name: qsTr("Mint Tokens"), icon: "token", enabled: root.isOwner
|
|
|
|
},
|
|
|
|
{
|
|
|
|
id: Constants.CommunitySettingsSections.Airdrops,
|
|
|
|
name: qsTr("Airdrops"), icon: "airdrop", enabled: root.isOwner
|
|
|
|
}
|
|
|
|
]
|
2023-06-14 16:00:41 +00:00
|
|
|
|
2022-06-09 15:27:14 +00:00
|
|
|
// TODO: Next community settings options:
|
|
|
|
// {name: qsTr("Token sales"), icon: "token-sale"},
|
|
|
|
// {name: qsTr("Subscriptions"), icon: "subscription"},
|
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
|
2022-06-06 15:23:24 +00:00
|
|
|
property bool hasAddedContacts: false
|
2023-02-17 11:57:17 +00:00
|
|
|
property var transactionStore: TransactionStore {}
|
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-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) {
|
2022-12-20 15:23:49 +00:00
|
|
|
console.warn("Error parsing community tags: ", community.tags, " error: ", e.message)
|
|
|
|
}
|
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-04-06 11:11:57 +00:00
|
|
|
//navigate to a specific section and subsection
|
|
|
|
function goTo(section: int, subSection: int) {
|
|
|
|
d.goTo(section, subSection)
|
|
|
|
}
|
|
|
|
|
2022-09-13 16:17:54 +00:00
|
|
|
onBackButtonClicked: {
|
2023-07-04 11:08:00 +00:00
|
|
|
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
|
2022-09-27 12:16:03 +00:00
|
|
|
model: root.settingsMenuModel
|
2023-04-05 14:39:52 +00:00
|
|
|
spacing: 8
|
|
|
|
|
2022-09-27 12:16:03 +00:00
|
|
|
delegate: StatusNavigationListItem {
|
2022-10-25 19:08:15 +00:00
|
|
|
objectName: "CommunitySettingsView_NavigationListItem_" + modelData.name
|
2022-09-27 12:16:03 +00:00
|
|
|
width: listView.width
|
|
|
|
title: modelData.name
|
|
|
|
asset.name: modelData.icon
|
2022-10-05 12:14:29 +00:00
|
|
|
asset.height: 24
|
|
|
|
asset.width: 24
|
2022-09-27 12:16:03 +00:00
|
|
|
selected: d.currentIndex === index
|
|
|
|
onClicked: d.currentIndex = index
|
2023-01-09 12:51:31 +00:00
|
|
|
visible: modelData.enabled
|
|
|
|
height: modelData.enabled ? 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 {
|
|
|
|
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
|
|
|
|
requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess
|
|
|
|
pinMessagesEnabled: root.community.pinMessageAllMembersEnabled
|
|
|
|
editable: true
|
|
|
|
owned: root.community.memberRole === Constants.memberRole.owner
|
|
|
|
|
|
|
|
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
|
|
|
}
|
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)
|
|
|
|
onBackUpClicked: {
|
|
|
|
Global.openPopup(transferOwnershipPopup, {
|
|
|
|
privateKey: root.chatCommunitySectionModule.exportCommunity(root.community.id),
|
|
|
|
})
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
|
|
|
}
|
|
|
|
|
|
|
|
MembersSettingsPanel {
|
|
|
|
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 {
|
|
|
|
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
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
2023-03-24 12:41:46 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onNavigateToMintTokenSettings: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
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 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) {
|
|
|
|
if (errorCode === Constants.ComputeFeeErrorCode.Success || errorCode === Constants.ComputeFeeErrorCode.Balance) {
|
|
|
|
let valueStr = LocaleUtils.currencyAmountToLocaleString(ethCurrency) + "(" + LocaleUtils.currencyAmountToLocaleString(fiatCurrency) + ")"
|
|
|
|
mintPanel.feeText = valueStr
|
|
|
|
if (errorCode === Constants.ComputeFeeErrorCode.Balance) {
|
|
|
|
mintPanel.errorText = qsTr("Not enough funds to make transaction")
|
2023-05-05 11:03:59 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
mintPanel.isFeeLoading = false
|
|
|
|
return
|
|
|
|
} else if (errorCode === Constants.ComputeFeeErrorCode.Infura) {
|
|
|
|
mintPanel.errorText = 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-04 11:08:00 +00:00
|
|
|
mintPanel.errorText = qsTr("Unknown error")
|
|
|
|
mintPanel.isFeeLoading = true
|
|
|
|
}
|
|
|
|
|
|
|
|
communityName: root.community.name
|
|
|
|
tokensModel: root.community.communityTokens
|
|
|
|
layer1Networks: communityTokensStore.layer1Networks
|
|
|
|
layer2Networks: communityTokensStore.layer2Networks
|
|
|
|
testNetworks: communityTokensStore.testNetworks
|
|
|
|
enabledNetworks: communityTokensStore.enabledNetworks
|
|
|
|
allNetworks: communityTokensStore.allNetworks
|
|
|
|
accounts: root.rootStore.accounts
|
|
|
|
|
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
|
|
|
onSignMintTransactionOpened: communityTokensStore.computeDeployFee(chainId, accountAddress, tokenType)
|
|
|
|
onMintCollectible: communityTokensStore.deployCollectible(root.community.id, collectibleItem)
|
|
|
|
onMintAsset: communityTokensStore.deployAsset(root.community.id, assetItem)
|
|
|
|
onSignRemoteDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(remotelyDestructTokensList, tokenKey)
|
|
|
|
onRemotelyDestructCollectibles: {
|
|
|
|
communityTokensStore.remoteSelfDestructCollectibles(root.community.id,
|
|
|
|
remotelyDestructTokensList,
|
|
|
|
tokenKey)
|
|
|
|
}
|
|
|
|
onSignBurnTransactionOpened: communityTokensStore.computeBurnFee(tokenKey, amount)
|
|
|
|
onBurnToken: communityTokensStore.burnToken(root.community.id, tokenKey, amount)
|
|
|
|
onDeleteToken: communityTokensStore.deleteToken(root.community.id, tokenKey)
|
|
|
|
|
|
|
|
onAirdropToken: {
|
|
|
|
root.goTo(Constants.CommunitySettingsSections.Airdrops)
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: rootStore.communityTokensStore
|
|
|
|
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
2023-03-31 12:52:51 +00:00
|
|
|
}
|
2023-05-05 11:03:59 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onSelfDestructFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
2023-05-05 11:03:59 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onBurnFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onRemoteDestructStateChanged(communityId, tokenName, status, url) {
|
|
|
|
if (root.community.id !== communityId) {
|
|
|
|
return
|
|
|
|
}
|
2023-04-03 11:29:36 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
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
|
2023-06-06 12:54:35 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
Global.displayToastMessage(title,
|
|
|
|
qsTr("View on etherscan"),
|
|
|
|
"",
|
|
|
|
loading,
|
|
|
|
type,
|
|
|
|
url)
|
|
|
|
}
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onAirdropStateChanged(communityId, tokenName, chainName, status, url) {
|
|
|
|
if (root.community.id !== communityId) {
|
|
|
|
return
|
|
|
|
}
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
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
|
2023-06-06 12:54:35 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
Global.displayToastMessage(title,
|
|
|
|
qsTr("View on etherscan"),
|
|
|
|
"",
|
|
|
|
loading,
|
|
|
|
type,
|
|
|
|
url)
|
|
|
|
}
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onBurnStateChanged(communityId, tokenName, status, url) {
|
|
|
|
if (root.community.id !== communityId) {
|
|
|
|
return
|
|
|
|
}
|
2023-06-06 12:54:35 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
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
|
2023-03-23 13:17:07 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
Global.displayToastMessage(title,
|
|
|
|
qsTr("View on etherscan"),
|
|
|
|
"",
|
|
|
|
loading,
|
|
|
|
type,
|
|
|
|
url)
|
|
|
|
}
|
2023-03-31 12:52:51 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onDeploymentStateChanged(communityId, status, url) {
|
|
|
|
if (root.community.id !== communityId) {
|
|
|
|
return
|
|
|
|
}
|
2023-04-28 18:48:20 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
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-03-31 12:52:51 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
Global.displayToastMessage(title,
|
|
|
|
qsTr("View on etherscan"),
|
|
|
|
"",
|
|
|
|
loading,
|
|
|
|
type,
|
|
|
|
url)
|
2023-03-23 13:17:07 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
Connections {
|
|
|
|
target: airdropPanel
|
2023-06-14 07:19:45 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onNavigateToMintTokenSettings(isAssetType) {
|
|
|
|
mintPanel.openNewTokenForm(isAssetType)
|
2023-06-14 07:19:45 +00:00
|
|
|
}
|
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 11:08:00 +00:00
|
|
|
communityDetails: d.communityDetails
|
|
|
|
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-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-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-04 11:08:00 +00:00
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
|
|
|
onAirdropClicked: communityTokensStore.airdrop(root.community.id, airdropTokens, addresses)
|
|
|
|
onNavigateToMintTokenSettings: root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
2023-04-17 12:11:31 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
onAirdropFeesRequested:
|
|
|
|
communityTokensStore.computeAirdropFee(
|
|
|
|
root.community.id, contractKeysAndAmounts, addresses)
|
2023-06-06 15:32:53 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
Connections {
|
|
|
|
target: mintPanel
|
2023-04-17 12:11:31 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onAirdropToken(tokenKey, type, addresses) {
|
|
|
|
// Force a token selection to be airdroped with default amount 1
|
|
|
|
airdropPanel.selectToken(tokenKey, 1, type)
|
|
|
|
|
|
|
|
// Set given addresses as recipients
|
|
|
|
airdropPanel.addAddresses(addresses)
|
2023-04-17 12:11:31 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
}
|
2023-06-06 15:32:53 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
Connections {
|
|
|
|
target: rootStore.communityTokensStore
|
2023-06-06 15:32:53 +00:00
|
|
|
|
2023-07-04 11:08:00 +00:00
|
|
|
function onAirdropFeeUpdated(airdropFees) {
|
|
|
|
airdropPanel.airdropFees = airdropFees
|
2023-06-06 15:32:53 +00:00
|
|
|
}
|
2023-03-13 16:32:14 +00:00
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2023-07-04 11:08:00 +00:00
|
|
|
|
|
|
|
onCurrentIndexChanged:
|
|
|
|
root.backButtonName = stackLayout.children[d.currentIndex].previousPageName || ""
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
2022-06-09 15:27:14 +00:00
|
|
|
onSettingsMenuModelChanged: d.currentIndex = 0
|
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-07-04 11:08:00 +00:00
|
|
|
readonly property var currentItem: stackLayout && stackLayout.children[d.currentIndex]
|
|
|
|
? stackLayout.children[d.currentIndex]
|
2023-04-06 11:11:57 +00:00
|
|
|
: null
|
|
|
|
|
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) {
|
|
|
|
//find and enable section
|
2023-04-17 12:11:31 +00:00
|
|
|
const matchingIndex = listView.model.findIndex((modelItem, index) => modelItem.id === section && modelItem.enabled)
|
2023-06-05 13:49:36 +00:00
|
|
|
|
|
|
|
if(matchingIndex === -1)
|
|
|
|
return
|
|
|
|
|
|
|
|
d.currentIndex = matchingIndex
|
|
|
|
|
|
|
|
//find and enable subsection if subSection navigation is available
|
|
|
|
if(d.currentItem && d.currentItem.goTo) {
|
|
|
|
d.currentItem.goTo(subSection)
|
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
|
|
|
|
|
|
|
MessageDialog {
|
|
|
|
id: errorDialog
|
|
|
|
title: qsTr("Error editing the community")
|
|
|
|
icon: StandardIcon.Critical
|
|
|
|
standardButtons: StandardButton.Ok
|
|
|
|
}
|
2022-06-06 15:23:24 +00:00
|
|
|
|
|
|
|
Component {
|
|
|
|
id: transferOwnershipPopup
|
|
|
|
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
|
|
|
|
NoPermissionsToJoinPopup {
|
|
|
|
onRejectButtonClicked: {
|
|
|
|
root.rootStore.declineRequestToJoinCommunity(requestId, communityId)
|
|
|
|
close()
|
|
|
|
}
|
|
|
|
onClosed: destroy()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: root.chatCommunitySectionModule
|
|
|
|
function onOpenNoPermissionsToJoinPopup(communityName: string, userName: string, communityId: string, requestId: string) {
|
|
|
|
Global.openPopup(noPermissionsPopupCmp, {
|
2023-03-31 12:52:51 +00:00
|
|
|
communityName: communityName,
|
|
|
|
userName: userName,
|
|
|
|
communityId: communityId,
|
|
|
|
requestId: requestId
|
|
|
|
})
|
2023-03-21 11:21:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|