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
1 changed files with 449 additions and 432 deletions

View File

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