chore(CommunityPermission): Use typed properties for CommunitiesStore
Additionally, pass assets/collectibles models to HoldingsDropdown directly instead of store to reduce dependency.
This commit is contained in:
parent
44a13eedfc
commit
e352dcfc11
|
@ -39,10 +39,8 @@ Pane {
|
|||
parent: root
|
||||
anchors.centerIn: root
|
||||
|
||||
store: QtObject {
|
||||
readonly property var collectiblesModel: CollectiblesModel {}
|
||||
readonly property var assetsModel: AssetsModel {}
|
||||
}
|
||||
collectiblesModel: CollectiblesModel {}
|
||||
assetsModel: AssetsModel {}
|
||||
|
||||
onOpened: contentItem.parent.parent = root
|
||||
Component.onCompleted: {
|
||||
|
|
|
@ -56,6 +56,8 @@ StackLayout {
|
|||
|
||||
sourceComponent: CommunitySettingsView {
|
||||
rootStore: root.rootStore
|
||||
communityStore: CommunitiesStore {}
|
||||
|
||||
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
||||
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
||||
community: root.rootStore.mainModuleInst ? root.rootStore.mainModuleInst.activeSection
|
||||
|
|
|
@ -18,7 +18,9 @@ import SortFilterProxyModel 0.2
|
|||
Item {
|
||||
id: root
|
||||
|
||||
property var store
|
||||
property var assetsModel
|
||||
property var collectiblesModel
|
||||
|
||||
property var checkedKeys: []
|
||||
property int type: ExtendedDropdownContent.Type.Assets
|
||||
|
||||
|
@ -139,7 +141,7 @@ Item {
|
|||
PropertyChanges {
|
||||
target: d
|
||||
currentModel: root.type === ExtendedDropdownContent.Type.Assets
|
||||
? root.store.assetsModel : root.store.collectiblesModel
|
||||
? root.assetsModel : root.collectiblesModel
|
||||
isFilterOptionVisible: false
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,9 @@ import AppLayouts.Chat.helpers 1.0
|
|||
StatusDropdown {
|
||||
id: root
|
||||
|
||||
property var store
|
||||
property var assetsModel
|
||||
property var collectiblesModel
|
||||
|
||||
property var usedTokens: []
|
||||
property var usedEnsNames: []
|
||||
|
||||
|
@ -248,7 +250,9 @@ StatusDropdown {
|
|||
ExtendedDropdownContent {
|
||||
id: listPanel
|
||||
|
||||
store: root.store
|
||||
assetsModel: root.assetsModel
|
||||
collectiblesModel: root.collectiblesModel
|
||||
|
||||
checkedKeys: root.usedTokens.map(entry => entry.key)
|
||||
type: d.extendedDropdownType
|
||||
|
||||
|
@ -287,8 +291,8 @@ StatusDropdown {
|
|||
Component.onCompleted: {
|
||||
if(d.extendedDeepNavigation)
|
||||
listPanel.goForward(d.currentItemKey,
|
||||
CommunityPermissionsHelpers.getTokenNameByKey(store.collectiblesModel, d.currentItemKey),
|
||||
CommunityPermissionsHelpers.getTokenIconByKey(store.collectiblesModel, d.currentItemKey),
|
||||
CommunityPermissionsHelpers.getTokenNameByKey(root.collectiblesModel, d.currentItemKey),
|
||||
CommunityPermissionsHelpers.getTokenIconByKey(root.collectiblesModel, d.currentItemKey),
|
||||
d.currentSubItems)
|
||||
}
|
||||
|
||||
|
@ -318,9 +322,9 @@ StatusDropdown {
|
|||
|
||||
readonly property real effectiveAmount: amountValid ? amount : 0
|
||||
|
||||
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(store.assetsModel, root.assetKey)
|
||||
tokenShortName: CommunityPermissionsHelpers.getTokenShortNameByKey(store.assetsModel, root.assetKey)
|
||||
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(store.assetsModel, root.assetKey)
|
||||
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(root.assetsModel, root.assetKey)
|
||||
tokenShortName: CommunityPermissionsHelpers.getTokenShortNameByKey(root.assetsModel, root.assetKey)
|
||||
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(root.assetsModel, root.assetKey)
|
||||
amountText: d.assetAmountText
|
||||
tokenCategoryText: qsTr("Asset")
|
||||
addOrUpdateButtonEnabled: d.assetsReady
|
||||
|
@ -353,9 +357,9 @@ StatusDropdown {
|
|||
|
||||
readonly property real effectiveAmount: amountValid ? amount : 0
|
||||
|
||||
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(store.collectiblesModel, root.collectibleKey)
|
||||
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(root.collectiblesModel, root.collectibleKey)
|
||||
tokenShortName: ""
|
||||
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(store.collectiblesModel, root.collectibleKey)
|
||||
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(root.collectiblesModel, root.collectibleKey)
|
||||
amountText: d.collectibleAmountText
|
||||
tokenCategoryText: qsTr("Collectible")
|
||||
addOrUpdateButtonEnabled: d.collectiblesReady
|
||||
|
|
|
@ -12,7 +12,7 @@ SettingsPageLayout {
|
|||
id: root
|
||||
|
||||
property var rootStore
|
||||
property var store: CommunitiesStore {}
|
||||
required property CommunitiesStore store
|
||||
property int viewWidth: 560 // by design
|
||||
|
||||
function navigateBack() {
|
||||
|
|
|
@ -44,7 +44,7 @@ StatusSectionLayout {
|
|||
property var rootStore
|
||||
property var community
|
||||
property var chatCommunitySectionModule
|
||||
property var communityStore: CommunitiesStore {}
|
||||
required property CommunitiesStore communityStore
|
||||
property bool hasAddedContacts: false
|
||||
property var transactionStore: TransactionStore {}
|
||||
|
||||
|
@ -248,6 +248,8 @@ StatusSectionLayout {
|
|||
|
||||
CommunityPermissionsSettingsPanel {
|
||||
rootStore: root.rootStore
|
||||
store: root.communityStore
|
||||
|
||||
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import shared.panels 1.0
|
|||
|
||||
import AppLayouts.Chat.helpers 1.0
|
||||
import AppLayouts.Chat.panels.communities 1.0
|
||||
import AppLayouts.Chat.stores 1.0
|
||||
|
||||
import "../../../Chat/controls/community"
|
||||
|
||||
|
@ -20,7 +21,7 @@ StatusScrollView {
|
|||
id: root
|
||||
|
||||
property var rootStore
|
||||
property var store
|
||||
required property CommunitiesStore store
|
||||
|
||||
property int viewWidth: 560 // by design
|
||||
property bool isEditState: false
|
||||
|
@ -196,7 +197,8 @@ StatusScrollView {
|
|||
HoldingsDropdown {
|
||||
id: dropdown
|
||||
|
||||
store: root.store
|
||||
assetsModel: store.assetsModel
|
||||
collectiblesModel: store.collectiblesModel
|
||||
|
||||
function addItem(type, item, amount) {
|
||||
const key = item.key
|
||||
|
|
|
@ -10,12 +10,14 @@ import shared.popups 1.0
|
|||
|
||||
import AppLayouts.Chat.controls.community 1.0
|
||||
import AppLayouts.Chat.helpers 1.0
|
||||
import AppLayouts.Chat.stores 1.0
|
||||
|
||||
StatusScrollView {
|
||||
id: root
|
||||
|
||||
property var rootStore
|
||||
property var store
|
||||
required property CommunitiesStore store
|
||||
|
||||
property int viewWidth: 560 // by design
|
||||
|
||||
signal editPermissionRequested(int index)
|
||||
|
|
Loading…
Reference in New Issue