mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-09 13:56:10 +00:00
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
|
parent: root
|
||||||
anchors.centerIn: root
|
anchors.centerIn: root
|
||||||
|
|
||||||
store: QtObject {
|
collectiblesModel: CollectiblesModel {}
|
||||||
readonly property var collectiblesModel: CollectiblesModel {}
|
assetsModel: AssetsModel {}
|
||||||
readonly property var assetsModel: AssetsModel {}
|
|
||||||
}
|
|
||||||
|
|
||||||
onOpened: contentItem.parent.parent = root
|
onOpened: contentItem.parent.parent = root
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -56,6 +56,8 @@ StackLayout {
|
|||||||
|
|
||||||
sourceComponent: CommunitySettingsView {
|
sourceComponent: CommunitySettingsView {
|
||||||
rootStore: root.rootStore
|
rootStore: root.rootStore
|
||||||
|
communityStore: CommunitiesStore {}
|
||||||
|
|
||||||
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
hasAddedContacts: root.contactsStore.myContactsModel.count > 0
|
||||||
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
chatCommunitySectionModule: root.rootStore.chatCommunitySectionModule
|
||||||
community: root.rootStore.mainModuleInst ? root.rootStore.mainModuleInst.activeSection
|
community: root.rootStore.mainModuleInst ? root.rootStore.mainModuleInst.activeSection
|
||||||
|
@ -18,7 +18,9 @@ import SortFilterProxyModel 0.2
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var store
|
property var assetsModel
|
||||||
|
property var collectiblesModel
|
||||||
|
|
||||||
property var checkedKeys: []
|
property var checkedKeys: []
|
||||||
property int type: ExtendedDropdownContent.Type.Assets
|
property int type: ExtendedDropdownContent.Type.Assets
|
||||||
|
|
||||||
@ -139,7 +141,7 @@ Item {
|
|||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: d
|
target: d
|
||||||
currentModel: root.type === ExtendedDropdownContent.Type.Assets
|
currentModel: root.type === ExtendedDropdownContent.Type.Assets
|
||||||
? root.store.assetsModel : root.store.collectiblesModel
|
? root.assetsModel : root.collectiblesModel
|
||||||
isFilterOptionVisible: false
|
isFilterOptionVisible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,9 @@ import AppLayouts.Chat.helpers 1.0
|
|||||||
StatusDropdown {
|
StatusDropdown {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var store
|
property var assetsModel
|
||||||
|
property var collectiblesModel
|
||||||
|
|
||||||
property var usedTokens: []
|
property var usedTokens: []
|
||||||
property var usedEnsNames: []
|
property var usedEnsNames: []
|
||||||
|
|
||||||
@ -248,7 +250,9 @@ StatusDropdown {
|
|||||||
ExtendedDropdownContent {
|
ExtendedDropdownContent {
|
||||||
id: listPanel
|
id: listPanel
|
||||||
|
|
||||||
store: root.store
|
assetsModel: root.assetsModel
|
||||||
|
collectiblesModel: root.collectiblesModel
|
||||||
|
|
||||||
checkedKeys: root.usedTokens.map(entry => entry.key)
|
checkedKeys: root.usedTokens.map(entry => entry.key)
|
||||||
type: d.extendedDropdownType
|
type: d.extendedDropdownType
|
||||||
|
|
||||||
@ -287,8 +291,8 @@ StatusDropdown {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if(d.extendedDeepNavigation)
|
if(d.extendedDeepNavigation)
|
||||||
listPanel.goForward(d.currentItemKey,
|
listPanel.goForward(d.currentItemKey,
|
||||||
CommunityPermissionsHelpers.getTokenNameByKey(store.collectiblesModel, d.currentItemKey),
|
CommunityPermissionsHelpers.getTokenNameByKey(root.collectiblesModel, d.currentItemKey),
|
||||||
CommunityPermissionsHelpers.getTokenIconByKey(store.collectiblesModel, d.currentItemKey),
|
CommunityPermissionsHelpers.getTokenIconByKey(root.collectiblesModel, d.currentItemKey),
|
||||||
d.currentSubItems)
|
d.currentSubItems)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,9 +322,9 @@ StatusDropdown {
|
|||||||
|
|
||||||
readonly property real effectiveAmount: amountValid ? amount : 0
|
readonly property real effectiveAmount: amountValid ? amount : 0
|
||||||
|
|
||||||
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(store.assetsModel, root.assetKey)
|
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(root.assetsModel, root.assetKey)
|
||||||
tokenShortName: CommunityPermissionsHelpers.getTokenShortNameByKey(store.assetsModel, root.assetKey)
|
tokenShortName: CommunityPermissionsHelpers.getTokenShortNameByKey(root.assetsModel, root.assetKey)
|
||||||
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(store.assetsModel, root.assetKey)
|
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(root.assetsModel, root.assetKey)
|
||||||
amountText: d.assetAmountText
|
amountText: d.assetAmountText
|
||||||
tokenCategoryText: qsTr("Asset")
|
tokenCategoryText: qsTr("Asset")
|
||||||
addOrUpdateButtonEnabled: d.assetsReady
|
addOrUpdateButtonEnabled: d.assetsReady
|
||||||
@ -353,9 +357,9 @@ StatusDropdown {
|
|||||||
|
|
||||||
readonly property real effectiveAmount: amountValid ? amount : 0
|
readonly property real effectiveAmount: amountValid ? amount : 0
|
||||||
|
|
||||||
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(store.collectiblesModel, root.collectibleKey)
|
tokenName: CommunityPermissionsHelpers.getTokenNameByKey(root.collectiblesModel, root.collectibleKey)
|
||||||
tokenShortName: ""
|
tokenShortName: ""
|
||||||
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(store.collectiblesModel, root.collectibleKey)
|
tokenImage: CommunityPermissionsHelpers.getTokenIconByKey(root.collectiblesModel, root.collectibleKey)
|
||||||
amountText: d.collectibleAmountText
|
amountText: d.collectibleAmountText
|
||||||
tokenCategoryText: qsTr("Collectible")
|
tokenCategoryText: qsTr("Collectible")
|
||||||
addOrUpdateButtonEnabled: d.collectiblesReady
|
addOrUpdateButtonEnabled: d.collectiblesReady
|
||||||
|
@ -12,7 +12,7 @@ SettingsPageLayout {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var rootStore
|
property var rootStore
|
||||||
property var store: CommunitiesStore {}
|
required property CommunitiesStore store
|
||||||
property int viewWidth: 560 // by design
|
property int viewWidth: 560 // by design
|
||||||
|
|
||||||
function navigateBack() {
|
function navigateBack() {
|
||||||
|
@ -44,7 +44,7 @@ StatusSectionLayout {
|
|||||||
property var rootStore
|
property var rootStore
|
||||||
property var community
|
property var community
|
||||||
property var chatCommunitySectionModule
|
property var chatCommunitySectionModule
|
||||||
property var communityStore: CommunitiesStore {}
|
required property CommunitiesStore communityStore
|
||||||
property bool hasAddedContacts: false
|
property bool hasAddedContacts: false
|
||||||
property var transactionStore: TransactionStore {}
|
property var transactionStore: TransactionStore {}
|
||||||
|
|
||||||
@ -248,6 +248,8 @@ StatusSectionLayout {
|
|||||||
|
|
||||||
CommunityPermissionsSettingsPanel {
|
CommunityPermissionsSettingsPanel {
|
||||||
rootStore: root.rootStore
|
rootStore: root.rootStore
|
||||||
|
store: root.communityStore
|
||||||
|
|
||||||
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
onPreviousPageNameChanged: root.backButtonName = previousPageName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ import shared.panels 1.0
|
|||||||
|
|
||||||
import AppLayouts.Chat.helpers 1.0
|
import AppLayouts.Chat.helpers 1.0
|
||||||
import AppLayouts.Chat.panels.communities 1.0
|
import AppLayouts.Chat.panels.communities 1.0
|
||||||
|
import AppLayouts.Chat.stores 1.0
|
||||||
|
|
||||||
import "../../../Chat/controls/community"
|
import "../../../Chat/controls/community"
|
||||||
|
|
||||||
@ -20,7 +21,7 @@ StatusScrollView {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var rootStore
|
property var rootStore
|
||||||
property var store
|
required property CommunitiesStore store
|
||||||
|
|
||||||
property int viewWidth: 560 // by design
|
property int viewWidth: 560 // by design
|
||||||
property bool isEditState: false
|
property bool isEditState: false
|
||||||
@ -196,7 +197,8 @@ StatusScrollView {
|
|||||||
HoldingsDropdown {
|
HoldingsDropdown {
|
||||||
id: dropdown
|
id: dropdown
|
||||||
|
|
||||||
store: root.store
|
assetsModel: store.assetsModel
|
||||||
|
collectiblesModel: store.collectiblesModel
|
||||||
|
|
||||||
function addItem(type, item, amount) {
|
function addItem(type, item, amount) {
|
||||||
const key = item.key
|
const key = item.key
|
||||||
|
@ -10,12 +10,14 @@ import shared.popups 1.0
|
|||||||
|
|
||||||
import AppLayouts.Chat.controls.community 1.0
|
import AppLayouts.Chat.controls.community 1.0
|
||||||
import AppLayouts.Chat.helpers 1.0
|
import AppLayouts.Chat.helpers 1.0
|
||||||
|
import AppLayouts.Chat.stores 1.0
|
||||||
|
|
||||||
StatusScrollView {
|
StatusScrollView {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var rootStore
|
property var rootStore
|
||||||
property var store
|
required property CommunitiesStore store
|
||||||
|
|
||||||
property int viewWidth: 560 // by design
|
property int viewWidth: 560 // by design
|
||||||
|
|
||||||
signal editPermissionRequested(int index)
|
signal editPermissionRequested(int index)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user