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-01-09 12:51:31 +00:00
|
|
|
import AppLayouts.Chat.stores 1.0
|
2023-04-25 21:24:04 +00:00
|
|
|
import AppLayouts.Chat.controls.community 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
|
|
|
|
2022-03-23 15:38:23 +00:00
|
|
|
import "../panels/communities"
|
2022-06-06 15:23:24 +00:00
|
|
|
import "../popups/community"
|
2022-03-23 15:38:23 +00:00
|
|
|
import "../layouts"
|
|
|
|
|
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()
|
2022-03-23 15:38:23 +00:00
|
|
|
// TODO: get this model from backend?
|
2023-04-06 11:11:57 +00:00
|
|
|
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, },
|
2023-04-26 16:22:57 +00:00
|
|
|
{id: Constants.CommunitySettingsSections.Permissions, name: qsTr("Permissions"), icon: "objects", enabled: true},
|
|
|
|
{id: Constants.CommunitySettingsSections.MintTokens, name: qsTr("Mint Tokens"), icon: "token", enabled: true},
|
|
|
|
{id: Constants.CommunitySettingsSections.Airdrops, name: qsTr("Airdrops"), icon: "airdrop", enabled: true}]
|
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
|
|
|
|
2022-07-01 11:58:56 +00:00
|
|
|
readonly property string filteredSelectedTags: {
|
2023-01-11 13:04:38 +00:00
|
|
|
var 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)
|
|
|
|
if (!!json) {
|
|
|
|
tagsArray = json.map(tag => {
|
|
|
|
return tag.name
|
|
|
|
})
|
|
|
|
}
|
2022-12-20 15:23:49 +00:00
|
|
|
}
|
|
|
|
catch (e) {
|
|
|
|
console.warn("Error parsing community tags: ", community.tags, " error: ", e.message)
|
|
|
|
}
|
2022-12-14 15:40:00 +00:00
|
|
|
}
|
2023-01-11 13:04:38 +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: {
|
2022-12-07 16:14:36 +00:00
|
|
|
centerPanelContentLoader.item.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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-09 15:08:39 +00:00
|
|
|
centerPanel: Loader {
|
2022-09-13 16:17:54 +00:00
|
|
|
id: centerPanelContentLoader
|
2022-03-23 15:38:23 +00:00
|
|
|
anchors.fill: parent
|
|
|
|
active: root.community
|
|
|
|
sourceComponent: StackLayout {
|
2023-04-06 11:11:57 +00:00
|
|
|
id: stackLayout
|
2022-03-23 15:38:23 +00:00
|
|
|
currentIndex: d.currentIndex
|
|
|
|
|
|
|
|
CommunityOverviewSettingsPanel {
|
2022-06-06 15:23:24 +00:00
|
|
|
communityId: root.community.id
|
2022-03-23 15:38:23 +00:00
|
|
|
name: root.community.name
|
|
|
|
description: root.community.description
|
2022-05-26 15:46:02 +00:00
|
|
|
introMessage: root.community.introMessage
|
|
|
|
outroMessage: root.community.outroMessage
|
2022-05-23 18:53:51 +00:00
|
|
|
logoImageData: root.community.image
|
|
|
|
bannerImageData: root.community.bannerImageData
|
2022-03-23 15:38:23 +00:00
|
|
|
color: root.community.color
|
2022-06-09 14:59:54 +00:00
|
|
|
tags: root.rootStore.communityTags
|
2022-07-01 11:58:56 +00:00
|
|
|
selectedTags: root.filteredSelectedTags
|
2022-05-26 15:46:02 +00:00
|
|
|
archiveSupportEnabled: root.community.historyArchiveSupportEnabled
|
|
|
|
requestToJoinEnabled: root.community.access === Constants.communityChatOnRequestAccess
|
|
|
|
pinMessagesEnabled: root.community.pinMessageAllMembersEnabled
|
2022-03-23 15:38:23 +00:00
|
|
|
editable: root.community.amISectionAdmin
|
|
|
|
|
|
|
|
onEdited: {
|
2022-06-02 17:48:10 +00:00
|
|
|
const error = root.chatCommunitySectionModule.editCommunity(
|
2023-03-08 13:44:47 +00:00
|
|
|
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
|
|
|
|
)
|
2022-05-26 15:46:02 +00:00
|
|
|
if (error) {
|
|
|
|
errorDialog.text = error.error
|
|
|
|
errorDialog.open()
|
|
|
|
}
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-06-06 15:23:24 +00:00
|
|
|
|
|
|
|
onInviteNewPeopleClicked: {
|
2022-09-28 21:07:18 +00:00
|
|
|
Global.openInviteFriendsToCommunityPopup(root.community,
|
2022-10-25 17:15:44 +00:00
|
|
|
root.chatCommunitySectionModule,
|
|
|
|
null)
|
2022-06-06 15:23:24 +00:00
|
|
|
}
|
|
|
|
|
2023-05-15 09:19:36 +00:00
|
|
|
onAirdropTokensClicked: root.goTo(Constants.CommunitySettingsSections.Airdrops)
|
2022-06-06 15:23:24 +00:00
|
|
|
onBackUpClicked: {
|
|
|
|
Global.openPopup(transferOwnershipPopup, {
|
2023-03-22 13:52:25 +00:00
|
|
|
privateKey: root.chatCommunitySectionModule.exportCommunity(root.community.id),
|
2023-03-08 13:44:47 +00:00
|
|
|
})
|
2022-06-06 15:23:24 +00:00
|
|
|
}
|
2022-12-07 16:14:36 +00:00
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
CommunityMembersSettingsPanel {
|
|
|
|
membersModel: root.community.members
|
2022-06-28 15:03:10 +00:00
|
|
|
bannedMembersModel: root.community.bannedMembers
|
2023-03-21 11:21:23 +00:00
|
|
|
pendingMemberRequestsModel: root.community.pendingMemberRequests
|
2022-08-04 07:49:41 +00:00
|
|
|
declinedMemberRequestsModel: root.community.declinedMemberRequests
|
2022-03-23 15:38:23 +00:00
|
|
|
editable: root.community.amISectionAdmin
|
2022-06-28 15:03:10 +00:00
|
|
|
communityName: root.community.name
|
2022-03-23 15:38:23 +00:00
|
|
|
|
|
|
|
onKickUserClicked: root.rootStore.removeUserFromCommunity(id)
|
2022-04-07 14:49:38 +00:00
|
|
|
onBanUserClicked: root.rootStore.banUserFromCommunity(id)
|
2022-06-28 15:03:10 +00:00
|
|
|
onUnbanUserClicked: root.rootStore.unbanUserFromCommunity(id)
|
2023-03-21 11:21:23 +00:00
|
|
|
onAcceptRequestToJoin: root.rootStore.acceptRequestToJoinCommunity(id, root.community.id)
|
|
|
|
onDeclineRequestToJoin: root.rootStore.declineRequestToJoinCommunity(id, root.community.id)
|
2022-03-23 15:38:23 +00:00
|
|
|
}
|
2022-06-09 15:27:14 +00:00
|
|
|
|
2022-09-13 16:17:54 +00:00
|
|
|
CommunityPermissionsSettingsPanel {
|
2023-03-07 08:47:04 +00:00
|
|
|
readonly property PermissionsStore permissionsStore:
|
|
|
|
rootStore.permissionsStore
|
|
|
|
|
|
|
|
permissionsModel: permissionsStore.permissionsModel
|
2023-03-09 10:08:43 +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-07 16:51:06 +00:00
|
|
|
assetsModel: rootStore.assetsModel
|
2023-03-07 08:47:04 +00:00
|
|
|
collectiblesModel: rootStore.collectiblesModel
|
|
|
|
channelsModel: rootStore.chatCommunitySectionModule.model
|
|
|
|
|
|
|
|
communityDetails: QtObject {
|
|
|
|
readonly property var _activeSection:
|
|
|
|
rootStore.mainModuleInst.activeSection
|
|
|
|
|
|
|
|
readonly property string name: _activeSection.name
|
|
|
|
readonly property string image: _activeSection.image
|
|
|
|
readonly property string color: _activeSection.color
|
|
|
|
}
|
|
|
|
|
|
|
|
onCreatePermissionRequested:
|
|
|
|
permissionsStore.createPermission(holdings, permissionType,
|
|
|
|
isPrivate, channels)
|
|
|
|
|
|
|
|
onUpdatePermissionRequested:
|
|
|
|
permissionsStore.editPermission(
|
|
|
|
key, holdings, permissionType, channels, isPrivate)
|
|
|
|
|
|
|
|
onRemovePermissionRequested:
|
|
|
|
permissionsStore.removePermission(key)
|
2023-02-22 17:51:49 +00:00
|
|
|
|
2022-12-07 16:14:36 +00:00
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
2023-03-24 12:41:46 +00:00
|
|
|
|
2023-04-06 11:11:57 +00:00
|
|
|
onNavigateToMintTokenSettings: root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
2022-09-13 16:17:54 +00:00
|
|
|
}
|
2022-12-07 16:14:36 +00:00
|
|
|
|
2023-02-17 11:57:17 +00:00
|
|
|
CommunityMintTokensSettingsPanel {
|
2023-03-23 13:17:07 +00:00
|
|
|
id: mintPanel
|
|
|
|
|
2023-03-08 13:44:47 +00:00
|
|
|
readonly property CommunityTokensStore communityTokensStore:
|
|
|
|
rootStore.communityTokensStore
|
|
|
|
|
2023-05-05 11:03:59 +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")
|
|
|
|
}
|
|
|
|
mintPanel.isFeeLoading = false
|
|
|
|
return
|
|
|
|
} else if (errorCode === Constants.ComputeFeeErrorCode.Infura) {
|
|
|
|
mintPanel.errorText = qsTr("Infura error")
|
|
|
|
mintPanel.isFeeLoading = true
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
mintPanel.errorText = qsTr("Unknown error")
|
|
|
|
mintPanel.isFeeLoading = true
|
|
|
|
}
|
|
|
|
|
2023-05-18 15:01:48 +00:00
|
|
|
communityName: root.community.name
|
2023-01-29 13:33:58 +00:00
|
|
|
tokensModel: root.community.communityTokens
|
2023-03-08 13:44:47 +00:00
|
|
|
layer1Networks: communityTokensStore.layer1Networks
|
|
|
|
layer2Networks: communityTokensStore.layer2Networks
|
|
|
|
testNetworks: communityTokensStore.testNetworks
|
|
|
|
enabledNetworks: communityTokensStore.enabledNetworks
|
|
|
|
allNetworks: communityTokensStore.allNetworks
|
2023-03-17 15:09:27 +00:00
|
|
|
accounts: root.rootStore.accounts
|
2023-03-08 13:44:47 +00:00
|
|
|
|
2023-02-17 11:57:17 +00:00
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
2023-04-03 11:29:36 +00:00
|
|
|
onSignMintTransactionOpened: communityTokensStore.computeDeployFee(chainId, accountAddress)
|
2023-03-08 13:44:47 +00:00
|
|
|
onMintCollectible: {
|
|
|
|
communityTokensStore.deployCollectible(root.community.id,
|
2023-03-17 15:09:27 +00:00
|
|
|
accountAddress,
|
2023-03-08 13:44:47 +00:00
|
|
|
name,
|
|
|
|
symbol,
|
|
|
|
description,
|
|
|
|
supply,
|
|
|
|
infiniteSupply,
|
|
|
|
transferable,
|
|
|
|
selfDestruct,
|
|
|
|
chainId,
|
2023-03-17 15:09:27 +00:00
|
|
|
artworkSource,
|
2023-05-08 11:33:49 +00:00
|
|
|
accountName,
|
|
|
|
artworkCropRect)
|
2023-03-08 13:44:47 +00:00
|
|
|
}
|
2023-05-25 10:46:53 +00:00
|
|
|
onMintAsset: {
|
|
|
|
communityTokensStore.deployAsset(root.community.id,
|
|
|
|
accountAddress,
|
|
|
|
name,
|
|
|
|
symbol,
|
|
|
|
description,
|
|
|
|
supply,
|
|
|
|
infiniteSupply,
|
|
|
|
decimals,
|
|
|
|
chainId,
|
|
|
|
artworkSource,
|
|
|
|
accountName,
|
|
|
|
artworkCropRect)
|
|
|
|
}
|
2023-05-26 15:00:51 +00:00
|
|
|
onSignSelfDestructTransactionOpened: communityTokensStore.computeSelfDestructFee(selfDestructTokensList, tokenKey)
|
2023-03-31 12:52:51 +00:00
|
|
|
onRemoteSelfDestructCollectibles: {
|
2023-05-05 11:03:59 +00:00
|
|
|
communityTokensStore.remoteSelfDestructCollectibles(root.community.id,
|
|
|
|
selfDestructTokensList,
|
2023-05-26 15:00:51 +00:00
|
|
|
tokenKey)
|
2023-03-31 12:52:51 +00:00
|
|
|
}
|
2023-05-18 15:01:48 +00:00
|
|
|
onSignBurnTransactionOpened: communityTokensStore.computeBurnFee(chainId)
|
|
|
|
onBurnCollectibles: communityTokensStore.burnCollectibles(tokenKey, amount)
|
2023-04-17 12:11:31 +00:00
|
|
|
onAirdropCollectible: root.goTo(Constants.CommunitySettingsSections.Airdrops)
|
2023-05-30 15:18:45 +00:00
|
|
|
onDeleteToken: communityTokensStore.deleteToken(root.community.id, tokenKey)
|
|
|
|
onRetryMintToken: communityTokensStore.retryMintToken(root.community.id, tokenKey)
|
2023-03-23 13:17:07 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: rootStore.communityTokensStore
|
2023-04-03 11:29:36 +00:00
|
|
|
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
2023-05-05 11:03:59 +00:00
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
|
|
|
|
|
|
|
function onSelfDestructFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
|
|
|
|
mintPanel.setFeesInfo(ethCurrency, fiatCurrency, errorCode)
|
|
|
|
}
|
|
|
|
|
|
|
|
function onRemoteDestructStateChanged(communityId, tokenName, status, url) {
|
|
|
|
if (root.community.id !== communityId) {
|
2023-04-03 11:29:36 +00:00
|
|
|
return
|
2023-03-24 12:34:10 +00:00
|
|
|
}
|
2023-04-03 11:29:36 +00:00
|
|
|
|
2023-05-05 11:03:59 +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
|
|
|
|
}
|
|
|
|
Global.displayToastMessage(title,
|
|
|
|
qsTr("View on etherscan"),
|
|
|
|
"",
|
|
|
|
loading,
|
|
|
|
type,
|
|
|
|
url)
|
2023-03-23 13:17:07 +00:00
|
|
|
}
|
2023-03-31 12:52:51 +00:00
|
|
|
|
2023-04-28 18:48:20 +00:00
|
|
|
function onDeploymentStateChanged(communityId, status, url) {
|
|
|
|
if (root.community.id !== communityId) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2023-04-11 08:09:01 +00:00
|
|
|
let title = ""
|
|
|
|
let loading = false
|
|
|
|
let type = Constants.ephemeralNotificationType.normal
|
|
|
|
switch (status) {
|
2023-05-05 11:03:59 +00:00
|
|
|
case Constants.ContractTransactionStatus.InProgress:
|
2023-04-11 08:09:01 +00:00
|
|
|
title = qsTr("Token is being minted...")
|
|
|
|
loading = true
|
|
|
|
break
|
2023-05-05 11:03:59 +00:00
|
|
|
case Constants.ContractTransactionStatus.Completed:
|
2023-04-11 08:09:01 +00:00
|
|
|
title = qsTr("Token minting finished")
|
|
|
|
type = Constants.ephemeralNotificationType.success
|
|
|
|
break
|
2023-05-05 11:03:59 +00:00
|
|
|
case Constants.ContractTransactionStatus.Failed:
|
2023-04-11 08:09:01 +00:00
|
|
|
title = qsTr("Token minting failed")
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
console.warn("Unknown deploy state: "+status)
|
|
|
|
return
|
2023-03-31 12:52:51 +00:00
|
|
|
}
|
2023-04-11 08:09:01 +00:00
|
|
|
Global.displayToastMessage(title,
|
|
|
|
qsTr("View on etherscan"),
|
|
|
|
"",
|
|
|
|
loading,
|
|
|
|
type,
|
|
|
|
url)
|
2023-03-31 12:52:51 +00:00
|
|
|
}
|
2023-03-23 13:17:07 +00:00
|
|
|
}
|
2023-01-09 12:51:31 +00:00
|
|
|
}
|
|
|
|
|
2023-03-13 16:32:14 +00:00
|
|
|
CommunityAirdropsSettingsPanel {
|
2023-04-17 12:11:31 +00:00
|
|
|
id: airdropPanel
|
|
|
|
|
2023-03-13 16:32:14 +00:00
|
|
|
readonly property CommunityTokensStore communityTokensStore:
|
|
|
|
rootStore.communityTokensStore
|
|
|
|
|
2023-04-25 21:24:04 +00:00
|
|
|
assetsModel: ListModel {}
|
|
|
|
|
|
|
|
readonly property var communityTokens: root.community.communityTokens
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: modelLoader
|
|
|
|
active: airdropPanel.communityTokens
|
|
|
|
|
|
|
|
sourceComponent: SortFilterProxyModel {
|
|
|
|
|
|
|
|
sourceModel: airdropPanel.communityTokens
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
collectiblesModel: modelLoader.item
|
|
|
|
|
|
|
|
membersModel: {
|
|
|
|
const chatContentModule = root.rootStore.currentChatContentModule()
|
|
|
|
if (!chatContentModule || !chatContentModule.usersModule) {
|
|
|
|
// New communities have no chats, so no chatContentModule
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
return chatContentModule.usersModule.model
|
|
|
|
}
|
2023-03-13 16:32:14 +00:00
|
|
|
|
|
|
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
2023-03-13 10:16:08 +00:00
|
|
|
onAirdropClicked: communityTokensStore.airdrop(root.community.id, airdropTokens, addresses)
|
2023-04-06 11:11:57 +00:00
|
|
|
onNavigateToMintTokenSettings: root.goTo(Constants.CommunitySettingsSections.MintTokens)
|
2023-04-17 12:11:31 +00:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: mintPanel
|
|
|
|
|
|
|
|
function onAirdropCollectible(key) {
|
|
|
|
// Here it is forced a navigation to the new airdrop form, like if it was clicked the header button
|
2023-05-30 15:18:45 +00:00
|
|
|
airdropPanel.primaryHeaderButtonClicked()
|
2023-04-17 12:11:31 +00:00
|
|
|
|
|
|
|
// Force a token selection to be airdroped with default amount 1
|
|
|
|
airdropPanel.selectCollectible(key, 1)
|
|
|
|
}
|
|
|
|
}
|
2023-03-13 16:32:14 +00:00
|
|
|
}
|
|
|
|
|
2022-12-07 16:14:36 +00:00
|
|
|
onCurrentIndexChanged: root.backButtonName = centerPanelContentLoader.item.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-04-06 11:11:57 +00:00
|
|
|
readonly property var currentItem: centerPanelContentLoader.item && centerPanelContentLoader.item.children[d.currentIndex]
|
|
|
|
? centerPanelContentLoader.item.children[d.currentIndex]
|
|
|
|
: null
|
|
|
|
|
|
|
|
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)
|
|
|
|
if(matchingIndex !== -1) {
|
2023-04-06 11:11:57 +00:00
|
|
|
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
|
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
|
|
|
}
|