chore(CommunitySettingsView): Not needed top level Loader removed

This commit is contained in:
Michał Cieślak 2023-07-04 13:08:00 +02:00 committed by Michał
parent 7a9c76966d
commit 6247110293

View File

@ -33,13 +33,29 @@ StatusSectionLayout {
notificationCount: activityCenterStore.unreadNotificationsCount notificationCount: activityCenterStore.unreadNotificationsCount
hasUnseenNotifications: activityCenterStore.hasUnseenNotifications hasUnseenNotifications: activityCenterStore.hasUnseenNotifications
onNotificationButtonClicked: Global.openActivityCenterPopup() onNotificationButtonClicked: Global.openActivityCenterPopup()
// TODO: get this model from backend?
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}, readonly property var settingsMenuModel: [
{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}] 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
}
]
// TODO: Next community settings options: // TODO: Next community settings options:
// {name: qsTr("Token sales"), icon: "token-sale"}, // {name: qsTr("Token sales"), icon: "token-sale"},
@ -54,21 +70,18 @@ StatusSectionLayout {
readonly property bool isAdmin: isOwner || community.memberRole === Constants.memberRole.admin readonly property bool isAdmin: isOwner || community.memberRole === Constants.memberRole.admin
readonly property string filteredSelectedTags: { readonly property string filteredSelectedTags: {
var tagsArray = [] let tagsArray = []
if (community && community.tags) { if (community && community.tags) {
try { try {
const json = JSON.parse(community.tags) const json = JSON.parse(community.tags)
if (!!json) {
tagsArray = json.map(tag => { if (!!json)
return tag.name tagsArray = json.map(tag => tag.name)
}) } catch (e) {
}
}
catch (e) {
console.warn("Error parsing community tags: ", community.tags, " error: ", e.message) console.warn("Error parsing community tags: ", community.tags, " error: ", e.message)
} }
} }
return JSON.stringify(tagsArray); return JSON.stringify(tagsArray)
} }
signal backToCommunityClicked signal backToCommunityClicked
@ -79,7 +92,7 @@ StatusSectionLayout {
} }
onBackButtonClicked: { onBackButtonClicked: {
centerPanelContentLoader.item.children[d.currentIndex].navigateBack() stackLayout.children[d.currentIndex].navigateBack()
} }
leftPanel: Item { leftPanel: Item {
@ -159,12 +172,11 @@ StatusSectionLayout {
} }
} }
centerPanel: Loader { centerPanel: StackLayout {
id: centerPanelContentLoader
anchors.fill: parent
active: root.community
sourceComponent: StackLayout {
id: stackLayout id: stackLayout
anchors.fill: parent
currentIndex: d.currentIndex currentIndex: d.currentIndex
OverviewSettingsPanel { OverviewSettingsPanel {
@ -265,7 +277,9 @@ StatusSectionLayout {
onPreviousPageNameChanged: root.backButtonName = previousPageName onPreviousPageNameChanged: root.backButtonName = previousPageName
onNavigateToMintTokenSettings: root.goTo(Constants.CommunitySettingsSections.MintTokens) onNavigateToMintTokenSettings: {
root.goTo(Constants.CommunitySettingsSections.MintTokens)
}
} }
MintTokensSettingsPanel { MintTokensSettingsPanel {
@ -314,9 +328,13 @@ StatusSectionLayout {
} }
onSignBurnTransactionOpened: communityTokensStore.computeBurnFee(tokenKey, amount) onSignBurnTransactionOpened: communityTokensStore.computeBurnFee(tokenKey, amount)
onBurnToken: communityTokensStore.burnToken(root.community.id, tokenKey, amount) onBurnToken: communityTokensStore.burnToken(root.community.id, tokenKey, amount)
onAirdropToken: root.goTo(Constants.CommunitySettingsSections.Airdrops)
onDeleteToken: communityTokensStore.deleteToken(root.community.id, tokenKey) onDeleteToken: communityTokensStore.deleteToken(root.community.id, tokenKey)
onAirdropToken: {
root.goTo(Constants.CommunitySettingsSections.Airdrops)
}
Connections { Connections {
target: rootStore.communityTokensStore target: rootStore.communityTokensStore
function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) { function onDeployFeeUpdated(ethCurrency, fiatCurrency, errorCode) {
@ -581,8 +599,7 @@ StatusSectionLayout {
} }
onCurrentIndexChanged: onCurrentIndexChanged:
root.backButtonName = centerPanelContentLoader.item.children[d.currentIndex].previousPageName || "" root.backButtonName = stackLayout.children[d.currentIndex].previousPageName || ""
}
} }
onSettingsMenuModelChanged: d.currentIndex = 0 onSettingsMenuModelChanged: d.currentIndex = 0
@ -591,8 +608,8 @@ StatusSectionLayout {
id: d id: d
property int currentIndex: 0 property int currentIndex: 0
readonly property var currentItem: centerPanelContentLoader.item && centerPanelContentLoader.item.children[d.currentIndex] readonly property var currentItem: stackLayout && stackLayout.children[d.currentIndex]
? centerPanelContentLoader.item.children[d.currentIndex] ? stackLayout.children[d.currentIndex]
: null : null
readonly property QtObject communityDetails: QtObject { readonly property QtObject communityDetails: QtObject {